A water quality parameter detection method and system based on image and sensor fusion

By using an image and sensor fusion-based water quality parameter detection method, visual feature parameters are used to inversely evaluate sensor confidence, achieving adaptive adjustment and self-verification. This solves the problem of sensor data detection distortion when interfered with by suspended solids, algae, or bubbles, and improves the stability and accuracy of water quality monitoring.

CN122345708APending Publication Date: 2026-07-07广东省河源生态环境监测站

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
广东省河源生态环境监测站
Filing Date
2026-05-12
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

In existing water quality monitoring devices, sensor data and optical image data are processed independently, which causes the measured values ​​to deviate from the true values ​​when there is interference from suspended matter, algae, or bubbles. Furthermore, there is a lack of a mechanism to dynamically judge the reliability of sensor data based on image quality, resulting in distorted detection results.

Method used

By acquiring optical images and sensor parameters of water samples, visual feature parameters are extracted, confidence weights of sensor parameters are determined, data fusion is performed based on confidence weights, the degree of difference is calculated for self-verification and iterative correction, and the confidence weights are adjusted to output stable detection results.

Benefits of technology

It enables adaptive adjustment of sensor data in complex water quality environments, improves the stability and accuracy of detection results, and is suitable for long-term unattended online monitoring of drinking water sources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122345708A_ABST
    Figure CN122345708A_ABST
Patent Text Reader

Abstract

The application relates to the field of water quality monitoring, in particular to a water quality parameter detection method and system based on image and sensor fusion, which comprises the following steps: in response to a water quality detection instruction, an optical image and sensor parameters of a water sample to be detected are acquired; visual feature parameters are extracted from the optical image, and the confidence weight of the sensor parameters is determined according to the visual feature parameters; the sensor parameters and the visual feature parameters are weighted and fused based on the weight, and a comprehensive detection result is obtained; the difference between the comprehensive detection result and the visual feature parameters is calculated, which is used to measure the deviation degree of the fusion result relative to the visual feature; when the difference is greater than a preset threshold, the confidence weight is adjusted and re-fused; when the difference is not greater than the threshold, the comprehensive detection result is output. The application dynamically evaluates the sensor credibility through the visual feature, and adjusts the fusion weight through the difference degree closed-loop iteration, thereby improving the accuracy of water quality detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of water quality monitoring technology, and in particular to a method and system for detecting water quality parameters based on image and sensor fusion. Background Technology

[0002] Currently, online water quality monitoring devices are typically equipped with both water quality sensors and optical imaging modules. Sensors can quickly acquire quantitative parameters of water quality, while optical images provide intuitive information such as suspended solids and algae. However, in existing technologies, sensor data and image data are mostly processed independently or simply weighted averaged. When suspended solids, algae, or bubbles are present in the water, the sensor probe is easily affected by particulate matter adhesion or bubble interference, causing the measured values ​​to deviate from the true values. Simultaneously, the optical transparency of the water sample decreases, and the image quality also deteriorates accordingly. Existing methods lack a mechanism to dynamically assess the reliability of sensor data based on image quality, often relying primarily on sensor readings, resulting in distorted detection results.

[0003] In real-world monitoring environments, water quality monitoring devices often face severe degradation in optical image quality, such as insufficient nighttime lighting, light attenuation in deep water layers, and shading from light by highly turbid water bodies. In these situations, optical images cannot clearly reflect visual features such as suspended solids and algae in the water, and parameters extracted from the images may be completely distorted. However, assuming that images are always usable fails to consider how to handle situations where image quality falls below a certain level. Some solutions directly abandon image information, relying solely on sensor data, but this loses the auxiliary judgment value that images can provide; other solutions forcibly use low-quality images for detection, leading to unreliable subsequent analysis results, which is also a technical problem that needs to be solved in this field. Summary of the Invention

[0004] To address one or more problems in the prior art, the main objective of this application is to provide a method and system for detecting water quality parameters based on image and sensor fusion.

[0005] To achieve the aforementioned objectives, this application proposes a method for detecting water quality parameters based on image and sensor fusion, the method comprising: In response to a water quality testing command, the system acquires data of the water sample to be tested, which includes the optical image and sensor parameters of the water sample. Based on the water sample data to be tested, visual feature parameters are extracted from the optical image; The confidence weights of the sensor parameters are determined based on the visual feature parameters. Based on the confidence weight, the sensor parameters and the visual feature parameters are fused to obtain a comprehensive detection result; The difference between the comprehensive detection result and the visual feature parameters is calculated, and the difference is used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters; When the difference is greater than a preset difference threshold, the confidence weight is adjusted, and the sensor parameters and visual feature parameters are re-fused. When the difference is not greater than a preset difference threshold, the comprehensive detection result is output.

[0006] This application also provides a water quality parameter detection system based on image and sensor fusion, including: The response acquisition module is used to acquire the water sample data to be tested in response to the water quality testing command. The water sample data includes the optical image and sensor parameters of the water sample to be tested. The extraction module is used to extract visual feature parameters from the optical image based on the water sample data to be tested; The determination module is used to determine the confidence weights of the sensor parameters based on the visual feature parameters; The fusion module is used to fuse the sensor parameters and the visual feature parameters based on the confidence weights to obtain a comprehensive detection result; The calculation and analysis module is used to calculate the difference between the comprehensive detection result and the visual feature parameters, and the difference is used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters; An adjustment module is used to adjust the confidence weight and re-fuse the sensor parameters with the visual feature parameters when the difference is greater than a preset difference threshold. The output module is used to output the comprehensive detection result when the difference is not greater than a preset difference threshold.

[0007] This application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the methods described above.

[0008] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.

[0009] This application presents a water quality parameter detection method and system based on image and sensor fusion, addressing the problem in existing water quality monitoring technologies where sensor data and image information are isolated, making it difficult to dynamically adjust the reliability of sensor data based on image quality. When suspended solids, algae, or bubbles are present in the water, sensors are easily interfered with, but traditional methods still blindly rely on sensor readings, leading to distorted results. This method utilizes visual feature parameters to inversely evaluate sensor confidence, achieving adaptive adjustment of image weights to sensor parameters. Secondly, existing technologies lack a self-verification mechanism for fusion results; if weights are set improperly, erroneous results are directly output without detection. This method introduces an iterative correction loop by calculating the difference degree and comparing it with a threshold, enabling the fusion result to self-verify and adjust. This makes the method stable and accurate in complex and variable water quality environments, particularly suitable for long-term unattended online monitoring of drinking water sources. Attached Figure Description

