Water quality detection model training method and device, equipment and storage medium
Patent Information
- Application Number
- CN202610930778.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-26
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2046-06-26
AI Technical Summary
[0003]然而,现有水质遥感反演方法多依赖单一卫星遥感数据,数据源结构单一,且在建模方法上,普遍采用传统回归模型或浅层机器学习模型,模型拟合能力与泛化性能有限,难以充分挖掘与利用多源遥感影像间的光谱互补信息与深层光谱规律,导致总磷、总氮反演精度不足,水质检测结果存在较大误差,难以满足复杂湖泊水体高精度的水质监测需求
[0016]相比于现有技术,本发明公开的水质检测模型训练方法、装置、设备和存储介质,通过采用至少两个不同分辨率的卫星,在相同时间段采集遥感影像,结合不同分辨率卫星的优势,打破单一数据源的信息局限,充分挖掘多源遥感影像间的光谱互补信息,避免单一卫星数据带来的信息缺失,为高精度反演提供更全面的数据源支撑。另外,对预处理后的同一卫星遥感影像进行波段组合,生成多个候选影像,再基于波段组合特征与预设目标变量筛选目标影像,能够剔除无关干扰,并进一步结合基于梯度提升决策树的影像贡献评估与影像贡献衰减准则,实现对候选影像的自动递进式优化筛选,从而筛选出鲁棒性强、高相关性、低冗余的最优光谱组合特征,为后续反演提供高质量输入;同时,采用多分支结构,其中Sentinel-2分支用于提取多尺度空间特征(局部尺度、邻域尺度与全局尺度),刻画水体在不同空间范围下的细粒度变化、区域扩散过程及整体空间分布格局,从而提升对空间异质性与尺度依赖特征的表达能力;Sentinel-3分支用于提取光谱特征,实现多源信息的互补表达。进一步地,构建尺度-光谱异构图,并基于图注意力机制实现不同节点间的自适应加权与信息传递,结合门控融合机制对特征进行筛选与重构,从而增强关键特征表达并抑制冗余信息。相比于传统方法,本发明能够更充分建模多尺度空间特征与光谱特征之间的非线性关系,提高特征表达能力与反演精度,降低检测误差。
Smart Images

