Abnormal water quality monitoring method, device, computer equipment and medium
Through the combination of full-spectrum data and water source label environmental data, the abnormal score of water bodies is calculated using the trained water quality analysis model, which solves the problem of low accuracy in existing water quality monitoring and achieves high-precision monitoring of water quality.
Patent Information
- Application Number
- CN202411404947.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-10-10
AI Technical Summary
The existing water quality monitoring technology has problems with low accuracy, including the inability to comprehensively detect various pollutants in the water, interference from environmental factors, and the prone to false alarms and missed reports in abnormal detection.
By obtaining the full spectrum data of the water body to be monitored, combining the water source label and environmental data, using the water quality analysis model of the ultraviolet spectrum and visible spectrum trained separately, the abnormal probability and statistical indicators are calculated to finally determine the abnormal score of the water body.
The comprehensive detection of various pollutants in the water has been achieved, the accuracy and reliability of the detection results have been improved, false alarms and missed reports have been reduced, and the accuracy of water quality monitoring has been improved.
Smart Images

Figure CN118914098B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water quality monitoring, and in particular to a method, device, computer equipment and medium for monitoring abnormal water quality. Background Art
[0002] At present, water quality monitoring technology is mainly divided into traditional chemical analysis methods and modern spectral analysis methods. Traditional chemical analysis methods include titration, spectrophotometry, gas chromatography and high performance liquid chromatography. These methods usually require the collection of water samples and analysis in the laboratory. They have high accuracy and sensitivity, but they have problems such as complex operation, long time consumption and poor real-time performance. Modern spectral analysis methods include ultraviolet-visible spectroscopy, infrared spectroscopy, fluorescence spectroscopy and laser induced breakdown spectroscopy (LIBS). These methods can quickly obtain water quality information by measuring the spectral characteristics of water samples, and realize online monitoring and real-time analysis. Common equipment includes fiber optic spectrometers, portable spectrometers and fixed monitoring stations. These devices use light sources to illuminate water samples, detect reflection or transmission spectra, and analyze the types and concentrations of pollutants in the water.
[0003] However, modern spectral analysis methods have the following disadvantages, which make water quality monitoring accuracy low:
[0004] 1. Existing spectral analysis methods usually only cover limited spectral bands and cannot comprehensively detect multiple pollutants in water.
[0005] 2. The analysis model of single spectral data has limited accuracy and is easily affected by environmental factors, resulting in insufficient accuracy and reliability of the test results.
[0006] 3. Existing technologies for anomaly detection mostly rely on simple threshold judgments, which are prone to false positives and false negatives. Summary of the invention
[0007] In view of this, an embodiment of the present invention provides a method for monitoring abnormal water quality to solve the technical problem of low accuracy of water quality monitoring in the prior art. The method comprises:
[0008] Obtaining full spectrum data of the water body to be monitored, wherein the full spectrum data includes ultraviolet spectrum and visible spectrum;
[0009] Obtaining water source labels and environmental data of the water body to be monitored;
[0010] Input the water source label, the environmental data and the ultraviolet spectrum into a first water quality analysis model to obtain the abnormal probability of the ultraviolet spectrum data; input the water source label, the environmental data and the visible spectrum into a second water quality analysis model to obtain the abnormal probability of the visible spectrum data, wherein the first water quality analysis model is obtained by training the model with historical ultraviolet spectrum data, historical water source labels and historical environmental data, and the second water quality analysis model is obtained by training the model with historical visible spectrum data, historical water source labels and historical environmental data;
[0011] Calculating a first statistical index of the ultraviolet spectrum; calculating a second statistical index of the visible spectrum;
[0012] The abnormality score of the water body to be monitored is determined according to the abnormality probability of the ultraviolet spectrum data, the abnormality probability of the visible spectrum data, the first statistical index and the second statistical index, and the size of the abnormality score is proportional to the degree of water quality abnormality.
[0013] The embodiment of the present invention also provides a water quality abnormality monitoring device to solve the technical problem of low accuracy of water quality monitoring in the prior art. The device includes:
[0014] A spectral data acquisition module, used to obtain full spectral data of the water body to be monitored, wherein the full spectral data includes ultraviolet spectrum and visible spectrum;
[0015] A relevant data acquisition module, used to acquire the water source label and environmental data of the water body to be monitored;
[0016] an abnormality probability determination module, for inputting the water source label, the environmental data and the ultraviolet spectrum into a first water quality analysis model to obtain an abnormality probability of the ultraviolet spectrum data; and inputting the water source label, the environmental data and the visible spectrum into a second water quality analysis model to obtain an abnormality probability of the visible spectrum data, wherein the first water quality analysis model is obtained by training the model with historical ultraviolet spectrum data, historical water source labels and historical environmental data, and the second water quality analysis model is obtained by training the model with historical visible spectrum data, historical water source labels and historical environmental data;
[0017] A statistical index calculation module, used to calculate a first statistical index of the ultraviolet spectrum; and calculate a second statistical index of the visible spectrum;
[0018] The water quality monitoring module is used to determine the abnormality score of the water body to be monitored according to the abnormality probability of the ultraviolet spectrum data, the abnormality probability of the visible spectrum data, the first statistical indicator and the second statistical indicator, and the size of the abnormality score is proportional to the degree of water quality abnormality.
[0019] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any of the above-mentioned methods for monitoring abnormal water quality is implemented to solve the technical problem of low accuracy of water quality monitoring in the prior art.
[0020] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program for executing any of the above-mentioned abnormal water quality monitoring methods to solve the technical problem of low accuracy of water quality monitoring in the prior art.
[0021] Compared with the prior art, the beneficial effects that can be achieved by at least one of the above-mentioned technical solutions adopted in the embodiments of this specification include at least: proposing full spectrum data of the water body to be monitored, so that various pollutants in the water can be comprehensively detected; proposing to combine the ultraviolet spectrum and the visible spectrum with the water source label and the environmental data through a model, so as to determine the abnormal probability of the ultraviolet spectrum data and the abnormal probability of the visible spectrum data, so that the abnormal probability of the ultraviolet spectrum data and the abnormal probability of the visible spectrum data can be determined respectively through a water quality analysis model by combining multiple data, which is conducive to improving the accuracy, is not easily affected by environmental factors, and is conducive to improving the accuracy and reliability of the detection results. Finally, according to the abnormal probability of the ultraviolet spectrum data, the abnormal probability of the visible spectrum data, the first statistical indicator and the second statistical indicator, the abnormal score of the water body to be monitored is determined, and the size of the abnormal score is proportional to the degree of water quality abnormality, so as to realize the comprehensive analysis of the statistical indicators and the machine learning model to determine the abnormal score of the water quality, which is conducive to avoiding false alarms and missed alarms, and further conducive to improving the accuracy of water quality monitoring. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 is a flow chart of a method for monitoring abnormal water quality provided by an embodiment of the present invention;
[0024] Figure 2 is a structural block diagram of a computer device provided by an embodiment of the present invention;
[0025] Figure 3 It is a structural block diagram of a water quality abnormality monitoring device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0027] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0028] In an embodiment of the present invention, a method for monitoring abnormal water quality is provided. Figure 1 As shown, the method includes:
[0029] Step S101: obtaining full spectrum data of a water body to be monitored, wherein the full spectrum data includes an ultraviolet spectrum and a visible spectrum;
[0030] Step S102: Acquire the water source label and environmental data of the water body to be monitored;
[0031] Step S103: input the water source label, the environmental data and the ultraviolet spectrum into a first water quality analysis model to obtain an abnormal probability of ultraviolet spectrum data (i.e., the abnormal probability indicates the possibility that the ultraviolet spectrum data will be judged as abnormal (i.e., there is pollution) under the water source label and the environmental data); input the water source label, the environmental data and the visible spectrum into a second water quality analysis model to obtain an abnormal probability of visible spectrum data (i.e., the abnormal probability indicates the possibility that the visible spectrum data will be judged as abnormal (i.e., there is pollution) under the water source label and the environmental data), wherein the first water quality analysis model is obtained by training the model with historical ultraviolet spectrum data, historical water source labels and historical environmental data, and the second water quality analysis model is obtained by training the model with historical visible spectrum data, historical water source labels and historical environmental data;
[0032] Step S104: calculating a first statistical index of the ultraviolet spectrum; calculating a second statistical index of the visible spectrum;
[0033] Step S105: Determine the abnormality score of the water body to be monitored according to the abnormality probability of the ultraviolet spectrum data, the abnormality probability of the visible spectrum data, the first statistical index and the second statistical index, wherein the magnitude of the abnormality score is proportional to the degree of water quality abnormality.
[0034] Depend on Figure 1 As can be seen from the process shown, in the embodiment of the present invention, full spectrum data of the water body to be monitored is proposed, so that various pollutants in the water can be comprehensively detected; it is proposed to combine the ultraviolet spectrum and the visible spectrum with the water source label and the environmental data through a model to determine the abnormal probability of the ultraviolet spectrum data and the abnormal probability of the visible spectrum data, so that the abnormal probability of the ultraviolet spectrum data and the abnormal probability of the visible spectrum data are determined respectively through a water quality analysis model in combination with various data, which is conducive to improving the accuracy, is not easily affected by environmental factors, and is conducive to improving the accuracy and reliability of the detection results. Finally, according to the abnormal probability of the ultraviolet spectrum data, the abnormal probability of the visible spectrum data, the first statistical indicator and the second statistical indicator, the abnormal score of the water body to be monitored is determined, and the size of the abnormal score is proportional to the degree of water quality abnormality, which realizes the comprehensive analysis of the statistical indicators and the machine learning model to determine the abnormal score of the water quality, which is conducive to avoiding false alarms and missed alarms, and further conducive to improving the accuracy of water quality monitoring.
[0035] In the specific implementation, in the process of obtaining the full spectrum data of the water body to be monitored, a full spectrum water quality monitoring device can be used to obtain the full spectrum data of the water body to be monitored in real time. The monitoring device needs to cover the ultraviolet light band (200nm-400nm) to the visible light band (400nm-800nm) to ensure extensive monitoring of pollutants in the water.
[0036] In specific implementation, the above environmental data may be data such as temperature, air pressure, pH value, etc.
[0037] In the specific implementation, in order to improve the accuracy of water quality monitoring results, it is proposed to train water quality analysis models for UV spectrum and visible spectrum respectively, and build a refined water quality analysis model.
[0038] Construct two Bayesian network models;
[0039] Historical ultraviolet spectrum data, historical water source labels and historical environmental data are used as the first input data, and historical visible spectrum data, historical water source labels and historical environmental data are used as the second input data. The first input data is used to train a Bayesian network model to obtain the first water quality analysis model; the second input data is used to train another Bayesian network model to obtain the second water quality analysis model. During the training process of the first water quality analysis model and the second water quality analysis model, the first input data and the second input data are respectively used as observation nodes, and corresponding hidden variable nodes are set to represent potential pollution sources and pollutant concentrations. The maximum expectation algorithm is used to optimize the parameters of the two Bayesian network models respectively, thereby ensuring the accuracy and robustness of the models.
[0040] In the specific implementation, in order to avoid false positives and false negatives, a comprehensive analysis combining statistical indicators and machine learning models is proposed to comprehensively determine the abnormal score of the water body, for example,
[0041] Determining a first abnormality score according to the abnormality probability of the ultraviolet spectrum data, the first statistical indicator and the abnormality threshold;
[0042] Determining a second abnormality score according to the abnormal probability of the visible spectrum data, the second statistical indicator and the abnormal threshold, wherein the first statistical indicator and the second statistical indicator both include a mean and a standard deviation;
[0043] The abnormality score of the water body to be monitored is determined according to the first abnormality score and the second abnormality score.
[0044] In a specific implementation, determining a first abnormality score according to the abnormal probability of the ultraviolet spectrum data, the first statistical indicator and the first abnormal threshold value includes:
[0045] For each data point in the ultraviolet spectrum data, calculating the difference between the ultraviolet spectrum value of the data point and the mean value of the ultraviolet spectrum;
[0046] Calculate the ratio of the difference to the standard deviation of the UV spectrum;
[0047] If the ratio is greater than the first anomaly threshold, the ratio is determined as a first anomaly score for the data point.
[0048] Similarly, determining a second abnormality score according to the abnormal probability of the visible spectrum data, the second statistical indicator and the second abnormal threshold includes:
[0049] For each data point in the visible spectrum data, calculating the difference between the visible spectrum value of the data point and the mean value of the visible spectrum;
[0050] Calculate the ratio of this difference to the standard deviation of the visible spectrum;
[0051] If the ratio is greater than the second anomaly threshold, the ratio is determined as a second anomaly score for the data point.
[0052] In a specific implementation, it is proposed to adopt a weighted average method to determine the abnormal score of the water body to be monitored according to the first abnormal score and the second abnormal score, for example,
[0053] Setting a first weight for the ultraviolet spectrum data and a second weight for the visible spectrum data;
[0054] Multiplying the first anomaly score of each data point in the ultraviolet spectrum data by the first weight to obtain a first product corresponding to each data point;
[0055] Multiplying the second anomaly score of each data point in the visible spectrum data by the second weight to obtain a second product corresponding to each data point;
[0056] Adding the first product corresponding to all data points in the ultraviolet spectrum data and the second product corresponding to all data points in the visible spectrum data to obtain a first sum;
[0057] Adding the first weights corresponding to all data points in the ultraviolet spectrum data and the second weights corresponding to all data points in the ultraviolet spectrum data to obtain a second sum;
[0058] The ratio of the first sum to the second sum is determined as the abnormal score of the water body to be monitored.
[0059] In specific implementation, the process of implementing the above-mentioned water quality abnormality monitoring method may include the following steps:
[0060] Find pure water with COD=0;
[0061] Find COD=V-class water,
[0062] Based on two water quality measurements of two spectral curves, the average values of the two spectral curves in ultraviolet and visible spectrum values are calculated, and the spectral data of pure water and inferior Class V water are used to establish a baseline for spectral analysis. For example, the average value of the ultraviolet spectrum value and the average value of the visible spectrum value of the pure water spectrum are used as the baselines of the lowest pollution (no pollution) of the ultraviolet spectrum and the visible spectrum, respectively, while the average value of the ultraviolet spectrum value and the average value of the visible spectrum value of the inferior Class V water spectrum provide references for high pollution levels (baselines of the highest pollution (no pollution)). Based on the spectral average values corresponding to the two baselines, the thresholds for spectral anomaly detection (for example, the above-mentioned first abnormal threshold value and the second abnormal threshold value) are set. For example, the above-mentioned first abnormal threshold value and the second abnormal threshold value can be set as a certain ratio between the spectral average values corresponding to the two baselines, respectively, to identify abnormal water quality between these two extreme cases.
[0063] Step 1: Data Acquisition
[0064] Use a full-spectrum water quality monitoring device to obtain real-time spectral data of the water body. The monitoring device must cover the ultraviolet to visible light band (200 nm - 800 nm) to ensure extensive monitoring of pollutants in the water.
[0065] Acquire spectral data of water quality in real time, collect water source tags and environmental data, and clean up any abnormal or incomplete data points, such as noise or missing values in the spectral data. Standardize the data to eliminate inconsistent measurements and ensure that the data is compared on the same scale. Convert all data to a unified format, such as CSV or JSON, and ensure that each data point includes spectral data, water source tags, and environmental data. Construct multi-dimensional feature vectors, where each vector contains features extracted from spectral data, water source tags, and environmental data. Store the integrated data in a database system, such as a SQL or NoSQL database, where each record is a structured data entity for further query and analysis.
[0066] Step 2: Model training
[0067] The full spectrum data is divided into two parts: ultraviolet spectrum (200 nm - 400 nm) and visible spectrum (400 nm - 800 nm), and two Bayesian network models are constructed: one for the ultraviolet spectrum and the other for the visible spectrum.
[0068] When using the Bayesian network for training, the input data is used as the observation node, and the corresponding hidden variable nodes are set to represent the potential pollution sources and pollutant concentrations. During the training process, the maximum expectation (EM) algorithm is used to optimize the model parameters and generate a water quality analysis model.
[0069] Step 3: Abnormal data identification
[0070] Statistical indicators and Bayesian networks are used to determine abnormal data in the full spectrum band and the ultraviolet spectrum band. Statistical indicators (such as mean and standard deviation) of the ultraviolet spectrum and the visible spectrum are calculated, and a comprehensive determination is made based on the abnormal probability output by the Bayesian network model.
[0071] The specific steps are as follows:
[0072] (1) Calculate the statistical indicators of the UV spectrum and visible spectrum respectively.
[0073] (2) Apply the model to predict the probability of abnormality: Use the trained Bayesian network model to analyze the current spectral data and obtain the abnormal probability of ultraviolet spectral data and the abnormal probability of visible spectral data respectively. The abnormal probability indicates the possibility of the spectral data being judged as abnormal under the current environment and water source label.
[0074] (3) Comprehensive judgment of abnormality: Ultraviolet spectrum abnormality judgment: If the spectrum value deviates from its mean value by more than the set abnormal threshold, it is marked as abnormal. At the same time, if the ultraviolet abnormal probability predicted by the model exceeds the set threshold, it is also considered abnormal. Visible spectrum abnormality judgment is similar to ultraviolet spectrum abnormality judgment. It is judged based on the deviation of visible spectrum data from its mean value and the abnormal probability predicted by the model.
[0075] For example, for each data point in the ultraviolet spectrum data, the difference between the ultraviolet spectrum value of the data point and the mean of the ultraviolet spectrum is calculated; then the ratio of the difference to the standard deviation of the ultraviolet spectrum is calculated; if the ratio is greater than the first abnormal threshold, the ratio is determined as the first abnormal score of the data point, and then the first abnormal score of each data point in the ultraviolet spectrum data can be obtained. The calculation process of the second abnormal score of each data point in the visible spectrum data is similar to the calculation process of the first abnormal score of each data point in the ultraviolet spectrum data, which will not be repeated here.
[0076] (4) Calculate the final water anomaly score: Use the weighted average method to assign different weights (i.e., the first weight and the second weight mentioned above) to the UV and visible spectra according to their importance or reliability, and calculate the weighted average anomaly score. If the monitoring target is mainly organic pollution, the UV spectrum may be given a higher weight. If the focus is on inorganic pollution such as metal ions, the weight of the visible spectrum data may be increased.
[0077] The above-mentioned water quality abnormality monitoring method has the following beneficial technical effects:
[0078] 1. Through the full-spectrum water quality monitoring device, it is possible to obtain spectral data of a wide range of bands in real time, covering ultraviolet to visible light, to ensure comprehensive monitoring of multiple pollutants. The structured processing of data integration makes the monitoring results more scientific and comparable.
[0079] 2. The water quality analysis method based on the Bayesian network model improves the prediction accuracy and sensitivity of the model by finely processing the ultraviolet and visible spectrum data. The maximum expectation algorithm is used to optimize the model parameters, which enhances the robustness and adaptability of the model. Combining statistical indicators and the anomaly judgment rules of the Bayesian network, abnormal water quality data can be more accurately identified, reducing false positives and false negatives. The comprehensive judgment method ensures that water quality anomalies can be reliably detected under various environmental conditions.
[0080] 3. Set up an automatic alarm mechanism, set mild, medium and severe multi-level alarm thresholds, the system continuously monitors water quality data, calculates the abnormal score in real time, and compares it with the set threshold. When the monitored abnormal score exceeds a certain threshold, the system will automatically trigger the corresponding level of alarm according to the preset response level, and notify relevant personnel in time, which improves the response speed and processing efficiency, and helps prevent and control water pollution incidents. The combination of these innovations and technical effects provides strong technical support for environmental protection and water resources management.
[0081] In this embodiment, a computer device is provided, such as Figure 2 As shown, it includes a memory 201, a processor 202, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any of the above-mentioned water quality abnormality monitoring methods is implemented.
[0082] Specifically, the computer device may be a computer terminal, a server or a similar computing device.
[0083] In this embodiment, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program for executing any of the above-mentioned water quality abnormality monitoring methods.
[0084] Specifically, computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0085] Based on the same inventive concept, an abnormal water quality monitoring device is also provided in the embodiments of the present invention, as described in the following embodiments. Since the principle of solving the problem by the abnormal water quality monitoring device is similar to that of the abnormal water quality monitoring method, the implementation of the abnormal water quality monitoring device can refer to the implementation of the abnormal water quality monitoring method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0086] Figure 3 is a structural block diagram of a water quality abnormality monitoring device according to an embodiment of the present invention, such as Figure 3 As shown, the device comprises:
[0087] The spectrum data acquisition module 301 is used to obtain the full spectrum data of the water body to be monitored, wherein the full spectrum data includes ultraviolet spectrum and visible spectrum;
[0088] A related data acquisition module 302 is used to acquire the water source label and environmental data of the water body to be monitored;
[0089] The abnormal probability determination module 303 is used to input the water source label, the environmental data and the ultraviolet spectrum into a first water quality analysis model to obtain the abnormal probability of the ultraviolet spectrum data; input the water source label, the environmental data and the visible spectrum into a second water quality analysis model to obtain the abnormal probability of the visible spectrum data, wherein the first water quality analysis model is obtained by training the model with historical ultraviolet spectrum data, historical water source labels and historical environmental data, and the second water quality analysis model is obtained by training the model with historical visible spectrum data, historical water source labels and historical environmental data;
[0090] A statistical index calculation module 304 is used to calculate a first statistical index of the ultraviolet spectrum; and calculate a second statistical index of the visible spectrum;
[0091] The water quality monitoring module 305 is used to determine the abnormality score of the water body to be monitored according to the abnormality probability of the ultraviolet spectrum data, the abnormality probability of the visible spectrum data, the first statistical indicator and the second statistical indicator, and the size of the abnormality score is proportional to the degree of water quality abnormality.
[0092] In one embodiment, the water quality monitoring module is used to determine a first abnormality score based on the abnormality probability of the ultraviolet spectrum data, the first statistical indicator and the abnormality threshold; determine a second abnormality score based on the abnormality probability of the visible spectrum data, the second statistical indicator and the abnormality threshold, wherein the first statistical indicator and the second statistical indicator both include a mean and a standard deviation; and determine the abnormality score of the water body to be monitored based on the first abnormality score and the second abnormality score.
[0093] In one embodiment, the water quality monitoring module is used to set a first weight for the ultraviolet spectrum data and a second weight for the visible spectrum data; multiply the first anomaly score of each data point in the ultraviolet spectrum data by the first weight to obtain a first product corresponding to each data point; multiply the second anomaly score of each data point in the visible spectrum data by the second weight to obtain a second product corresponding to each data point; add the first products corresponding to all data points in the ultraviolet spectrum data and the second products corresponding to all data points in the visible spectrum data to obtain a first sum; add the first weight corresponding to all data points in the ultraviolet spectrum data and the second weight corresponding to all data points in the ultraviolet spectrum data to obtain a second sum; and determine the ratio of the first sum to the second sum as the anomaly score of the water body to be monitored.
[0094] The embodiment of the present invention achieves the following technical effects: full spectrum data of the water body to be monitored is proposed, so that various pollutants in the water can be comprehensively detected; it is proposed to combine the ultraviolet spectrum and the visible spectrum with the water source label and the environmental data through a model to determine the abnormal probability of the ultraviolet spectrum data and the abnormal probability of the visible spectrum data, so that the abnormal probability of the ultraviolet spectrum data and the abnormal probability of the visible spectrum data are determined respectively through a water quality analysis model in combination with multiple data, which is conducive to improving the accuracy and is not easily affected by environmental factors, and is conducive to improving the accuracy and reliability of the detection results. Finally, according to the abnormal probability of the ultraviolet spectrum data, the abnormal probability of the visible spectrum data, the first statistical indicator and the second statistical indicator, the abnormal score of the water body to be monitored is determined, and the size of the abnormal score is proportional to the degree of water quality abnormality, which realizes the comprehensive analysis of the statistical indicators and the machine learning model to determine the abnormal score of the water quality, which is conducive to avoiding false alarms and missed alarms, and further conducive to improving the accuracy of water quality monitoring.
[0095] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for monitoring abnormal water quality, characterized in that: include: Obtaining full spectrum data of the water body to be monitored, wherein the full spectrum data includes ultraviolet spectrum and visible spectrum; Obtaining water source labels and environmental data of the water body to be monitored; Input the water source label, the environmental data and the ultraviolet spectrum into a first water quality analysis model to obtain an abnormal probability of the ultraviolet spectrum data; input the water source label, the environmental data and the visible spectrum into a second water quality analysis model to obtain an abnormal probability of the visible spectrum data, wherein the first water quality analysis model is obtained by training the model with historical ultraviolet spectrum data, historical water source labels and historical environmental data, and the second water quality analysis model is obtained by training the model with historical visible spectrum data, historical water source labels and historical environmental data, and the abnormal probability indicates the possibility of the spectrum data being judged as abnormal under the current environmental data and the water source label; Calculating a first statistical index of the ultraviolet spectrum; calculating a second statistical index of the visible spectrum; Determine the abnormality score of the water body to be monitored according to the abnormality probability of the ultraviolet spectrum data, the abnormality probability of the visible spectrum data, the first statistical index and the second statistical index, wherein the magnitude of the abnormality score is proportional to the degree of abnormality of the water quality; Determining the abnormal score of the water body to be monitored according to the abnormal probability of the ultraviolet spectrum data, the abnormal probability of the visible spectrum data, the first statistical indicator, and the second statistical indicator, includes: Determining a first abnormality score according to the abnormality probability of the ultraviolet spectrum data, the first statistical indicator and a first abnormality threshold; Determining a second abnormality score according to the abnormal probability of the visible spectrum data, the second statistical indicator, and the second abnormal threshold, wherein the first statistical indicator and the second statistical indicator both include a mean and a standard deviation; Determining the abnormality score of the water body to be monitored according to the first abnormality score and the second abnormality score; Determining a first abnormality score according to the abnormality probability of the ultraviolet spectrum data, the first statistical indicator and the first abnormality threshold includes: For each data point in the ultraviolet spectrum data, calculating the difference between the ultraviolet spectrum value of the data point and the mean value of the ultraviolet spectrum; Calculate the ratio of the difference to the standard deviation of the UV spectrum; If the ratio is greater than the first anomaly threshold, determining the ratio as a first anomaly score for the data point; Determining the abnormality score of the water body to be monitored according to the first abnormality score and the second abnormality score includes: Setting a first weight for the ultraviolet spectrum data and a second weight for the visible spectrum data; Multiplying the first anomaly score of each data point in the ultraviolet spectrum data by the first weight to obtain a first product corresponding to each data point; Multiplying the second anomaly score of each data point in the visible spectrum data by the second weight to obtain a second product corresponding to each data point; Adding the first product corresponding to all data points in the ultraviolet spectrum data and the second product corresponding to all data points in the visible spectrum data to obtain a first sum; Adding the first weights corresponding to all data points in the ultraviolet spectrum data and the second weights corresponding to all data points in the ultraviolet spectrum data to obtain a second sum; The ratio of the first sum to the second sum is determined as the abnormal score of the water body to be monitored.
2. The method for monitoring abnormal water quality according to claim 1, characterized in that: The method further comprises: Construct two Bayesian network models; Historical ultraviolet spectrum data, historical water source labels and historical environmental data are used as the first input data, and historical visible spectrum data, historical water source labels and historical environmental data are used as the second input data. The first input data is used to train a Bayesian network model to obtain the first water quality analysis model; the second input data is used to train another Bayesian network model to obtain the second water quality analysis model. During the training process of the first water quality analysis model and the second water quality analysis model, the first input data and the second input data are respectively used as observation nodes, and corresponding hidden variable nodes are set to represent potential pollution sources and pollutant concentrations. The maximum expectation algorithm is used to optimize the parameters of the two Bayesian network models respectively.
3. A water quality abnormality monitoring device, characterized in that: include: A spectral data acquisition module, used to obtain full spectral data of the water body to be monitored, wherein the full spectral data includes ultraviolet spectrum and visible spectrum; A relevant data acquisition module, used to acquire the water source label and environmental data of the water body to be monitored; an abnormality probability determination module, for inputting the water source label, the environmental data and the ultraviolet spectrum into a first water quality analysis model to obtain an abnormality probability of the ultraviolet spectrum data; and inputting the water source label, the environmental data and the visible spectrum into a second water quality analysis model to obtain an abnormality probability of the visible spectrum data, wherein the first water quality analysis model is obtained by training a model with historical ultraviolet spectrum data, historical water source labels and historical environmental data, and the second water quality analysis model is obtained by training a model with historical visible spectrum data, historical water source labels and historical environmental data, and the abnormality probability indicates the possibility of the spectrum data being determined to be abnormal under the current environmental data and the water source label; A statistical index calculation module, used to calculate a first statistical index of the ultraviolet spectrum; and calculate a second statistical index of the visible spectrum; A water quality monitoring module, used to determine an abnormality score of the water body to be monitored according to the abnormality probability of the ultraviolet spectrum data, the abnormality probability of the visible spectrum data, the first statistical index and the second statistical index, wherein the magnitude of the abnormality score is proportional to the degree of water quality abnormality; The water quality monitoring module is used to determine a first abnormality score according to the abnormality probability of the ultraviolet spectrum data, the first statistical indicator and the first abnormality threshold; determine a second abnormality score according to the abnormality probability of the visible spectrum data, the second statistical indicator and the second abnormality threshold, wherein the first statistical indicator and the second statistical indicator both include a mean and a standard deviation; determine the abnormality score of the water body to be monitored according to the first abnormality score and the second abnormality score; The water quality monitoring module is used to calculate, for each data point in the ultraviolet spectrum data, a difference between the ultraviolet spectrum value of the data point and the mean of the ultraviolet spectrum; calculate a ratio of the difference to the standard deviation of the ultraviolet spectrum; if the ratio is greater than the first abnormal threshold, determine the ratio as a first abnormal score of the data point; The water quality monitoring module is used to set a first weight for the ultraviolet spectrum data and a second weight for the visible spectrum data; multiply the first anomaly score of each data point in the ultraviolet spectrum data by the first weight to obtain a first product corresponding to each data point; multiply the second anomaly score of each data point in the visible spectrum data by the second weight to obtain a second product corresponding to each data point; add the first products corresponding to all data points in the ultraviolet spectrum data and the second products corresponding to all data points in the visible spectrum data to obtain a first sum; add the first weights corresponding to all data points in the ultraviolet spectrum data and the second weights corresponding to all data points in the ultraviolet spectrum data to obtain a second sum; and determine the ratio of the first sum to the second sum as the anomaly score of the water body to be monitored.
4. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the abnormal water quality monitoring method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the abnormal water quality monitoring method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Full-spectrum water quality data analysis method
CN114441463A
Abnormality detection method, device and equipment for time series data and storage medium
CN115858606A