[0010] Figure 1 This is a schematic flowchart of a water quality parameter detection method based on image and sensor fusion according to an embodiment of this application; Figure 2 This is a schematic flowchart of a water quality parameter detection method based on image and sensor fusion according to an embodiment of this application; Figure 3 This is a schematic block diagram of a water quality parameter detection system based on image and sensor fusion according to an embodiment of this application; Figure 4 This is a schematic block diagram of the structure of a computer device according to an embodiment of this application; Figure 5 This is a schematic diagram illustrating the mapping relationship between interference feature indicators and sensor confidence weights according to an embodiment of this application.

[0011] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0012] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0013] Reference Figure 1 This application provides a method for detecting water quality parameters based on image and sensor fusion, the method comprising: S1. In response to a water quality testing command, acquire the water sample data to be tested, wherein the water sample data includes the optical image and sensor parameters of the water sample to be tested; S2. Based on the water sample data to be tested, extract visual feature parameters from the optical image; S3. Determine the confidence weights of the sensor parameters based on the visual feature parameters; S4. Based on the confidence weight, the sensor parameters and the visual feature parameters are fused to obtain a comprehensive detection result; S5. Calculate the difference between the comprehensive detection result and the visual feature parameters. The difference is used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters. S6. When the difference is greater than the preset difference threshold, adjust the confidence weight and re-fuse the sensor parameters with the visual feature parameters; S7. When the difference is not greater than the preset difference threshold, output the comprehensive detection result.

[0014] As described in steps S1-S3 above, the water sample data in S1 consists of two parts: an optical image of the water sample and sensor parameters measured by a water quality sensor. The optical image is acquired by an optical camera outside the transparent detection chamber, while the sensor parameters come from a detection sensor inside the storage container. Both types of data are acquired simultaneously because they carry different information: sensor parameters quickly reflect conventional water quality indicators such as pH, dissolved oxygen, and turbidity, while the optical image records visual information such as the distribution of suspended solids, the aggregation state of algae, and tiny particles in the water sample. S2 converts the original image into quantifiable numerical features. For example, image segmentation algorithms are used to calculate the area ratio covered by suspended solids, texture analysis is used to obtain algae aggregation density, or edge detection is used to count the number of air bubbles. These visual feature parameters can quantitatively describe the appearance of the water sample and have a potential correlation with the sensor parameters. For example, when there are many suspended solids in the water, the turbidity sensor often displays a higher value; when algae proliferate, the chlorophyll sensor reading usually increases. It is this correlation that allows the visual feature parameters to serve as a reference for evaluating the reliability of the sensor data. In S3, traditional methods often directly accept sensor data while ignoring potential interference from particulate matter and air bubbles in the water. This method takes the opposite approach, using visual feature parameters to infer the reliability of sensor data. Specifically, interference indicators are extracted from visual features. For example, higher suspended matter coverage increases the probability of particulate matter adhering to or obstructing the sensor probe; higher algae density makes chlorophyll sensors prone to response saturation or probe contamination; a greater number of air bubbles may cause transient spikes in dissolved oxygen sensors; and higher image blur indicates turbidity, which reduces the measurement accuracy of optical sensors. These interference indicators are input into a monotonically decreasing weighting function to obtain a confidence weight between 0 and 1. The more severe the interference, the smaller the weight, indicating less reliable sensor data; conversely, when the image is clear and interference is minimal, the weight is close to 1, indicating relatively reliable sensor data. Thus, visual information is no longer merely an auxiliary display but actively participates in the evaluation of sensor data quality.

[0015] As described in steps S4-S7 above, the specific method of S4 fusion is as follows: First, using a preset visual quantization model, the visual feature parameters are converted into visual quantization values ​​with the same dimensions as the sensor parameters. For example, an equivalent turbidity value is estimated based on the suspended matter coverage, or an equivalent chlorophyll concentration is estimated based on the algae density. Then, the confidence weight is used as the fusion coefficient of the sensor parameters, and 1 minus this weight is used as the fusion coefficient of the visual quantization value. The weighted sum of the two is then calculated. The resulting comprehensive detection result retains the quantitative information of the sensor parameters while incorporating the correction of visual features. Moreover, the magnitude of the correction is determined by the sensor confidence assessed by the visual features themselves. When the sensor confidence is high, the result mainly reflects the sensor reading; when the sensor is disturbed, the result automatically biases towards the visual estimate, thus obtaining a relatively stable output under various water quality conditions. S5 introduces a self-verification mechanism. The role of the difference is to measure whether there is an unreasonable inconsistency between the fused result and the original visual features. For example, if sensor parameters are abnormally high due to bubble adhesion, but visual feature parameters show few bubbles in the water, the fusion result (biased towards the sensor) will deviate significantly from the visual feature, resulting in a large discrepancy. Conversely, if they are consistent, the discrepancy will be small. It's important to note that since visual feature parameters are typically multidimensional, this method first standardizes and reduces the dimensionality of these multidimensional features using historical statistical parameters to obtain a scalarized discrepancy, allowing for a comprehensive comparison of features with different physical dimensions. The discrepancy essentially reflects whether the current fusion result can withstand cross-validation with visual information. When the discrepancy exceeds a preset threshold, it indicates a significant contradiction between the fusion result and the visual feature, usually meaning the initial confidence weights were not set appropriately. Therefore, the confidence weights are actively adjusted, typically by reducing the weights of the sensor parameters, and the fusion is repeated. This iterative process can be executed multiple times until the discrepancy decreases to an acceptable range or the maximum number of iterations is reached. Through this closed-loop feedback, the fusion result can self-correct, avoiding erroneous outputs due to initial weight estimation bias. S7 When the difference is not greater than the preset difference threshold, it indicates that the consistency between the current fusion result and the visual features is good, and the comprehensive detection result is directly output as the final water quality parameter.

[0016] As mentioned above, this application addresses the problem in existing water quality monitoring technologies where sensor data and image information are isolated, making it difficult to dynamically adjust the reliability of sensor data based on image quality. When suspended solids, algae, or bubbles are present in the water, sensors are easily interfered with, but traditional methods still blindly rely on sensor readings, leading to distorted results. This method utilizes visual feature parameters to inversely evaluate sensor confidence, achieving adaptive adjustment of image weights to the sensor. Secondly, existing technologies lack a self-verification mechanism for fusion results; if the weights are set improperly, erroneous results are directly output without detection. This method introduces an iterative correction loop by calculating the difference degree and comparing it with a threshold, enabling the fusion results to self-verify and adjust. This makes the method stable and accurate in complex and changing water quality environments, and is particularly suitable for long-term unattended online monitoring of drinking water sources.