Figure CN122473587B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water quality testing technology, and in particular to a water quality testing model training method, apparatus, equipment, and storage medium. Background Technology
[0002] Traditional water quality monitoring typically relies on on-site sampling and laboratory analysis. This method is not only time-consuming and labor-intensive, but also cannot provide real-time and comprehensive monitoring of water pollution. In recent years, the development of remote sensing technology has provided a new means for the rapid inversion of water quality parameters. The inversion of total phosphorus and total nitrogen concentrations in water bodies based on satellite remote sensing data has advantages such as wide coverage, stable revisit periods, low monitoring costs, and no need for contact with the water body. It has gradually become an important means of a three-dimensional water environment monitoring system.
[0003] However, existing water quality remote sensing inversion methods mostly rely on single satellite remote sensing data, resulting in a single data source structure. Furthermore, in terms of modeling methods, they generally adopt traditional regression models or shallow machine learning models, which have limited model fitting ability and generalization performance. This makes it difficult to fully explore and utilize the spectral complementarity and deep spectral patterns between multi-source remote sensing images, leading to insufficient accuracy in total phosphorus and total nitrogen inversion and large errors in water quality detection results. Consequently, these methods are unable to meet the high-precision water quality monitoring needs of complex lakes. Summary of the Invention
[0004] The purpose of this invention is to provide a water quality testing model training method, apparatus, equipment, and storage medium that can effectively reduce testing errors and improve water quality testing accuracy.
[0005] To achieve the above objectives, embodiments of the present invention provide a water quality detection model training method, comprising: Preprocessing is performed on remote sensing images acquired by at least two satellites within the same time period; wherein the at least two satellites are satellites with different resolutions; By combining the preprocessed remote sensing images corresponding to the same satellite, multiple candidate images corresponding to each satellite are obtained. Based on the band combination features and preset target variables, at least one target image corresponding to each satellite is selected from the candidate images, and a preliminary image set corresponding to each satellite is constructed based on the target images. The image contribution of the initial image set is evaluated using a gradient boosting decision tree, and the optimal image set corresponding to each satellite is determined based on the image contribution. The water quality detection model is trained based on the optimal image set; wherein the water quality detection model is a model based on a multi-scale graph attention and adaptive gating fusion network, and the trained water quality detection model is used to output the water quality detection results of the remote sensing images to be inverted.
[0006] As an improvement to the above scheme, the preprocessing of remote sensing images acquired by at least two satellites within the same time period includes: Remote sensing images acquired by at least two satellites within the same time period are stitched together, cropped, and resampled.
[0007] As an improvement to the above scheme, the step of combining the preprocessed remote sensing images corresponding to the same satellite into bands to obtain multiple candidate images corresponding to each satellite includes: For different bands of remote sensing images corresponding to the same satellite, pixel mathematical operations are performed using preset band combination methods to generate multiple candidate images corresponding to each satellite; wherein, the band combination methods include at least two of the following: difference combination, ratio combination, normalization combination, and three-band combination, and each band combination method corresponds to one candidate image.
[0008] As an improvement to the above scheme, the step of selecting at least one target image corresponding to each satellite from the candidate images based on band combination features and preset target variables includes: Calculate the first similarity between the band combination features corresponding to the candidate image and the preset target variable; Images with a first similarity greater than a first threshold are selected from the candidate images and used as reference images; Redundant images are removed based on the correlation between the reference images to obtain the target image.
[0009] As an improvement to the above scheme, the step of removing redundant images based on the correlation between the reference images includes: Calculate the second similarity between any two reference images; When the second similarity between any two reference images is greater than the second threshold, the first similarity between the two reference images and the target variable is obtained. The reference image with higher similarity is retained, and the reference image with lower similarity is removed.
[0010] As an improvement to the above scheme, the step of using gradient boosting decision trees to evaluate the image contribution of the initial image set and determining the optimal image set for each satellite based on the image contribution includes: Based on the feature contribution evaluation model of gradient boosting decision tree, global importance analysis is performed on each target image in the initial image set to obtain feature importance scores. The target images in the initial image set are sorted according to the feature importance score, and target images are added to the incremental feature subset according to the sorting. The image contribution of each target image is obtained by evaluating the change in prediction error of the feature subset with each increment through cross-validation. The optimal image set is determined based on a preset stopping increment criterion; wherein, the stopping increment criterion is: when the image contribution corresponding to the newly added target image in the feature subset is less than a preset threshold, the increment of the feature subset is terminated, and the currently formed feature subset is taken as the optimal image set.
[0011] As an improvement to the above scheme, the number of feature coding branches in the water quality detection model is set to correspond to the number of satellite data sources; wherein, when the number of feature coding branches is 2, the first feature coding branch corresponds to high spatial resolution satellite imagery and is used to extract multi-scale spatial features including local scale, neighborhood scale and global scale; the second feature coding branch corresponds to high spectral resolution satellite imagery and is used to extract spectral features.
[0012] As an improvement to the above scheme, the water quality detection model includes a multi-scale spatial feature encoding module, a spectral feature encoding module, a heterogeneous graph construction module, a graph attention propagation module, a gating fusion module, and a prediction regression module; wherein, When the optimal image set is received, the multi-scale spatial feature encoding module and the spectral feature encoding module respectively extract the multi-scale spatial features and spectral features of each image in the optimal image set. The heterogeneous graph construction module is used to map the multi-scale spatial features and the spectral features to nodes and construct a scale-spectral heterogeneous graph. The graph attention propagation module uses the graph attention propagation mechanism to calculate the attention weights between nodes in the scale-spectral heterogeneous graph. The gating fusion module performs weighted fusion of the features of each node based on the attention weights to obtain fused features; Based on the fusion features, the prediction regression module outputs the predicted results of total phosphorus concentration and / or total nitrogen concentration in the water body.
[0013] To achieve the above objectives, embodiments of the present invention also provide a water quality testing model training device, comprising: A data preprocessing module is used to preprocess remote sensing images acquired by at least two satellites within the same time period; wherein the at least two satellites are satellites with different resolutions. The candidate image acquisition module is used to combine the preprocessed remote sensing images corresponding to the same satellite into bands to obtain multiple candidate images corresponding to each satellite. The initial image set construction module is used to select at least one target image corresponding to each satellite from the candidate images based on the band combination features and preset target variables, and construct an initial image set corresponding to each satellite based on the target images. The optimal image set construction module is used to evaluate the image contribution of the initial image set using a gradient boosting decision tree, and determine the optimal image set corresponding to each satellite based on the image contribution. The water quality detection module is used to train the water quality detection model based on the optimal image set; wherein the water quality detection model is a model based on a multi-scale graph attention and adaptive gating fusion network, and the trained water quality detection model is used to output the water quality detection results of the remote sensing image to be inverted.
[0014] To achieve the above objectives, embodiments of the present invention also provide a water quality testing model training device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the water quality testing model training method as described in any of the above embodiments.
[0015] To achieve the above objectives, embodiments of the present invention also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the water quality detection model training method as described in any of the above embodiments.
[0016] Compared to existing technologies, the water quality detection model training method, apparatus, equipment, and storage medium disclosed in this invention utilize at least two satellites with different resolutions to acquire remote sensing images within the same time period. By combining the advantages of satellites with different resolutions, it breaks through the information limitations of a single data source, fully explores the spectral complementary information between multi-source remote sensing images, avoids information loss caused by single satellite data, and provides more comprehensive data source support for high-precision inversion. Furthermore, band combinations are performed on the preprocessed satellite remote sensing images to generate multiple candidate images. Target images are then selected based on band combination features and preset target variables, eliminating irrelevant interference. Further, image contribution evaluation based on gradient boosting decision trees and image contribution attenuation criteria are combined to achieve automatic progressive optimization and selection of candidate images. This results in the selection of the optimal spectral combination features with strong robustness, high relevance, and low redundancy, providing high-quality input for subsequent inversion. Simultaneously, a multi-branch structure is adopted. The Sentinel-2 branch is used to extract multi-scale spatial features (local scale, neighborhood scale, and global scale) to characterize the fine-grained changes, regional diffusion processes, and overall spatial distribution patterns of water bodies in different spatial ranges, thereby improving the ability to express spatial heterogeneity and scale-dependent features. The Sentinel-3 branch is used to extract spectral features, achieving complementary expression of multi-source information. Further, a scale-spectral heterogeneity map is constructed, and adaptive weighting and information transfer between different nodes are achieved based on a graph attention mechanism. Combined with a gating fusion mechanism, features are selected and reconstructed, thereby enhancing the expression of key features and suppressing redundant information. Compared with traditional methods, this invention can more fully model the nonlinear relationship between multi-scale spatial features and spectral features, improve feature representation ability and inversion accuracy, and reduce detection error. Attached Figure Description
[0017] Figure 1 This is a flowchart of a water quality detection model training method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the model based on the multi-scale graph attention and adaptive gating fusion network provided in the embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of the gated fusion module provided in an embodiment of the present invention; Figure 4 This is a structural block diagram of a water quality testing model training device provided in an embodiment of the present invention; Figure 5 This is a structural block diagram of a water quality testing model training device provided in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] See Figure 1 , Figure 1 This is a flowchart of a water quality testing model training method provided in an embodiment of the present invention, which includes steps S1 to S5.
[0020] S1. Preprocess remote sensing images acquired by at least two satellites within the same time period; wherein the at least two satellites are satellites with different resolutions.
[0021] For example, a satellite refers to a multi-source satellite with multi-band remote sensing observation capabilities. In this embodiment of the invention, the satellites may include Sentinel-2 and Sentinel-3. This embodiment uses two satellites as an example for illustration. Of course, when using three or more satellites, the preprocessing method of this embodiment can be used to process and fuse the images of each satellite separately. Sentinel-2 has a high spatial resolution of 10m / 20m, providing clear details of ground objects and strong ability to capture subtle spectral changes in water bodies. Sentinel-3 has a large-scale observation range of 300m, offering stronger regional coverage. The high and low resolutions of the two complement each other, overcoming the limitations of single-satellite data in terms of dimensionality and information limitation, and enriching multi-source spectral observation information. The "same time period" refers to the time period during which multiple satellites pass overhead on the same day and the observation time difference between them does not exceed one hour. Priority should be given to selecting image data with low cloud cover and good image clarity. Since the total phosphorus and total nitrogen water quality of lakes is stable in a short period, synchronous observation can avoid fluctuations in water quality indicators caused by time-series differences, ensuring the matching of multi-source remote sensing images with the actual water conditions. The remote sensing images refer to multi-temporal remote sensing reflectance images of the study area downloaded through official data platforms (such as ESA Copernicus). The Sentinel-2 image includes 12 bands (B1-B8A, B10-B12), and 10 water quality sensitive bands are used for subsequent feature calculations, specifically B2 (blue), B3 (green), B4 (red), B5-B7 (red edge), B8 (near-infrared), B8A (red edge), B11 (shortwave infrared 1), and B12 (shortwave infrared 2). The Sentinel-3 image can select 16 marine observation bands from Oa02 to Oa17, which together constitute a multi-source water remote sensing dataset.
[0022] Furthermore, step S1 specifically includes: stitching, cropping, and resampling remote sensing images acquired by at least two satellites within the same time period.
[0023] For example, during image stitching, fragmented images from a single satellite on the same day are seamlessly stitched together to generate an integrated image covering the entire lake area under study. During resampling, the original 300m low-resolution Sentinel-3 image is uniformly resampled to 10m, maintaining spatial resolution consistent with Sentinel-2 and eliminating scale differences between multi-source images. During cropping, water body mask data is used to segment the land and water areas, removing non-water interference areas such as land and vegetation, and cropping the entire image to the target study boundary. The final result is standardized water remote sensing data that is non-redundant, high-quality, and scale-uniform, providing reliable input for subsequent band combination, feature selection, and model inversion.
[0024] It should be noted that during image stitching, because remote sensing images are multi-band raster data, different bands of a single satellite are stored independently. The stitching operation is divided according to satellite type, with Sentinel-2 and Sentinel-3 images processed independently, avoiding cross-satellite stitching. For multiple images from the same satellite and within the same observation period, each band is stitched separately. The original downloaded Sentinel-2 and Sentinel-3 images each contain an independent single-band raster image. The 10 water quality sensitive bands of Sentinel-2 are equivalent to 10 individual grayscale images, and the 16 ocean bands of Sentinel-3 are equivalent to 16 individual grayscale images. Multi-band images are not a single image, but rather a collection of multiple sets of individual band layers from the same region and time phase. Multiple images from the same satellite, passing over the same area on the same day, and covering the study area are grouped separately, such as one group for Sentinel-2 and another for Sentinel-3, without cross-satellite stitching. Taking the Sentinel-2 satellite as an example, all image blocks in band B2 are extracted, geographically matched, and seamlessly mosaicked to generate a complete B2 mosaic image. Similarly, all image blocks in band B3 are extracted and independently mosaicked to generate a complete B3 image. This process is repeated for each band from B4 to B5…B11, B12, where each band is mosaicked individually. During the mosaicking process, a unified coordinate system, projection, and pixel size are used to ensure complete alignment of geographic locations, row and column numbers, and consistent boundaries across all mosaicked bands from the same satellite. Likewise, cropping and resampling are performed uniformly on each band of the mosaicked image. Resampling and cropping operations are performed synchronously on a band-by-band basis throughout the process, ensuring complete correspondence of spatial range and pixel positions across bands of the same satellite, and mutual matching of multi-band information. This avoids spatial offsets and data misalignments, guaranteeing the data standardization and computational accuracy of subsequent band combination operations and feature selection.
[0025] In this embodiment of the invention, by performing preprocessing operations such as stitching, cropping, and resampling on synchronous remote sensing images from multiple satellites with different resolutions, complete image data of the entire research area can be integrated, and interference from invalid land areas can be eliminated. This unifies the spatial resolution of different satellite images, eliminates scale differences between multi-source remote sensing data, and achieves matching of spatial coordinates between multi-source images. It effectively solves the problems of limited information from a single satellite data source and difficulty in fusing multi-source data, ensuring the consistency and accuracy of subsequent band combination and feature extraction, and mitigating errors caused by differences in sensor resolution.
[0026] S2. Combine the preprocessed remote sensing images corresponding to the same satellite by band to obtain multiple candidate images corresponding to each satellite.
[0027] For example, band combination refers to using pre-processed multi-band reflectance data and different spectral bands within the same satellite to reconstruct entirely new spectral combination features through pixel-by-pixel mathematical operations. This enhances the sensitivity of the original bands to changes in water quality parameters. It should be noted that this invention follows the principle of independent computation within the same satellite and no cross-satellite combination. For example, each band of Sentinel-2 is calculated and combined independently, and each band of Sentinel-3 is calculated and combined independently; cross-satellite band hybrid computation between Sentinel-2 and Sentinel-3 is not performed.
[0028] Further, step S2 specifically includes: performing pixel mathematical operations on different bands of the remote sensing image corresponding to the same satellite using a preset band combination method to generate multiple candidate images corresponding to each satellite; wherein, the band combination method includes at least two of the following: difference combination, ratio combination, normalization combination, and three-band combination, and each band combination method corresponds to one candidate image.
[0029] For example, band combination methods include: 1) Difference combination refers to the combination of differences according to the formula Perform pixel-by-pixel calculations and use the difference in reflectance between two different spectral bands to highlight the spectral reflectance differences between different spectral bands. 2) Ratio combination refers to the combination of ratios according to the formula Pixel-by-pixel calculations are performed, relying on the band ratio relationship to reduce the interference caused by changes in light intensity, thereby improving the sensitivity to the identification of water turbidity and water quality factors. 3) Normalized combination refers to the combination according to the formula Perform pixel-by-pixel calculations to enhance the differentiated response capability between different bands and adapt to the quantitative calculation of water quality index and water body spectral characteristics; 4) Three-band combination refers to the combination of three bands according to the formula. Perform pixel-by-pixel comprehensive calculations, fuse spectral information from three independent bands, and uncover complex and subtle patterns of spectral variation in water bodies. In this model, A, B, and C are all different spectral bands selected from the same satellite. For example, A, B, and C can be any three non-overlapping bands selected from the 10 spectral bands of the Sentinel-2 satellite. All spectral bands of the Sentinel-2 satellite can participate in the band combination calculation process, and the same applies to Sentinel-3. Since both Sentinel-2 and Sentinel-3 satellites have multiple spectral bands, and each spectral band of both satellites can participate in the band combination calculation, multiple candidate images of different types of band combinations corresponding to Sentinel-2 and Sentinel-3 can be obtained. This provides sufficient data support for the subsequent selection of target images, and further fully explores the spectral complementary information of different satellite bands, laying the foundation for improving the accuracy of water quality inversion. In addition, through the above combination method, the model's ability to identify changes in total phosphorus and total nitrogen in lake water quality can be enhanced, improving the model's stability and applicability.
[0030] In this embodiment of the invention, pixel operations with multiple band combinations are performed on multi-band images of the same satellite, which can deeply mine the original spectral information, enhance the sensitive spectral response characteristics of total phosphorus and total nitrogen in water bodies, make up for the deficiency of the ability of a single original band to characterize water quality parameters, amplify subtle spectral differences through different mathematical combinations, avoid the problems of single spectral features and insufficient information utilization in existing technologies, provide sufficient and effective feature reserves for subsequent feature screening and model analysis, and improve the sensitivity and accuracy of subsequent water quality parameter inversion.
[0031] S3. Based on the band combination characteristics and preset target variables, at least one target image corresponding to each satellite is selected from the candidate images, and a preliminary image set corresponding to each satellite is constructed based on the target images.
[0032] For example, band combination features refer to novel spectral feature data generated pixel by pixel after the above-mentioned difference, ratio, normalized difference, and three-band combination operations. The target variable is the water quality index of the lake body to be monitored, such as the sum of the total phosphorus concentration and total nitrogen concentration. The target variable can be obtained by processing the actual collected data. For example, through field sampling, several measured sampling points are evenly distributed within the study lake area, and surface water samples are collected simultaneously. Based on national standard laboratory testing methods, each water sample is quantitatively measured to obtain the measured values of total phosphorus concentration and total nitrogen concentration corresponding to each sampling point, which are used as real ground measured data. Then, the spatial geographical location of each sampling point is matched with the pixels of the remote sensing image, so that each measured water quality data corresponds to the band combination feature pixel of the same spatial location in the remote sensing image, thereby constructing a spectral feature-water quality measured index matching dataset. Therefore, the measured total phosphorus concentration and measured total nitrogen concentration obtained through experiments are uniformly determined as preset target variables, which are used to calculate the Pearson correlation coefficient between the combined characteristics of each band and the water quality indicators, and to complete the correlation screening and redundancy removal of the characteristics.
[0033] Further, step S3 specifically includes: calculating the first similarity between the band combination features corresponding to the candidate images and the preset target variables; selecting images from the candidate images whose first similarity is greater than a first threshold as reference images; and removing redundant images based on the correlation between the reference images to obtain the target image. This target image is used to construct an initial image set.
[0034] For example, this invention employs a two-stage feature screening strategy. The first stage is target variable correlation screening, using the Pearson correlation coefficient to characterize the first similarity between the band combination features and the target variables of total phosphorus and total nitrogen. The formula for calculating the first similarity is as follows: (1); in, The first similarity; Let be the band combination feature value of the i-th sample; The target variable value (the sum of the concentrations of total phosphorus and total nitrogen) for the i-th sample. This represents the mean of the band combination characteristics. , where n is the mean of the target variable, and n is the sample size, referring to the total number of field sampling points within the study area where water body sampling, water quality index testing, and matching with remote sensing image pixels have been completed. Using a single sampling point as the basic unit, band combination feature data and measured water quality target variable data for that location are extracted respectively. Correlation calculations between features and the target variable, and between different features, are performed using the same set of spatial samples, ensuring data consistency and accurate screening results.
[0035] For example, a first threshold can be set to 0.35 (which can be adjusted as needed according to actual conditions), and candidate images of band combinations with a first similarity greater than 0.35 can be selected and retained as reference images for subsequent processing, while invalid features with weak correlation and no actual characterization value can be removed.
[0036] It should be noted that the samples used for correlation calculation are actual water sampling points deployed within the study area, not band combinations or the images themselves. This invention first spatially matches the geographic coordinates of each field sampling point with the preprocessed multi-source remote sensing images. For each band combination candidate image, pixel feature values at the corresponding sampling point are extracted and combined with the measured total phosphorus and total nitrogen concentration target variable data at that point to form a one-to-one corresponding sample dataset. The Pearson correlation coefficient is calculated using this limited set of measured samples to quantitatively evaluate the correlation between the spectral characteristics of a single band combination image and water quality indicators. For example, the higher the correlation between a certain band combination and water quality at the sampling point, the stronger the water quality indication capability of the entire candidate image. Based on the statistical correlation law of the sampling points, the water quality response capability of the entire candidate image is extrapolated, thereby achieving effective screening and redundancy removal for the entire candidate image.
[0037] In this embodiment of the invention, a two-stage screening strategy of initial screening based on similarity and removal of redundant features is adopted. First, based on the correlation between features and target variables, highly correlated reference images are retained and invalid or weakly correlated interfering features are removed. Then, highly collinear redundant information is removed by combining the correlation between reference images, thus avoiding the problem of repeated feature superposition and reducing interference from irrelevant data.
[0038] For example, removing redundant images based on the correlation between the reference images includes: calculating a second similarity between any two reference images; when the second similarity between any two reference images is greater than a second threshold, obtaining a first similarity between the two reference images and the target variable; retaining the reference image with the higher first similarity, and removing the reference image with the lower first similarity.
[0039] For example, after completing the first stage of screening, a subset of spectral band combinations with strong correlation to the target variable is obtained. To further eliminate multicollinearity among spectral band combinations, reduce the risk of model overfitting, and improve the generalization ability of the inversion model, this invention performs redundancy removal on the retained spectral band combinations. At this point, the second similarity is the Pearson correlation coefficient between the band combination features corresponding to any two reference images. The formula for calculating the second similarity is as follows: (2); in, The second similarity; , These represent the values of the two different band combination features in the i-th sample; , These are the sample means for the corresponding features.
[0040] For example, the second threshold can be set to 0.7 (which can be adjusted as needed). When the second similarity between any two reference image features is greater than 0.7, the following redundancy elimination strategy is adopted: compare the first similarity between the two spectral band combinations and the target variable, retain the spectral band combination features that are more correlated with the target variable, and eliminate the spectral band combination features that are less correlated with the target variable. Through the above two-stage feature selection strategy, a subset of spectral band combinations that are highly correlated with the target variable and have low linear redundancy is finally obtained, which is used for the subsequent construction of the lake total phosphorus and total nitrogen concentration inversion model.
[0041] In this embodiment of the invention, highly linearly correlated redundant features are identified by calculating the second similarity between reference images. For strongly correlated image pairs, the degree of correlation between the two and the standard variable is combined to selectively retain them. This can selectively eliminate duplicate and overlapping spectral features, avoid redundant features from interfering with model learning, reduce invalid computation, lower the risk of model overfitting, and enhance the model's generalization ability.
[0042] S4. Use gradient boosting decision trees to evaluate the image contribution of the initial image set, and determine the optimal image set for each satellite based on the image contribution decay.
[0043] For example, the present invention introduces an optimal image set determination strategy based on gradient boosting decision tree to further select the band combination image set that contributes the most to water quality inversion from the initial image set. The contribution evaluation and incremental analysis are performed on each image in the initial image set.
[0044] Specifically, in step S4, the step of evaluating the image contribution of the initial image set using a gradient boosting decision tree and determining the optimal image set corresponding to each satellite based on the image contribution includes: performing a global importance analysis on each target image in the initial image set based on a feature contribution evaluation model using a gradient boosting decision tree to obtain a feature importance score; sorting the target images in the initial image set according to the feature importance score, and adding target images to the incremental feature subset according to the sorting; evaluating the change in prediction error of the feature subset at each increment through cross-validation to obtain the image contribution of each target image; and determining the optimal image set based on a preset stopping increment criterion; wherein, the stopping increment criterion is: when the image contribution corresponding to the newly added target image in the feature subset is less than a preset threshold, the increment of the feature subset is terminated, and the currently formed feature subset is the optimal image set.
[0045] For example, a sample feature matrix is constructed using the band combination features corresponding to the initial image set, and a gradient boosting decision tree model is trained using the measured water quality target variable as supervised information. The feature importance score of each target image is calculated using the loss reduction caused by the splitting of the decision tree during model training, based on the corresponding features of each image. The calculation formula is as follows: (3); in, Indicates the first k The feature importance score of each target image is used to characterize the global contribution of the target image to the target water quality variable. Indicates the first t In the decision tree, the first k The amount of loss reduction caused by the corresponding features of each target image; This represents the total number of decision trees.
[0046] All target images in the initial image set are sorted in descending order based on their importance scores to obtain an image priority sequence. ,in The target image with the highest importance score is selected. Increasing feature subsets are constructed progressively based on the ranking results. That is, target images are sequentially included in the feature subset according to their importance scores from high to low. Each time a new target image is introduced into the feature subset, the change in prediction error needs to be calculated through cross-validation to obtain the image contribution corresponding to that target image. The calculation formula is as follows: (4); in, Indicates the first k The image contribution corresponding to each target image represents the amount of decrease in the model's prediction loss after adding a new target image; Indicates before use When constructing a feature set from a target image, the model prediction loss obtained through cross-validation is RMSE (Root Mean Square Error). Indicates before adoption k Cross-validation prediction error when constructing a feature set from individual target images; >0 indicates that the newly introduced target image can reduce the prediction error and has a positive contribution; ≤0 indicates that the newly introduced target image has no effect on model performance or has a negative impact.
[0047] As the number of target images increases, the image contribution of each newly added target image is calculated individually. When a new target image is added, the image contribution is calculated. When the value is less than a preset threshold, the introduction of subsequent target images is stopped, and the currently selected target images are selected as the optimal image set. For example, if the preset threshold is set to 0.005, after adding a target image once, if the image contribution is calculated according to the above formula (4), the contribution will be... If the value is 0.002, and it is below this threshold, the iteration stops and no more remaining target images are included. The feature subset formed at this point is the optimal image set.
[0048] In this embodiment of the invention, a gradient boosting decision tree model is used to assess the importance and analyze the image contribution of the initial image set, adaptively determining the optimal band combination image set. This avoids the subjectivity and limitations of manual experience-based selection, achieving objectivity, automation, and optimization in feature selection. Furthermore, a three-stage selection strategy—target variable correlation screening, feature redundancy removal, and optimal image set determination—effectively retains key images highly correlated with water quality indicators and possessing independent information contributions, further reducing feature redundancy and noise interference, and improving the stability and prediction accuracy of subsequent water quality inversion models.
[0049] It should be noted that on-site measurements of total phosphorus and total nitrogen in water bodies can only obtain true water quality values for a limited number of discrete sampling points, and can only characterize the water quality at the sampling location. This cannot achieve large-scale, spatially continuous water quality distribution monitoring of lakes. Remote sensing imagery has the advantages of wide-area, full-coverage, and continuous spatiotemporal observation, but it cannot directly output total phosphorus and total nitrogen concentration values. Therefore, this invention uses a small number of measured total phosphorus and total nitrogen concentrations as target true values, constructs a correlation with remote sensing band features, and trains a model. Through the trained water quality detection model, it achieves pixel-by-pixel, full-area continuous inversion and spatial distribution monitoring of total phosphorus and total nitrogen concentrations across an entire water body based on remote sensing imagery, overcoming the shortcomings of traditional on-site sampling which can only observe at single points and cannot provide dynamic monitoring of the entire area.
[0050] S5. The water quality detection model is trained based on the optimal image set; wherein the water quality detection model is a model based on a multi-scale graph attention and adaptive gating fusion network, and the trained water quality detection model is used to output the water quality detection results of the remote sensing images to be inverted.
[0051] Specifically, the water quality detection model includes a multi-scale spatial feature encoding module, a spectral feature encoding module, a heterogeneous graph construction module, a graph attention propagation module, a gating fusion module, and a prediction regression module.
[0052] Upon receiving the optimal image set, the multi-scale spatial feature encoding module and the spectral feature encoding module extract the multi-scale spatial features and spectral features of each image in the optimal image set, respectively. The multi-scale spatial feature encoding module and the spectral feature encoding module each constitute a multi-branch feature encoding structure based on satellite data sources, with the number of branches corresponding to the number of satellite data sources. Specifically, the first branch corresponding to Sentinel-2 extracts multi-scale spatial features from the selected optimal image set and generates local-scale nodes L, neighborhood-scale nodes N, and global-scale nodes G; the second branch corresponding to Sentinel-3 extracts spectral feature representations from the optimal spectral combination image set and generates spectral feature nodes S. L, N, and G characterize the texture structure features and spatial heterogeneity distribution patterns of water bodies at different spatial scales, while S characterizes the overall spectral features of water bodies at the regional scale.
[0053] Furthermore, the number of feature coding branches in the water quality detection model is set to correspond to the number of satellite data sources; wherein, when the number of feature coding branches is 2, the first feature coding branch corresponds to high spatial resolution satellite imagery and is used to extract multi-scale spatial features including local scale, neighborhood scale and global scale, and at this time the first feature coding branch corresponds to the multi-scale spatial feature coding module; the second feature coding branch corresponds to high spectral resolution satellite imagery and is used to extract spectral features, and at this time the second feature coding branch corresponds to the spectral feature coding module.
[0054] The heterogeneous graph construction module is used to map the multi-scale spatial features and the spectral features to nodes and construct a scale-spectral heterogeneous graph. For example, the heterogeneous graph construction module is used to construct a scale-spectral heterogeneous graph with a node set V={L,N,G,S} and establish the association edges between spatial scales and between space and spectrum.
[0055] The graph attention propagation module utilizes a graph attention propagation mechanism to calculate the attention weights between nodes in the scale-spectral heterogeneous graph. For example, the graph attention propagation module is used to calculate the attention weights between nodes through a graph attention mechanism, realizing cross-modal information interaction between spatial scale features and spectral features, and outputting an enhanced node representation L. 、 N, G 、 S。 The gated fusion module performs weighted fusion of the features of each node based on the attention weights to obtain fused features. The gated fusion module is then used to perform gated weighted fusion of the enhanced node features to obtain the final fused features.
[0056] The prediction and regression module outputs prediction results for total phosphorus concentration and / or total nitrogen concentration in the water body based on the fusion features. The prediction and regression module is used to input the fusion features into a multilayer fully connected network and output prediction results for total phosphorus concentration and / or total nitrogen concentration in the water body.
[0057] Further, see Figure 2 , Figure 2 This is a schematic diagram of the model based on multi-scale graph attention and adaptive gating fusion network provided in an embodiment of the present invention. This structure constructs a unified feature fusion framework for the multi-scale features (including local, neighborhood, and global scales) of the Sentinel-2 optimal spectral combination image set and the Sentinel-3 optimal spectral combination features. Each scale branch and spectral branch are modeled in parallel and work synergistically. An adaptive gating mechanism dynamically assigns weights to features from different sources and at different scales, enhancing the response to key information sensitive to target variables while suppressing redundant scale information. This achieves efficient collaborative fusion and unified representation of multi-source remote sensing information from Sentinel-2 (i.e., Sentinel 2 in the figure) and Sentinel-3 (i.e., Sentinel 3 in the figure). Specifically, its working process is as follows: 1) Multi-scale spatial feature encoding module, which is used to extract texture and structural information at different spatial scales from the best image set of Sentinel-2.
[0058] Spatial neighborhood windows of different sizes are constructed centered on the target pixel to acquire multi-scale spatial features at local, neighborhood, and global scales. Among these: The local scale L uses a 1×1 or 3×3 spatial window to extract fine spectral features; The neighborhood scale N uses an 11×11 or 15×15 spatial window to extract the spatial diffusion characteristics of water bodies. The global scale G is obtained using a 31×31 spatial window or Global Average Pooling (GAP) method to characterize the overall water environment background and large-scale distribution pattern.
[0059] Subsequently, a Convolutional Neural Network (CNN) is used to encode the features of the spatial windows at each scale, obtaining spatial feature representations at the corresponding scales, forming a set of spatial nodes: (5); Wherein, L, N and G represent local scale nodes, neighborhood scale nodes and global scale nodes, respectively, used to characterize the texture structure features and spatial heterogeneity distribution patterns of water bodies in different spatial ranges.
[0060] In this embodiment of the invention, the module is constructed based on the optimal image set obtained by Sentinel-2 satellite screening. Taking advantage of the high spatial resolution (about 10–20m) of Sentinel-2 images, it achieves fine-grained spatial structure characterization at the pixel level. On this basis, a multi-scale spatial expression system is further constructed, thereby improving the comprehensive characterization ability of local changes in water bodies, spatial diffusion processes and overall spatial heterogeneity.
[0061] 2) Spectral feature encoding module, which is used to extract spectral combination features from the optimal image set of Sentinel-3.
[0062] For example, this invention inputs the Sentinel-3 optimal spectral combination image set into a spectral coding network, models the nonlinear response relationship between different spectral channels through convolution operations, and extracts high-level spectral semantic features. express: (6); Here, S represents the spectral feature node, which is used to characterize the overall spectral background information and stable nutrient response characteristics of the water body at the regional scale. Sentinel-3 has a spatial resolution of 300m, and its spectral feature nodes participate in graph structure modeling as global spectral constraint information, thus forming a complementary relationship with the multi-scale spatial features of Sentinel-2 to enhance the model's stable representation ability under cloud and rain shading or temporal discontinuity conditions.
[0063] 3) Heterogeneous graph construction module, which is used to build a unified spatial-spectral feature representation framework.
[0064] For example, the set of spatial nodes extracted using the Sentinel-2 branch. Using the spectral nodes S extracted from the Sentinel-3 branch as graph nodes, a scale-spectral heterogeneity graph is constructed, forming a node set: (7); At the same time, the following associated edges are established: Sentinel-2 internal scale edges: the connection relationship between local scale L and neighborhood scale N, and the connection relationship between neighborhood scale N and global scale G; Cross-modal information transfer edges: the connection relationship between global scale G and spectral node S, the connection relationship between local scale L and spectral node S, and the connection relationship between neighborhood scale N and spectral node S; That is, the edge set satisfies the following formula: (8).
[0065] By establishing the aforementioned edge relationships, a unified scale-spectral feature interaction structure is created to characterize the bidirectional dependency between spatial structure and spectral priors.
[0066] 4) Graph attention propagation module, which is used to realize cross-modal feature interaction between Sentinel-2 spectral and spatial information and Sentinel-3 spectral information.
[0067] For example, a graph attention mechanism is used to calculate the information transfer weights between nodes, and the information contribution of different neighboring nodes is adaptively adjusted according to the association strength between nodes, thereby achieving information propagation and fusion between spatial scale features and spectral features. The formula for calculating the graph attention coefficient is: (9); in, Represents a node For nodes Attention weights, which can range from [0,1]. The larger the weight, the more important the neighboring nodes in the topology graph. Feature information in the update node The higher the percentage of contribution at any given time; and They are nodes and nodes Features; For nodes any neighbor Features; It is a learnable linear transformation matrix used to perform linear dimension mapping and unify the dimension space of features from different sources; This is the attention vector, where the superscript T represents the matrix transpose; Indicates feature concatenation operation; Represents a node The set of all neighboring nodes in the scale-spectral heterogeneity graph.
[0068] After multiple rounds of graph attention propagation, continuously using Weighted aggregation of neighbor features, iterative updates of L, N, G, and S, yields the enhanced node representation: (10); in, This represents the feature set consisting of all enhanced node features after multiple rounds of graph attention information propagation; , , and These represent the enhanced node features after incorporating cross-scale and cross-modal contextual information, respectively.
[0069] 5) Gated fusion module, which is used to perform adaptive weighted fusion of enhanced multi-scale node features.
[0070] See Figure 3 , Figure 3 This is a schematic diagram of the gated fusion module provided in an embodiment of the present invention. First, feature mapping is performed on the enhanced node features. Then, the importance weights of nodes at each scale are calculated using a gated weight generation unit, and features at different scales are dynamically weighted according to these weights. The gated weight calculation formula is as follows: (11); in, Representation of features The corresponding gating weights, ,Right now correspond , correspond , correspond , correspond ; The enhanced node features correspond to the four types of enhanced node features output by the graph attention module. , , and ; The learnable weight matrix is built into the fully connected (FC) layer, and the parameters are automatically optimized during network training, such as... Figure 3 As shown, , , , Each corresponds to a fully connected layer (FC), then the corresponding The specific values may not be the same. During the training process, these four weight matrices will be optimized in different directions and learn different mapping rules. This is the Sigmoid activation function.
[0071] First, learnable weights are calculated for the four cross-modal features using a Sigmoid gate. Then, the weights are multiplied element-wise with their corresponding features, and the results are summed in a weighted manner to obtain the fused features. The final fusion feature is represented as: (12).
[0072] In this embodiment of the invention, an adaptive gating mechanism enhances the response of scale features sensitive to the target variable while suppressing redundant scale information. This achieves collaborative fusion between the local, neighborhood, and global scales of the Sentinel-2 optimal spectral composite image and the Sentinel-3 optimal spectral composite image, ultimately yielding a unified fused feature representation. This invention uses a gating fusion mechanism to dynamically allocate weights to spatial and spectral features at different scales. It can automatically adjust the contribution of each feature node based on the feature response of the current sample, improving the collaborative expressive power of multi-source heterogeneous features and the robustness of the model. Specifically, when the reliability of a certain scale feature or spectral feature is reduced due to noise interference, cloud pollution, mixed pixel effects, or changes in observation conditions, the gating fusion mechanism can adaptively reduce the weight of the corresponding node, minimizing the impact of low-quality features on the final prediction result, thereby improving the stability and accuracy of the model in inverting water quality parameters under complex environmental conditions.
[0073] 6) Prediction and Regression Module: This module consists of a multi-layer fully connected neural network, specifically including a first hidden layer, a second hidden layer, and an output layer. Dropout layers are used between the hidden layers to suppress overfitting. After passing through the feature fusion prediction and regression module, the predicted water quality parameters for the corresponding target pixels are output. These values are then inversely normalized to obtain the actual total phosphorus and total nitrogen concentrations, thus achieving water quality detection.
[0074] For example, the fusion features output by the gating fusion module As the input features for this module, the input features are first fed into the first hidden layer FC (128). A linear mapping is completed through the learnable weight matrix and bias parameters, transforming the input features into 128-dimensional high-dimensional hidden layer features, and mining the nonlinear correlation between the fused features and water quality parameters. The features output by the first hidden layer are fed into the first dropout layer. During the model training phase, some neuron outputs are randomly and temporarily discarded according to the preset inactivation probability. The features output by the dropout layer are fed into the second hidden layer FC (64), further compressing the 128-dimensional hidden features, and selecting and refining effective features that are highly correlated with the concentrations of total phosphorus (TP) and total nitrogen (TN), and eliminating... After removing irrelevant interference information, 64-dimensional refined features are obtained. The refined features are subjected to random regularization constraints again through the second Dropout layer to further reduce the redundancy of parameters in the fully connected network and improve the generalization ability of the model across water samples. The output features of the Dropout layer are sent to the output layer FC(1) to map the 64-dimensional features into a single scalar value, which is the water quality concentration prediction value under the preprocessed normalized scale. Finally, based on the water quality concentration extreme value parameters saved in the sample preprocessing stage, the output scalar is subjected to inverse normalization operation to restore the normalized prediction value to the real physical dimensions, and finally output the actual concentration prediction results of TP / TN in the water body.
[0075] It should be noted that during the model training process, the optimal Sentinel-2 image set is used to extract L, N, and G node features through multi-scale spatial feature encoding, and the optimal Sentinel-3 image set is used to extract S node features through the spectral feature encoding module to construct a scale-spectral heterogeneous map. Subsequently, cross-scale and cross-modal information interaction is achieved through graph attention propagation. Then, a unified feature representation is generated through the gated fusion module. Finally, the prediction and regression module outputs the prediction results of total phosphorus and total nitrogen concentrations.
[0076] After training, for the remote sensing image to be inverted, the same preprocessing, band combination and three-stage feature screening operations as in the training stage are first performed. Then, the trained water quality detection model is input. Through multi-scale spatial feature extraction, spectral feature encoding, graph attention propagation and gating fusion, the distribution results of total phosphorus and total nitrogen concentrations in the water body of the study area are finally output pixel by pixel.
[0077] In this embodiment of the invention, by constructing a scale-spectral heterogeneous graph, Sentinel-2 multi-scale spatial information and Sentinel-3 spectral information are modeled. The graph attention mechanism is used to realize cross-scale and cross-modal feature interaction, and the contribution of features at each scale is dynamically optimized by combining a gating fusion strategy. This effectively explores the spatial-spectral coupling law in complex water environments, leverages the complementary advantages of Sentinel-2's high spatial resolution and Sentinel-3's rich spectral information, improves the model's perception and generalization ability of changes in total phosphorus and total nitrogen, thereby improving the accuracy of lake water quality inversion and reducing prediction errors.
[0078] Compared to existing technologies, the water quality detection model training method, apparatus, equipment, and storage medium disclosed in this invention utilize at least two satellites with different resolutions to acquire remote sensing images within the same time period. By combining the advantages of different resolution satellites, it overcomes the information limitations of a single data source, fully integrating the advantages of high spatial resolution and high spectral information coverage, avoiding information gaps caused by single satellite data, and providing more comprehensive data source support for high-precision inversion. This invention first performs band combination operations on the remote sensing images from each satellite to construct multiple candidate spectral features. Then, through a three-stage feature selection strategy—target variable correlation screening, feature redundancy removal, and optimal image set determination—it automatically selects key image combinations that are highly correlated with water quality indicators and have independent information contributions from a large number of candidate images, effectively reducing feature redundancy and noise interference, and improving the quality of input features. Based on this, a water quality detection model based on multi-scale and graph attention networks is constructed. High spatial resolution satellite images are used to extract spatial features at local, neighborhood, and global scales, fully characterizing the spatial structure and texture changes of water bodies; another high spectral resolution satellite image is used to extract spectral features, reflecting the spectral response information corresponding to changes in water composition. By constructing a scale-spectral heterogeneous graph, features at different spatial scales and spectral features are uniformly represented in the same graph structure. A graph attention mechanism is used to adaptively learn the information transfer weights between nodes, achieving cross-scale and cross-feature information interaction and deep fusion. Simultaneously, a gating fusion mechanism adaptively adjusts the contribution weights of various features, enhancing effective information related to the target variable and suppressing the influence of redundant and noisy features. Therefore, this invention can effectively mine the coupling relationship between spatial structure information and spectral response information in complex aquatic environments, overcoming the insufficient feature representation capabilities of traditional empirical models, statistical regression models, and shallow machine learning models. It improves the accuracy of lake water quality inversion and the model's generalization ability, enabling high-precision monitoring and continuous spatial inversion of water quality parameters over a large area.
[0079] See Figure 4 , Figure 4 This is a structural block diagram of a water quality testing model training device 100 provided in an embodiment of the present invention. The water quality testing model training device 100 includes: The data preprocessing module 11 is used to preprocess remote sensing images acquired by at least two satellites in the same time period; wherein the at least two satellites are satellites with different resolutions. The candidate image acquisition module 12 is used to combine the preprocessed remote sensing images corresponding to the same satellite into bands to obtain multiple candidate images corresponding to each satellite. The initial image set construction module 13 is used to select at least one target image corresponding to each satellite from the candidate images based on the band combination features and preset target variables, and construct an initial image set corresponding to each satellite based on the target images. The optimal image set construction module 14 is used to evaluate the image contribution of the initial image set using a gradient boosting decision tree, and determine the optimal image set corresponding to each satellite based on the image contribution. The water quality detection module 15 is used to train the water quality detection model based on the optimal image set; wherein the water quality detection model is a model based on a multi-scale graph attention and adaptive gating fusion network, and the trained water quality detection model is used to output the water quality detection results of the remote sensing image to be inverted.
[0080] It is worth noting that the working process of each module in the water quality testing model training device 100 described in the embodiments of the present invention can refer to the working process of the water quality testing model training method described in the above embodiments, and will not be repeated here.
[0081] See Figure 5 , Figure 5 This is a structural block diagram of a water quality testing model training device 200 provided in an embodiment of the present invention. The water quality testing model training device 200 includes a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, it implements the steps in the various water quality testing model training method embodiments described above.
[0082] For example, the computer program can be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the water quality detection model training device 200.
[0083] The water quality testing model training device 200 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will understand that the schematic diagram is merely an example of the water quality testing model training device 200 and does not constitute a limitation on the device. It may include more or fewer components than shown in the diagram, or combine certain components, or use different components. For example, the water quality testing model training device 200 may also include input / output devices, network access devices, buses, etc.
[0084] The processor 21 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 21 is the control center of the water quality detection model training device 200, connecting all parts of the device via various interfaces and lines.
[0085] The memory 22 can be used to store the computer programs and / or modules. The processor 21 implements various functions of the water quality detection model training device 200 by running or executing the computer programs and / or modules stored in the memory 22 and calling the data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0086] The modules / units integrated in the water quality testing model training device 200, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by the processor 21, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0087] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for training a water quality detection model, characterized in that, include: Preprocessing is performed on remote sensing images acquired by at least two satellites within the same time period; wherein the at least two satellites are satellites with different resolutions; By combining the preprocessed remote sensing images corresponding to the same satellite, multiple candidate images corresponding to each satellite are obtained. Based on the band combination features and preset target variables, at least one target image corresponding to each satellite is selected from the candidate images, and a preliminary image set corresponding to each satellite is constructed based on the target images. The image contribution of the initial image set is evaluated using a gradient boosting decision tree, and the optimal image set corresponding to each satellite is determined based on the image contribution. The water quality detection model is trained based on the optimal image set; wherein the water quality detection model is a model based on a multi-scale graph attention and adaptive gating fusion network, and the trained water quality detection model is used to output the water quality detection results of the remote sensing images to be inverted.
2. The water quality detection model training method as described in claim 1, characterized in that, The preprocessing of remote sensing images acquired by at least two satellites within the same time period includes: Remote sensing images acquired by at least two satellites within the same time period are stitched together, cropped, and resampled.
3. The water quality detection model training method as described in claim 1, characterized in that, The process involves combining the preprocessed remote sensing images corresponding to the same satellite into bands to obtain multiple candidate images corresponding to each satellite, including: For different bands of remote sensing images corresponding to the same satellite, pixel mathematical operations are performed using preset band combination methods to generate multiple candidate images corresponding to each satellite; wherein, the band combination methods include at least two of the following: difference combination, ratio combination, normalization combination, and three-band combination, and each band combination method corresponds to one candidate image.
4. The water quality detection model training method as described in claim 1, characterized in that, The step of selecting at least one target image corresponding to each satellite from the candidate images based on band combination features and preset target variables includes: Calculate the first similarity between the band combination features corresponding to the candidate image and the preset target variable; Images with a first similarity greater than a first threshold are selected from the candidate images and used as reference images; Redundant images are removed based on the correlation between the reference images to obtain the target image.
5. The water quality detection model training method as described in claim 4, characterized in that, The process of removing redundant images based on the correlation between the reference images includes: Calculate the second similarity between any two reference images; When the second similarity between any two reference images is greater than the second threshold, the first similarity between the two reference images and the target variable is obtained. The reference image with higher similarity is retained, and the reference image with lower similarity is removed.
6. The water quality detection model training method as described in claim 1, characterized in that, The step of evaluating the image contribution of the initial image set using a gradient boosting decision tree, and determining the optimal image set for each satellite based on the image contribution, includes: Based on the feature contribution evaluation model of gradient boosting decision tree, global importance analysis is performed on each target image in the initial image set to obtain feature importance scores. The target images in the initial image set are sorted according to the feature importance score, and target images are added to the incremental feature subset according to the sorting. The image contribution of each target image is obtained by evaluating the change in prediction error of the feature subset with each increment through cross-validation. The optimal image set is determined based on a preset stopping increment criterion; wherein, the stopping increment criterion is: when the image contribution corresponding to the newly added target image in the feature subset is less than a preset threshold, the increment of the feature subset is terminated, and the currently formed feature subset is taken as the optimal image set.
7. The water quality detection model training method as described in claim 1, characterized in that, The number of feature coding branches in the water quality detection model is set to correspond to the number of satellite data sources; when the number of feature coding branches is 2, the first feature coding branch corresponds to high spatial resolution satellite imagery and is used to extract multi-scale spatial features including local scale, neighborhood scale and global scale; the second feature coding branch corresponds to high spectral resolution satellite imagery and is used to extract spectral features.
8. The water quality detection model training method as described in claim 1, characterized in that, The water quality detection model includes a multi-scale spatial feature encoding module, a spectral feature encoding module, a heterogeneous graph construction module, a graph attention propagation module, a gating fusion module, and a prediction regression module; among which... When the optimal image set is received, the multi-scale spatial feature encoding module and the spectral feature encoding module respectively extract the multi-scale spatial features and spectral features of each image in the optimal image set. The heterogeneous graph construction module is used to map the multi-scale spatial features and the spectral features to nodes and construct a scale-spectral heterogeneous graph. The graph attention propagation module uses the graph attention propagation mechanism to calculate the attention weights between nodes in the scale-spectral heterogeneous graph. The gating fusion module performs weighted fusion of the features of each node based on the attention weights to obtain fused features; Based on the fusion features, the prediction regression module outputs the predicted results of total phosphorus concentration and / or total nitrogen concentration in the water body.
9. A water quality testing model training device, characterized in that, include: A data preprocessing module is used to preprocess remote sensing images acquired by at least two satellites within the same time period; wherein the at least two satellites are satellites with different resolutions. The candidate image acquisition module is used to combine the pre-processed remote sensing images corresponding to the same satellite into bands to obtain multiple candidate images corresponding to each satellite. The initial image set construction module is used to select at least one target image corresponding to each satellite from the candidate images based on the band combination features and preset target variables, and construct an initial image set corresponding to each satellite based on the target images. The optimal image set construction module is used to evaluate the image contribution of the initial image set using a gradient boosting decision tree, and determine the optimal image set corresponding to each satellite based on the image contribution. The water quality detection module is used to train the water quality detection model based on the optimal image set; wherein the water quality detection model is a model based on a multi-scale graph attention and adaptive gating fusion network, and the trained water quality detection model is used to output the water quality detection results of the remote sensing image to be inverted.
10. A water quality testing model training device, characterized in that, The system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the water quality detection model training method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the water quality detection model training method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Satellite image and machine learning water quality monitoring method and system
CN112464746A
River reach water surface width remote sensing monitoring method, electronic equipment and storage medium
CN118968334A