[0017] In one embodiment, determining the confidence weight of the sensor parameters based on the visual feature parameters includes: Extract interference feature indicators from the visual feature parameters, wherein the interference feature indicators include at least one of suspended matter coverage, algae aggregation density, number of bubbles, or image blur. The interference feature index is input into a preset weight mapping function to calculate the confidence weight of the sensor parameter. The weight mapping function is a monotonically decreasing function, and the larger the value of the interference feature index, the smaller the confidence weight.

[0018] As described above, the first step is to extract interference feature indicators from the extracted visual feature parameters. These visual feature parameters contain information across multiple dimensions, such as the proportion of suspended matter coverage in the water sample image, the density of algae aggregation, the number of bubbles, and the blurriness of the image itself. Each of these indicators reflects a physical state of the water sample: a higher suspended matter coverage indicates more particulate matter in the water, which easily adheres to the sensor probe or scatters measurement light; a higher algae aggregation density means a large proliferation of algae in the water, which interferes with the normal operation of the chlorophyll sensor and turbidity sensor; a greater number of bubbles can cause transient spikes in the dissolved oxygen sensor, and bubbles also scatter light, affecting optical measurements; image blurriness directly reflects the turbidity of the water sample or the cleanliness of the optical window. Higher blurriness indicates poor light transmittance, making optically based sensor readings unreliable. Therefore, these interference feature indicators are not randomly selected; each has a clear physical correlation with the mechanism of sensor measurement error. The second step involves inputting the extracted interference feature indicators into a preset weighting mapping function to calculate the confidence weights of the sensor parameters. This weighting mapping function is designed as a monotonically decreasing function, meaning that the larger the value of the input interference feature, the smaller the output confidence weight. For example, when the suspended matter coverage is very low, the function outputs a weight close to 1, indicating that the sensor data is highly reliable; as the suspended matter coverage gradually increases, the weight gradually decreases; when the coverage is extremely high, the weight approaches 0, indicating that the sensor data is almost unreliable. The same applies to other interference indicators. If multiple interference indicators exist simultaneously, they can be comprehensively evaluated through weighted averages or by taking the maximum value. The physical basis for this design is very intuitive: the more and more severe the interference in the water body, the greater the impact on the sensor, and the higher the probability that its measurement value deviates from the true value; therefore, its contribution to the fusion result should be reduced. Conversely, when the water is clear, the image is sharp, and there are few bubbles and algae, the sensor's working environment is good, and the readings are more reliable.

[0019] Reference Figure 2 In one embodiment, the step of fusing the sensor parameters and the visual feature parameters based on the confidence weights to obtain a comprehensive detection result includes: S41. Based on the visual feature parameters, generate visual quantization values ​​with the same dimensions as the sensor parameters using a preset visual quantization model; S42. Use the confidence weight as the first fusion weight of the sensor parameters, and subtract the confidence weight from the preset value as the second fusion weight of the visual quantization value, wherein the preset value is 1; S43. Calculate the first product of the sensor parameters and the first fusion weight, and the second product of the visual quantization value and the second fusion weight; S44. Based on the calculation results, the sum of the first product and the second product is taken as the comprehensive detection result.

[0020] As described in the steps above, S41 generates visual quantization values ​​with the same dimensions as the sensor parameters based on the visual feature parameters. The visual feature parameters themselves may be dimensionless proportional values ​​or statistics related to other physical quantities, such as suspended matter coverage as a percentage or algal density as cells per liter. Sensor parameters, on the other hand, have specific physical units and dimensions, such as turbidity expressed in NTUs and dissolved oxygen in milligrams per liter. To numerically fuse visual and sensor information, they must first be on the same metric scale. Therefore, this method pre-establishes a visual quantization model, which, through offline calibration or machine learning training, can map visual feature parameters to estimated values ​​with the same physical meaning as the sensor parameters. For example, by fitting a regression equation between suspended matter coverage and turbidity sensor readings using a large amount of experimental data, given the current suspended matter coverage, the model can output an estimated turbidity value, which has the same units as the turbidity value measured by the sensor. In this way, visual information is no longer isolated auxiliary data, but a value that can be directly compared and combined with sensor parameters. S42 determines two fusion weights. In this fusion, the first fusion weight for the sensor parameters is directly taken as the confidence weight, while the second fusion weight for the visual quantization value is 1 minus the confidence weight. The default value here is 1, ensuring that the sum of the first and second weights is 1. This weight allocation method is very intuitive: if the confidence weight is 0.8, it indicates that the sensor data is highly reliable, and it accounts for 80% of the fusion result, while the visual quantization value accounts for 20%; conversely, if the confidence weight is only 0.2, it indicates that the sensor data is unreliable, and the visual quantization value accounts for 80%, with the fusion result mainly determined by the visual estimation value. A weight sum of 1 also has the advantage that the fusion result always lies between the sensor parameters and the visual quantization value, avoiding outliers outside their ranges, and providing a clear physical meaning. S43 calculates the product of the sensor parameters and the first fusion weight, and the product of the visual quantization value and the second fusion weight, respectively. These two products are actually the weighted contribution components. For example, if the sensor parameter is 5.0 and the confidence weight is 0.7, the first product is 3.5; if the visual quantization value is 4.0 and the second weight is 0.3, the second product is 1.2. S44 adds the two products to obtain the comprehensive detection result. Continuing with the example above, the comprehensive detection result is 4.7. This result is neither the pure sensor reading of 5.0 nor the pure visual estimate of 4.0, but a reasonable value that is a compromise based on the sensor's confidence level. When the sensor confidence level is high, the result is closer to the sensor reading; when the sensor confidence level is low, the result is closer to the visual estimate.

[0021] It is worth noting that during the training process of the visual quantification model, calibration is required before device deployment or during periodic calibration. First, multiple sets of water samples under different water quality conditions are collected. For each set of samples, visual feature parameters obtained from image processing (e.g., suspended solids coverage, algae aggregation density, etc.) and sensor parameters measured by standard water quality testing instruments (e.g., turbidity or chlorophyll concentration) are recorded simultaneously. The visual feature parameters are used as input, and the sensor parameters as output to establish a training dataset. Then, a linear regression method is used to fit the mapping relationship between the two, i.e., solving for a set of coefficients so that the value of the linear combination of visual feature parameters approximates the sensor's measured value as closely as possible. For example, for a single visual feature parameter, the model form is: Sensor estimated value = a × visual feature parameter + b, where a and b are obtained by least squares fitting. For multiple visual feature parameters, multiple linear regression can be used. After fitting, the obtained mapping parameters are stored in the monitoring platform as the visual quantification model used in subsequent detection.

[0022] refer to Figure 5 In one exemplary embodiment, the water quality monitoring platform pre-stores a weighting mapping function. This function takes an interference feature index as input and outputs the confidence weights of the sensor parameters. The interference feature index can be one or more combinations of suspended solids coverage, algae aggregation density, bubble count, or image blurriness. For ease of explanation, this embodiment uses suspended solids coverage as the interference feature index. The horizontal axis represents the interference feature index, with values ​​ranging from 0% to 100%. A larger value indicates more suspended solids in the water and more severe interference. The vertical axis represents the confidence weights of the sensor parameters, ranging from 0 to 1. The monotonically decreasing curve in the figure defines the mapping relationship between the interference feature index and the confidence weights. After the monitoring platform extracts the suspended solids coverage from the optical image, it inputs this value into the weighting mapping function. For example, if the current water sample is clear and the suspended matter coverage is only 10%, the mapping curve gives a confidence weight of about 0.95, indicating that the sensor parameters are very reliable; if the water sample is moderately turbid and the suspended matter coverage reaches 50%, the weight drops to 0.5, and the sensor and visual information each account for half in the fusion; if the water sample is in a state of high algae bloom or high turbidity and the suspended matter coverage reaches 90%, the weight is only 0.1, and the fusion result will mainly rely on the visual quantification value.

[0023] It should be noted that the negative impact of interference features such as suspended matter on the sensor confidence weight in this embodiment is based on the fundamental difference in the interference mechanisms between sensors and vision systems. Sensor probes typically use optical or electrochemical principles for measurement. When the amount of suspended matter, algae, or bubbles in the water increases, these particles easily adhere to the probe surface or scatter the measured light while suspended in the water, causing sensor readings to drift, response lag, or even saturation. In other words, the sensor's operating state is interfered with, and the reliability of its output value decreases accordingly. Therefore, the larger the interference feature, the lower the sensor's confidence weight should be. In contrast, vision systems acquire optical images of water samples. Suspended matter, algae, and other substances appear as visual features such as particles, patches, or textures in the images. The more severe the interference, the more obvious and easier these visual features become to extract. In other words, the vision system is not rendered ineffective by water turbidity; on the contrary, turbid water provides richer information for visual feature extraction. Therefore, even when the interference feature is large, the visual quantification value still has high reference value and should occupy a higher proportion in the fusion result. Based on this difference in mechanism, this application designs a monotonically decreasing mapping relationship between interference feature indicators and sensor confidence weights, thereby realizing adaptive adjustment of image to sensor weights. In one embodiment, after the step of extracting visual feature parameters from the optical image, the method further includes: Calculate the image quality evaluation parameters of the optical image, wherein the image quality evaluation parameters include at least one of signal-to-noise ratio, contrast, sharpness, or brightness; The image quality evaluation parameters are compared with a preset image quality threshold. When the image quality evaluation parameter is lower than the image quality threshold, it is determined that the current state is optically untrustworthy. Based on the judgment result, the historical visual feature parameters saved in the most recent optically reliable state are called and replaced with the currently extracted visual feature parameters; The confidence weights of the sensor parameters are determined based on the historical visual feature parameters, and the sensor parameters and the historical visual feature parameters are fused based on the confidence weights to obtain a comprehensive detection result.

[0024] As mentioned above, the first step is to calculate the image quality evaluation parameters of the optical image. These parameters are objective quantifications of the image's inherent quality, including signal-to-noise ratio (SNR), contrast, sharpness, and brightness. SNR reflects the ratio of image signal to noise; a low SNR indicates severe noise interference. Contrast describes the difference between bright and dark areas in the image; low contrast leads to blurred details. Sharpness measures the sharpness of image edges; poor sharpness means a blurry image. Brightness determines the overall brightness level of the image; low brightness indicates insufficient illumination. These parameters can be calculated using conventional image processing algorithms without manual intervention. The purpose of calculating these parameters is to determine whether the current image can provide reliable visual features. The second step is to compare the calculated image quality evaluation parameters with preset image quality thresholds. These thresholds are pre-calibrated based on the actual performance of the monitoring device and typical application scenarios. For example, for SNR, a minimum acceptable value can be set; below this value, the image is considered to have excessive noise, making feature extraction unreliable. For brightness, a lower limit can be set; below this limit, the light is too dim to distinguish details in the water sample. Because the actual monitoring environment is complex and variable, nighttime, deep water layers, and high-turbidity water bodies can all lead to a significant decline in image quality. Therefore, an objective evaluation standard is needed to determine whether the current image is usable. The third step involves determining that the image is optically unreliable when the image quality evaluation parameter falls below a threshold. This determination means that the currently captured optical image can no longer provide reliable visual feature parameters. Forcibly using these features for subsequent confidence weight calculations and fusion would introduce errors and mislead the entire detection result. The fourth step involves retrieving the historical visual feature parameters saved during the most recent optically reliable state. During each detection, if the image quality evaluation parameter is not lower than the threshold (i.e., optically reliable), the currently extracted visual feature parameters are saved to a cache queue. When an optically unreliable state is encountered, the most recently saved reliable visual feature parameters are retrieved from the cache. This historical feature reflects the appearance information of the water sample when the water quality was good and the image was clear. Although it cannot completely represent the current water sample, it is at least a reliable reference compared to the completely distorted image features of the current image. The fifth step involves replacing the currently extracted visual feature parameters with historical visual feature parameters, and then continuing with confidence weight determination and fusion. In other words, subsequent steps no longer use erroneous features extracted from the current image, but instead use historically reliable features. This ensures that even under extremely poor optical conditions, the system can still execute the complete fusion process, rather than being forced to discard visual information or use erroneous data.

[0025] This embodiment addresses the challenge of maintaining the effective operation of the image-sensor fusion detection framework when optical images become completely unusable due to insufficient lighting or water turbidity. Traditional solutions either discard image information outright, reverting to pure sensor detection and losing the advantage of image assistance, or force the use of low-quality images, leading to distortion of visual feature parameters and resulting in biased fusion results. This method utilizes visual features from historically reliable conditions as a substitute. By assuming that the basic water quality characteristics of the water body will not change drastically in a short period, historical visual features still have some reference value. When optical conditions recover, the system switches back to real-time images. This allows the monitoring device to maintain the integrity of fusion detection even in harsh optical environments, improving the system's adaptability and long-term operational reliability, making it particularly suitable for real-world scenarios such as day-night cycles and seasonal high turbidity.

[0026] In one embodiment, the step of calculating the difference between the comprehensive detection result and the visual feature parameters includes: Determine whether the visual feature parameters meet the preset distortion conditions; When the visual feature parameters meet the distortion condition, a reference visual feature parameter independent of the current visual feature parameter is obtained, and the difference between the comprehensive detection result and the reference visual feature parameter is calculated as the difference. When the distortion condition is not met, the difference between the comprehensive detection result and the currently extracted visual feature parameters is calculated as the difference.

[0027] As mentioned above, the first step is to determine whether the currently extracted visual feature parameters meet the preset distortion conditions. Distortion conditions are a set of pre-defined rules used to identify whether the visual feature parameters themselves have lost their reference value. Common distortion scenarios include: algae aggregation density exceeding the upper limit that the algorithm can accurately identify, i.e., the visual features have reached saturation; suspended matter coverage is abnormally high, exceeding the normal water quality range; or the visual feature parameters show minimal change in multiple consecutive tests, suggesting stagnation or failure. These distortion conditions share the common characteristic that although the visual feature parameters can be calculated, their values ​​no longer accurately reflect the actual state of particulate matter or algae in the water sample. If they are still used as the benchmark for difference comparison under these circumstances, the comparison results will be meaningless. The second step, when the visual feature parameters meet the distortion conditions, is to obtain a reference visual feature parameter independent of the current visual feature parameter. This reference benchmark cannot rely on the currently distorted features and must come from other sources. This method offers multiple acquisition methods, such as calling historical visual feature parameters saved from the most recent normal state, or using completely different feature extraction algorithms on the same optical image to obtain a second set of features, or obtaining visual feature parameters from adjacent sampling depth water samples as spatial references. These reference features share the common characteristic that they are independent of the currently distorted features and are not affected by the same distortion factors. The third step replaces the current feature with this independent reference visual feature parameter and calculates the difference between the comprehensive detection result and the reference baseline. Since the reference baseline is reliable, the calculated difference can accurately reflect whether the fusion result is reasonable. For example, when algae density is saturated, the current visual feature displays a maximum value of 100, but the historical reference feature displays a normal value of 20. If the fusion result outputs a high pollutant concentration, then the difference between it and the historical feature 20 will be significant, thus correctly triggering subsequent iterative adjustments. The fourth step, when the visual feature parameter does not meet the distortion condition, indicates that the current feature itself is reliable, and the difference between the comprehensive detection result and the current visual feature parameter is calculated directly using the original method.

[0028] This embodiment addresses the self-circulating dependency problem in difference comparison. In the basic fusion framework, difference is used to compare the comprehensive detection results with visual feature parameters to determine the reliability of the fusion result. However, when the visual feature parameters themselves are distorted, this comparison becomes using errors to verify errors. For example, in high-density areas of algal blooms, visual feature parameters may be saturated. Regardless of whether the fusion result is correct or incorrect, the difference between the result and the saturation value may be very small, leading to the direct output of erroneous fusion results. This method determines the reliability of visual feature parameters before calculating the difference, and proactively switches to an independent reference benchmark when the result is unreliable. This makes the difference comparison a truly independent verification step, rather than a simple self-verification. It provides a pre-emptive avoidance method for problems frequently encountered in long-term monitoring, such as sensor saturation and feature value out-of-bounds errors, thereby improving the self-verification capability of the fusion results.

[0029] In one embodiment, after the step of calculating the difference between the comprehensive detection result and the visual feature parameters, and before the step of adjusting the confidence weight when the difference is greater than a preset difference threshold, the method further includes: Obtain the time-series data of the sensor parameters from the most recent consecutive preset number of detections; Calculate the short-term rate of change of the sensor parameters based on the time series data; When the short-term rate of change is greater than the preset rate of change threshold, it is determined that the water quality is in a state of rapid change. Based on the judgment result, under the condition of rapid water quality change, the adjustment of the confidence weight is skipped, and the current comprehensive detection result is directly output.

[0030] As described above, the first step, after calculating the difference and before adjusting the confidence weights, involves acquiring time-series data of the sensor parameters from the most recent preset number of consecutive measurements. This data records the trajectory of sensor parameter changes in the most recent measurements. For example, the turbidity or dissolved oxygen values ​​from the last five measurements can be saved, forming a time-ordered sequence. This sequence reflects the trend of sensor parameter evolution over time. The second step involves calculating the short-term rate of change of the sensor parameters based on the acquired time-series data. There are several ways to calculate the short-term rate of change, such as taking the difference between the latest and previous measurement values, or fitting the slope of the most recent data using the least squares method. The magnitude of the rate of change directly reflects the drastic change in the sensor parameters. A small rate of change indicates relatively stable water quality; a large rate of change indicates a significant increase or decrease in sensor parameters within a short period. The third step involves comparing the calculated short-term rate of change with a preset rate of change threshold. When the short-term rate of change exceeds the threshold, it is determined that the water quality is currently in a state of rapid change. The setting of this threshold needs to be combined with the specific water quality parameters and monitoring scenario. For example, dissolved oxygen in normal water bodies typically changes by no more than 1 mg / L per hour. A sudden jump of 2 mg / L within a short period likely indicates the passage of a pollution plume or drastic mixing of the water. It's important to note that rapid changes in sensor parameters could be caused by a real water quality event or a sensor malfunction; however, this step does not differentiate between them, only identifying the change. In the fourth step, after determining a rapid change in water quality, the step of adjusting the confidence weights is skipped, and the current comprehensive detection result is directly output without further iterative correction.

[0031] It's worth noting that skipping weight adjustment in this state is beneficial because in normal, stable water quality scenarios, large differences usually indicate an unreasonable confidence weight setting. In such cases, reducing sensor weights and re-fusion is helpful. However, the situation is entirely different when water quality is changing rapidly. During cross-layer sampling or when a pollution cloud front passes through, sensors often respond quickly to water quality changes, while visual feature parameters, due to sample delivery delays or image feature updates, temporarily remain in their previous state. At this point, sensor parameters already reflect the new water quality, while visual feature parameters still reflect the old, no longer existing water quality. Following conventional logic, reducing sensor weights simply because of large differences would suppress correct sensor responses, causing the fusion result to favor outdated visual features, leading to delayed or even erroneous detection results. Therefore, this method proactively pauses iterative adjustments by identifying rapidly changing water quality states, allowing the current comprehensive detection result to be output directly, thus ensuring a rapid response to real water quality changes.

[0032] For example, in actual reservoir or lake monitoring, monitoring devices often encounter a very common but easily overlooked situation: localized instantaneous disturbances in the water body. For instance, when a group of fish swims near the sensor probe, their tails stir the bottom sediment, causing a sudden spike in turbidity sensor readings; a patch of aquatic vegetation swaying in the water, briefly obscuring the sensor probe, can also cause abnormal jumps in measurements; occasionally, small boats passing near the monitoring point can also cause instantaneous fluctuations in sensor parameters due to the disturbance caused by the boat's hull. These disturbances share the common characteristic of being very short-lived, typically only a few seconds to a dozen seconds, after which the water quality quickly returns to its normal state, and the actual water quality of the entire body does not undergo continuous deterioration or change. However, based on the above embodiment, when sensor parameters change rapidly, the system will determine it as a rapid change in water quality and skip the adjustment of confidence weights, directly outputting the current fusion result. This design is reasonable for real, continuous water quality changes, but it will produce false alarms for the aforementioned instantaneous disturbance scenarios. Because the sensor parameters do indeed change rapidly, the system interprets this as a real change in water quality, outputting an abnormally high turbidity or ammonia nitrogen value, even though the water body is not actually polluted. If such false alarms occur frequently, monitoring personnel will gradually lose trust in the alarm information, and genuine water pollution events may be overlooked.

[0033] This embodiment proposes a solution to address this real-world problem. The approach involves adding a brief time window to verify the persistence of the change after a rapid change in water quality is detected and before the weight adjustment is officially skipped. Specifically, when sensor parameters experience a rapid jump, the system does not immediately recognize this as a genuine water quality change. Instead, it waits for a preset disturbance time window, such as 10 seconds. At the end of this window, the system rereads the current sensor parameters and calculates the magnitude of the change compared to the value at the time of the jump. If the sensor value has essentially returned to its original level, and the magnitude of the change is less than the stabilization threshold, it indicates that the jump was merely a momentary disturbance and not a genuine, continuous deterioration of water quality. In this case, the system cancels the skip-weight adjustment operation and adjusts the confidence weights and re-integrates them according to the normal procedure, avoiding the output of false abnormal results. Conversely, if the sensor value remains at the high level after the jump after the waiting window ends, it indicates that a sustained and rapid change in water quality has indeed occurred. Only then will the system maintain the decision to skip the weight adjustment and directly output the current result, ensuring a rapid response to genuine pollution events.

[0034] Specifically, after the step of determining that the water quality is currently in a state of rapid change, and before the step of skipping the adjustment of the confidence weight: Invoke a preset disturbance time window and wait until the disturbance time window ends; At the end of the disturbance time window, the current sensor parameters are reacquired; Calculate the magnitude of change between the reacquired sensor parameters and the sensor parameters at the time the rapid water quality change was triggered; When the change amplitude is less than the preset stabilization threshold, the current water quality change is determined to be an instantaneous disturbance, and the operation of skipping the adjustment of the confidence weight is canceled, and the adjustment of the confidence weight and re-fusion are continued; When the change magnitude exceeds the stabilization threshold, the determination to adjust the confidence weight is skipped, and the current comprehensive detection result is directly output.

[0035] As described above, the first step involves determining that the water quality is in a state of rapid change but before officially skipping the weight adjustment. A preset disturbance time window is invoked, and a waiting period is executed until this window ends. The disturbance time window is a pre-set duration parameter, such as 5 seconds, 10 seconds, or 15 seconds, designed to provide a recovery period for potential transient disturbances. This waiting is necessary because rapid jumps in sensor parameters can stem from two different causes: one is a genuine, continuous change in water quality, such as the passage of a pollution cloud or vertical mixing of water bodies, in which case the sensor value will remain at the new level; the other is a brief, transient disturbance, such as a fish swimming near the sensor probe stirring up local sediment, or a piece of aquatic vegetation drifting by and obscuring the probe, in which case the sensor value will quickly return to its original normal level. Without this waiting window, the system cannot distinguish between these two situations and may misjudge transient disturbances as genuine changes. The second step involves re-acquiring the current sensor parameters at the end of the disturbance time window. This step checks whether, after a period of waiting, the sensor value remains at the level after the jump or has recovered to its original state. The third step involves comparing the reacquired sensor values ​​with the sensor parameters at the time the rapid change was triggered to determine the sustainability of the change. The reacquired sensor parameters are then compared to the values ​​at the time the rapid water quality change was triggered. It's crucial to define two points: the value at the trigger point (the initial value detected when the rapid change was detected) and the value at the end of the window (the value read after a waiting period). The difference between these two values ​​represents the magnitude of the change. For example, if the turbidity jumped from 5 NTU to 15 NTU at the trigger and then dropped back to 6 NTU after the window, the magnitude is 9 NTU, indicating a brief jump and near-complete recovery. Conversely, if the turbidity remains at 14 NTU after the window, the magnitude is only 1 NTU, suggesting a sustained jump. The fourth step compares this magnitude with a preset stabilization threshold. This threshold is a boundary value used to determine whether recovery has occurred. If the magnitude is less than the stabilization threshold, it means the sensor value has essentially returned to its original level after the window, and the rapid change was merely a momentary disturbance, not a genuine and continuous deterioration of water quality. In this situation, the current water quality change is determined to be a transient disturbance, and the process of skipping the adjustment of confidence weights is canceled. Instead, the original process continues, i.e., adjusting the confidence weights and re-fusing the data. The logic behind this is that since it is a brief disturbance and the sensor values ​​have recovered, the previous decision to reduce the sensor weights due to the large differences is still reasonable and should be executed normally. In the fifth step, if the change magnitude is greater than or equal to the stabilization threshold, it indicates that the sensor values ​​remain at the level after the jump after the window ends. This means that the water quality has indeed undergone a continuous and rapid change, rather than a brief disturbance.At this point, the decision to skip adjusting the confidence weights is maintained, and the current comprehensive detection result is directly output without further iterative correction. This ensures a rapid response to real water quality events.

[0036] In one specific implementation, the step of inputting the interference feature index into a preset weight mapping function to calculate the confidence weight of the sensor parameters further includes: Obtain the current sampling depth of the sampling mechanism; A depth correction coefficient is determined based on the current sampling depth, wherein the depth correction coefficient is negatively correlated with the current sampling depth, and the greater the sampling depth, the greater the depth correction coefficient. The initial confidence weights output by the weight mapping function are multiplied by the depth correction coefficient to obtain the corrected confidence weights.

[0037] As described above, in the first step, the sampling mechanism, driven by a lifting motor, can reach different water depths for sampling. A depth sensor measures the depth of the sampling tube below the water surface in real time, such as 2 meters, 5 meters, or 15 meters. This depth information reflects the water layer from which the current water sample originates. The physicochemical properties of water bodies at different depths often differ significantly. For example, surface water has ample sunlight and abundant algae, while deeper water has weak light, more suspended solids, and lower dissolved oxygen. In the second step, the depth correction coefficient is negatively correlated with the sampling depth; that is, the greater the sampling depth, the larger the correction coefficient. The physical basis for this design is that in natural water bodies, deeper water naturally has a higher concentration of suspended solids and lower dissolved oxygen. This is a normal hydrological stratification phenomenon, not evidence of sensor interference. Taking a reservoir as an example, in summer, the turbidity of deep water below the thermocline often increases due to the resuspension of bottom sediment. Simultaneously, due to the lack of photosynthesis and the decomposition of organic matter consuming oxygen, the dissolved oxygen concentration is naturally low. From a purely visual perspective, deep water samples show a high suspended matter coverage. According to the previous weighting mapping function, this high suspended matter index would lower the confidence weight of sensor parameters, leading to the assumption that sensor data is unreliable. However, in reality, the low dissolved oxygen value measured by the dissolved oxygen sensor in deep water reflects the true water quality condition and should not have its weight reduced simply because of high suspended matter levels. The depth correction coefficient compensates for this normal difference caused by depth. The specific correction function can be linear, such as 1 plus 0.03 multiplied by the depth in meters, or it can be a piecewise function, such as 1 for depths under 5 meters, 1.2 for depths between 5 and 10 meters, and 1.5 for depths over 10 meters. Regardless of the form, the core principle is that the greater the depth, the larger the correction coefficient, thereby increasing the confidence of sensor parameters during deep sampling. The third step involves calculating the initial confidence weight based on the interference index in the visual feature parameters, reflecting the degree of interference to the sensor as judged from an image perspective. Multiplying this weight by a depth correction factor greater than 1 will increase the weight value accordingly, but it's important to limit the result to no more than 1, as the confidence weight has a maximum of 1. This way, during deep sampling, even if visual features indicate a high concentration of suspended matter, the weight of the sensor parameters won't be excessively suppressed, and the sensor readings will still occupy a reasonable proportion in the fusion result, thus accurately reflecting the low oxygen or high turbidity state at depth. During shallow sampling, the depth correction factor is close to or equal to 1, with little change before and after correction, and the original weighting logic remains effective.

[0038] This embodiment addresses the problem of inconsistent physical meanings of visual features across different water layers. In the basic fusion framework, the determination of confidence weights relies entirely on the absolute values ​​of visual feature parameters, implicitly assuming that high suspended matter and high algae levels indicate sensor unreliability. This assumption holds true for surface water, as high suspended matter levels often indicate anomalies caused by exogenous pollution or algal blooms. However, in deep water, high suspended matter may be a normal hydrological feature, rather than sensor interference. Applying the same weighting rules indiscriminately to all depths would incorrectly reduce sensor weights during deep sampling, leading to the fusion result being dominated by visual estimates and masking real water quality issues such as low dissolved oxygen. This method introduces a depth correction coefficient to dynamically adjust the confidence weights based on the sampling depth, allowing the same visual feature value to correspond to different levels of sensor confidence at different depths. This depth-adaptive weight correction mechanism enables the fusion method to correctly distinguish between normal hydrological stratification and anomalous sensor interference, improving detection accuracy in stratified water bodies, and is particularly suitable for long-term monitoring of water bodies with significant vertical structures, such as reservoirs and lakes.

[0039] Reference Figure 3 This application also provides a water quality parameter detection system based on image and sensor fusion, comprising: The response acquisition module 1 is used to acquire the water sample data to be tested in response to the water quality testing command. The water sample data to be tested includes the optical image and sensor parameters of the water sample to be tested. Extraction module 2 is used to extract visual feature parameters from the optical image based on the water sample data to be tested; The determination module 3 is used to determine the confidence weight of the sensor parameters based on the visual feature parameters; The fusion module 4 is used to fuse the sensor parameters and the visual feature parameters based on the confidence weight to obtain a comprehensive detection result; The calculation and analysis module 5 is used to calculate the difference between the comprehensive detection result and the visual feature parameters. The difference is used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters. The adjustment module 6 is used to adjust the confidence weight and re-fuse the sensor parameters with the visual feature parameters when the difference is greater than a preset difference threshold. Output module 7 is used to output the comprehensive detection result when the difference is not greater than a preset difference threshold.

[0040] As described above, it is understood that each component of the water quality parameter detection system based on image and sensor fusion proposed in this application can realize the function of any of the water quality parameter detection methods based on image and sensor fusion as described above, and the specific structure will not be repeated.

[0041] Reference Figure 4 This application also provides a computer device, which may be a server, and its internal structure may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores monitoring data and other data. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a water quality parameter detection method based on image and sensor fusion.

[0042] The processor described above executes the water quality parameter detection method based on image and sensor fusion, comprising: in response to a water quality detection command, acquiring water sample data to be tested, the water sample data including an optical image and sensor parameters of the water sample; extracting visual feature parameters from the optical image based on the water sample data; determining a confidence weight of the sensor parameters based on the visual feature parameters; fusing the sensor parameters and the visual feature parameters based on the confidence weight to obtain a comprehensive detection result; calculating the difference between the comprehensive detection result and the visual feature parameters, the difference being used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters; when the difference is greater than a preset difference threshold, adjusting the confidence weight and re-fusing the sensor parameters and the visual feature parameters; and outputting the comprehensive detection result when the difference is not greater than the preset difference threshold.

[0043] One embodiment of this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a water quality parameter detection method based on image and sensor fusion, comprising the steps of: in response to a water quality detection command, acquiring water sample data to be tested, the water sample data including an optical image and sensor parameters of the water sample; extracting visual feature parameters from the optical image based on the water sample data; determining a confidence weight of the sensor parameters based on the visual feature parameters; fusing the sensor parameters and the visual feature parameters based on the confidence weight to obtain a comprehensive detection result; calculating the difference between the comprehensive detection result and the visual feature parameters, the difference being used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters; when the difference is greater than a preset difference threshold, adjusting the confidence weight and re-fusing the sensor parameters and the visual feature parameters; and when the difference is not greater than the preset difference threshold, outputting the comprehensive detection result.

[0044] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in this application and in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0045] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.

[0046] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A method for detecting water quality parameters based on image and sensor fusion, characterized in that, The method includes: In response to a water quality testing command, the system acquires data of the water sample to be tested, which includes the optical image and sensor parameters of the water sample. Based on the water sample data to be tested, visual feature parameters are extracted from the optical image; The confidence weights of the sensor parameters are determined based on the visual feature parameters. Based on the confidence weight, the sensor parameters and the visual feature parameters are fused to obtain a comprehensive detection result; The difference between the comprehensive detection result and the visual feature parameters is calculated, and the difference is used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters; When the difference is greater than a preset difference threshold, the confidence weight is adjusted, and the sensor parameters and visual feature parameters are re-fused. When the difference is not greater than a preset difference threshold, the comprehensive detection result is output.

2. The water quality parameter detection method based on image and sensor fusion according to claim 1, characterized in that, The step of determining the confidence weight of the sensor parameters based on the visual feature parameters includes: Extract interference feature indicators from the visual feature parameters, wherein the interference feature indicators include at least one of suspended matter coverage, algae aggregation density, number of bubbles, or image blur. The interference feature index is input into a preset weight mapping function to calculate the confidence weight of the sensor parameter. The weight mapping function is a monotonically decreasing function, and the larger the value of the interference feature index, the smaller the confidence weight.

3. The water quality parameter detection method based on image and sensor fusion according to claim 1, characterized in that, The step of fusing the sensor parameters and the visual feature parameters based on the confidence weight to obtain a comprehensive detection result includes: Based on the visual feature parameters, a visual quantization value with the same dimensions as the sensor parameters is generated through a preset visual quantization model. The confidence weight is used as the first fusion weight of the sensor parameters, and the preset value minus the confidence weight is used as the second fusion weight of the visual quantization value, where the preset value is 1; Calculate the first product of the sensor parameters and the first fusion weight, and the second product of the visual quantization value and the second fusion weight; Based on the calculation results, the sum of the first product and the second product is taken as the comprehensive detection result.

4. The water quality parameter detection method based on image and sensor fusion according to claim 1, characterized in that, After the step of extracting visual feature parameters from the optical image, the method further includes: Calculate the image quality evaluation parameters of the optical image, wherein the image quality evaluation parameters include at least one of signal-to-noise ratio, contrast, sharpness, or brightness; The image quality evaluation parameters are compared with a preset image quality threshold. When the image quality evaluation parameter is lower than the image quality threshold, it is determined that the current state is optically untrustworthy. Based on the judgment result, the historical visual feature parameters saved in the most recent optically reliable state are called and replaced with the currently extracted visual feature parameters; The confidence weights of the sensor parameters are determined based on the historical visual feature parameters, and the sensor parameters and the historical visual feature parameters are fused based on the confidence weights to obtain a comprehensive detection result.

5. The water quality parameter detection method based on image and sensor fusion according to claim 1, characterized in that, The step of calculating the difference between the comprehensive detection result and the visual feature parameters includes: Determine whether the visual feature parameters meet the preset distortion conditions; When the visual feature parameters meet the distortion condition, a reference visual feature parameter independent of the current visual feature parameter is obtained, and the difference between the comprehensive detection result and the reference visual feature parameter is calculated as the difference. When the distortion condition is not met, the difference between the comprehensive detection result and the currently extracted visual feature parameters is calculated as the difference.

6. The water quality parameter detection method based on image and sensor fusion according to claim 1, characterized in that, After the step of calculating the difference between the comprehensive detection result and the visual feature parameters, and before the step of adjusting the confidence weight when the difference is greater than a preset difference threshold, the method further includes: Obtain the time-series data of the sensor parameters from the most recent consecutive preset number of detections; Calculate the short-term rate of change of the sensor parameters based on the time series data; When the short-term rate of change is greater than the preset rate of change threshold, it is determined that the water quality is in a state of rapid change. Based on the judgment result, under the condition of rapid water quality change, the adjustment of the confidence weight is skipped, and the current comprehensive detection result is directly output.

7. The water quality parameter detection method based on image and sensor fusion according to claim 6, characterized in that, After the step of determining that the water quality is currently in a state of rapid change, and before the step of skipping the adjustment of the confidence weight, the method further includes: Invoke a preset disturbance time window and wait until the disturbance time window ends; At the end of the disturbance time window, the current sensor parameters are reacquired; Calculate the magnitude of change between the reacquired sensor parameters and the sensor parameters at the time the rapid water quality change was triggered; When the change amplitude is less than the preset stabilization threshold, the current water quality change is determined to be an instantaneous disturbance, and the operation of skipping the adjustment of the confidence weight is canceled, and the adjustment of the confidence weight and re-fusion are continued; When the change magnitude exceeds the stabilization threshold, the determination to adjust the confidence weight is skipped, and the current comprehensive detection result is directly output.

8. A water quality parameter detection system based on image and sensor fusion, characterized in that, include: The response acquisition module is used to acquire the water sample data to be tested in response to the water quality testing command. The water sample data includes the optical image and sensor parameters of the water sample to be tested. The extraction module is used to extract visual feature parameters from the optical image based on the water sample data to be tested; The determination module is used to determine the confidence weights of the sensor parameters based on the visual feature parameters; The fusion module is used to fuse the sensor parameters and the visual feature parameters based on the confidence weights to obtain a comprehensive detection result; The calculation and analysis module is used to calculate the difference between the comprehensive detection result and the visual feature parameters, and the difference is used to analyze the degree of deviation of the comprehensive detection result relative to the visual feature parameters; An adjustment module is used to adjust the confidence weight and re-fuse the sensor parameters with the visual feature parameters when the difference is greater than a preset difference threshold. The output module is used to output the comprehensive detection result when the difference is not greater than a preset difference threshold.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.