CN111579547A - Water body COD rapid detection method and device - Google Patents

Water body COD rapid detection method and device Download PDF

Info

Publication number
CN111579547A
CN111579547A CN202010306375.6A CN202010306375A CN111579547A CN 111579547 A CN111579547 A CN 111579547A CN 202010306375 A CN202010306375 A CN 202010306375A CN 111579547 A CN111579547 A CN 111579547A
Authority
CN
China
Prior art keywords
cod
water body
preset
detection model
sample
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010306375.6A
Other languages
Chinese (zh)
Inventor
董大明
赵贤德
陈肖
矫雷子
田宏武
李传霞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Research Center of Intelligent Equipment for Agriculture
Original Assignee
Beijing Research Center of Intelligent Equipment for Agriculture
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Research Center of Intelligent Equipment for Agriculture filed Critical Beijing Research Center of Intelligent Equipment for Agriculture
Priority to CN202010306375.6A priority Critical patent/CN111579547A/en
Publication of CN111579547A publication Critical patent/CN111579547A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/62Systems in which the material investigated is excited whereby it emits light or causes a change in wavelength of the incident light
    • G01N21/71Systems in which the material investigated is excited whereby it emits light or causes a change in wavelength of the incident light thermally excited
    • G01N21/718Laser microanalysis, i.e. with formation of sample plasma
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N33/00Investigating or analysing materials by specific methods not covered by groups G01N1/00 - G01N31/00
    • G01N33/18Water
    • G01N33/1806Water biological or chemical oxygen demand (BOD or COD)
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Abstract

The embodiment of the invention provides a method and a device for rapidly detecting COD (chemical oxygen demand) of a water body, wherein the method comprises the following steps: acquiring spectral data of a water sample to be detected, and performing characteristic extraction to obtain characteristic data; inputting the extracted characteristic data into a preset COD detection model to obtain the COD value of the water body sample to be detected; the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label. The method only needs to acquire the spectral data of the water sample to be detected, and has the characteristics of simplicity and easy realization; the COD value is detected through the COD detection model based on the decision tree algorithm, the time consumption is short, the operation is simple and convenient, secondary pollution is avoided, and the requirement of real-time on-site water quality detection can be met.

Description

Water body COD rapid detection method and device
Technical Field
The invention relates to the field of water quality detection, in particular to a rapid detection method and device for COD (chemical oxygen demand) of a water body.
Background
In human daily life, water is an indispensable substance and a source of life. In recent years, people pay more attention to the water quality problem, Chemical Oxygen Demand (COD) is an important index for measuring water quality, has an important role in evaluating organic matter pollution of a water body, is an organic matter pollution parameter which can be rapidly measured in research such as river pollution and the like, measures the amount of reducing substances to be oxidized in a water sample by a Chemical method, and is in direct proportion to the concentration of organic pollutants in the water body.
At present, when COD concentration is detected, an acid potassium permanganate oxidation method, a potassium dichromate oxidation method, a rapid digestion spectrophotometry method, a coulometry method and the like are generally applied. However, these methods all require the use of chemical reagents such as potassium permanganate and potassium dichromate, which are time-consuming, troublesome to operate, and inappropriate treatment, which is liable to cause secondary pollution, and cannot meet the requirement of real-time and real-time detection of water quality.
Disclosure of Invention
In order to solve the above problems, embodiments of the present invention provide a method and an apparatus for rapidly detecting COD in a water body.
In a first aspect, an embodiment of the present invention provides a method for rapidly detecting a COD of a water body, including: acquiring spectral data of a water sample to be detected, and performing characteristic extraction to obtain characteristic data; inputting the extracted characteristic data into a preset COD detection model to obtain the COD value of the water body sample to be detected; the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
Further, the inputting the extracted characteristic data into a preset COD detection model includes: inputting the extracted characteristic data into a plurality of decision tree sub-models of a preset COD detection model; averaging according to the output result of each decision tree sub-model, and outputting the COD value of the water sample to be detected; and each decision tree sub-model is obtained by random sampling training according to the correction set samples.
Further, before the extracted feature data is input into a preset COD detection model, the method further includes: acquiring a plurality of spectrum samples with known COD values, and dividing the spectrum samples into a correction set and a prediction set according to a preset proportion; respectively establishing a COD detection model according to the number of different decision trees; for each COD detection model, performing putting-back sampling on the correction sets respectively to obtain a plurality of sub-correction sets corresponding to the number of the decision trees, and training the decision trees respectively by using the sub-correction sets; and obtaining the detection result of each COD detection model based on the prediction set, selecting the COD detection model which enables the correlation coefficient of the prediction set to be the highest, and determining the number of corresponding decision trees to obtain the preset COD detection model.
Further, after selecting the COD detection model with the highest correlation coefficient of the prediction set and determining the number of the corresponding decision trees to obtain the preset COD detection model, the method further includes: within a preset characteristic number range, respectively obtaining COD detection results based on the prediction set; and selecting the characteristic number which enables the correlation coefficient of the prediction set to be the highest as the characteristic number of the input preset COD detection model.
Further, the acquiring of the spectral data of the water sample to be detected comprises: based on a Laser Induced Breakdown Spectroscopy (LIBS) technology, spectrum data of a water sample to be detected are obtained.
Further, the acquiring of the spectral data of the water sample to be detected comprises: for each sample to be detected, acquiring a preset number of spectrums to obtain a plurality of spectrum data; and averaging the plurality of spectral data to obtain the spectral data of the water sample to be detected.
In a second aspect, an embodiment of the present invention provides a rapid detection device for COD of a water body, including: the characteristic acquisition module is used for acquiring spectral data of a water sample to be detected and extracting characteristics to obtain characteristic data; the water body detection module is used for inputting the extracted characteristic data into a preset COD detection model and acquiring the COD value of the water body sample to be detected; the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor executes the computer program to implement the steps of the rapid detection method for water body COD according to the first aspect of the present invention.
In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the rapid detection method for COD of water body according to the first aspect of the present invention.
The rapid detection method and the rapid detection device for the water body COD, provided by the embodiment of the invention, only need to acquire the spectral data of the water body sample to be detected, have the characteristics of simplicity and easiness in implementation, realize the detection of the COD value through the decision tree algorithm-based COD detection model, are short in time consumption and simple and convenient to operate, do not generate secondary pollution, and can meet the requirement of real-time on-site water quality detection.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart of a rapid detection method for COD in a water body according to an embodiment of the present invention;
FIG. 2 is a flow chart of a rapid detection method for COD in a water body according to another embodiment of the present invention;
FIG. 3 is a schematic diagram of a decision tree determination process of a rapid detection method for COD in a water body according to another embodiment of the present invention;
FIG. 4 is a flow chart of a rapid detection method for COD in a water body according to still another embodiment of the present invention;
FIG. 5 is a comparison graph of the prediction result of the optimal model to the prediction set sample and the actual value of the sample according to the embodiment of the present invention;
FIG. 6 is a structural diagram of a rapid detection device for COD in a water body according to an embodiment of the present invention;
fig. 7 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flow chart of a rapid detection method for water body COD provided by an embodiment of the present invention, and as shown in fig. 1, an embodiment of the present invention provides a rapid detection method for water body COD, including:
101. and acquiring spectral data of the water sample to be detected, and extracting characteristics to obtain characteristic data.
The spectral data of the water body sample can be acquired by utilizing a laser-induced breakdown spectroscopy technology, the abscissa of the spectral data of the water body sample can be wavelength or frequency, and the ordinate is intensity. And extracting characteristic data according to the spectral data, and if a plurality of preset wavelengths are selected, taking the corresponding spectral intensities to form a characteristic vector as input data of the COD detection model.
102. Inputting the extracted characteristic data into a preset COD detection model to obtain the COD value of the water sample to be detected; the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
In machine learning, a decision tree is a prediction model and represents a mapping relationship between object attributes and object values. Each node in the tree represents an object and each divergent path represents a possible attribute value, while each leaf node corresponds to the value of the object represented by the path traversed from the root node to the leaf node. In this embodiment, the COD detection model is constructed based on a decision tree algorithm, where a decision tree has m nodes, and the nodes correspond to the number of features in the feature data. And inputting the extracted characteristic data as a model, taking the determined COD value as a label, and training the constructed COD detection model according to the characteristic data of a large number of water body samples with the COD value labels, thereby obtaining a preset COD detection model. Based on the water body sample to be detected, the extracted characteristic data is input into the preset COD detection model, and then the corresponding COD predicted value can be obtained.
The rapid detection method for the water body COD, provided by the embodiment of the invention, only needs to acquire the spectral data of the water body sample to be detected, has the characteristics of simplicity and easiness in implementation, realizes the detection of the COD value through the COD detection model based on the decision tree algorithm, is short in time consumption and simple and convenient to operate, does not generate secondary pollution, and can meet the requirement of real-time on-site detection of water quality.
Based on the content of the foregoing embodiment, as an optional embodiment, the inputting the extracted feature data into a preset COD detection model includes: inputting the extracted characteristic data into a plurality of decision tree sub-models of a preset COD detection model; averaging according to the output result of each decision tree sub-model, and outputting the COD value of the water sample to be detected; and each decision tree sub-model is obtained by random sampling training according to the correction set samples.
Fig. 2 is a flow chart of a rapid detection method for COD of a water body according to another embodiment of the present invention, as shown in fig. 2, the COD detection model in this embodiment is composed of a plurality of decision tree sub-models, each decision tree sub-model predicts the extracted characteristic data, and finally outputs an average value of all decision tree sub-models as a final output to obtain a COD value of a water body sample to be detected.
The calibration set is a water body sample with a COD value label and is a sample for training. In this embodiment, each decision tree sub-model is obtained by random sampling training according to the calibration set samples, that is, there is sampling training put back, so that different sample disturbances are added to different sub-models, and the problem of weak model generalization capability caused by overfitting can be prevented to a certain extent. The multiple submodels are averaged to determine the final detection result, and meanwhile, the accuracy of the detection result is also ensured.
Based on the content of the foregoing embodiment, as an optional embodiment, before inputting the extracted feature data into a preset COD detection model, the method further includes: acquiring a plurality of spectrum samples with known COD values, and dividing the spectrum samples into a correction set and a prediction set according to a preset proportion; respectively establishing a COD detection model according to the number of different decision trees; for each COD detection model, performing putting-back sampling on the correction sets respectively to obtain a plurality of sub-correction sets corresponding to the number of the decision trees, and training the decision trees respectively by using the sub-correction sets; and obtaining the detection result of each COD detection model based on the prediction set, selecting the COD detection model which enables the correlation coefficient of the prediction set to be the highest, and determining the number of corresponding decision trees to obtain the preset COD detection model.
Firstly, in the process of collecting a sample, the sample can be divided into two parts after being collected, wherein one part is used for measuring the COD value by using a traditional method (the measurement result is accurate, but the measurement is time-consuming and labor-consuming, and secondary pollution is easy to cause), and the other part is reserved for laser-induced breakdown spectroscopy measurement (ultra-fast and pollution-free); dropping a water body sample on a piece of filter paper, and absorbing and unfolding water drops into a circle of wet circular spots by the filter paper; all samples were spectrally collected using laser induced breakdown spectroscopy. The spectrum obtained by the laser-induced breakdown spectroscopy technology is used as a sample, and the COD value obtained by the traditional method is used as a corresponding label.
And (3) using layered sampling to distinguish a correction set and a prediction set according to the ratio of 2:1 of all the averaged spectra, wherein the correction set is used for establishing a spectral regression model of the COD of the water body, and the prediction set is used for verifying the generalization capability of the model.
The number n of decision trees is determined, the redundancy of the spectral model is high due to the fact that the number n of decision trees is too large, a large calculated amount is introduced, and the randomness of the model is not strong enough due to the fact that the number n of decision trees is too small, so that the optimal value is very necessary to find for the value. In addition, the samples of the correction set are already used for modeling, an overfitting phenomenon is easily generated in the modeling process, the samples participating in the modeling process are used to cause the false image with strong model generalization capability, and the overfitting phenomenon is further aggravated, so another part of LIBS spectrum samples which do not participate in the modeling process at all need to be used for verifying the model capability, namely prediction set samples. Therefore, in the optimizing process, the spectrum samples of the prediction set are substituted into the model to select the model with the highest correlation coefficient of the prediction set, and the n value corresponding to the model is the optimal value of n.
Fig. 3 is a schematic diagram of a decision tree determining process of a rapid detection method for water body COD according to another embodiment of the present invention, as shown in fig. 3, after n times of putting back and sampling are performed on all LIBS spectral samples in a correction set, n sub-correction sets are obtained, n decision trees are established by using the n sub-correction set spectral samples, each decision tree has m nodes corresponding to the number of features, and the process of establishing a water body COD regression model is completed through the correction set training. And then, carrying out inspection based on the prediction set, determining a correlation coefficient of an inspection result, and selecting a model corresponding to the n value with the maximum correlation coefficient as a preset COD detection model.
According to the rapid detection method for the water body COD, disclosed by the embodiment of the invention, the COD detection model enabling the correlation coefficient of the prediction set to be the highest is selected, and the number of the corresponding decision trees is determined, so that the nonlinear algorithm after parameter optimization has the advantages of high model accuracy, strong generalization capability, capability of effectively avoiding an overfitting phenomenon and the like, and the method can overcome spectral noise caused by instability factors such as instrument background errors and the like in the spectral measurement process.
Based on the content of the foregoing embodiment, as an optional embodiment, after selecting a COD detection model with the highest correlation coefficient of the prediction set and determining the number of corresponding decision trees to obtain a preset COD detection model, the method further includes: within a preset characteristic number range, respectively obtaining COD detection results based on the prediction set; and selecting the characteristic number which enables the correlation coefficient of the prediction set to be the highest as the characteristic number of the input preset COD detection model.
After n optimal values are determined, the number m of random variables is further optimized, wherein m is the number of features randomly selected from the total features of each sample, when the value is too large, some unnecessary variables such as noise signals in a spectrum are introduced, when the value is too small, useful variables in a spectrum sample are not completely selected, the former is a main reason for overfitting, and the latter is a main reason for underfitting, so that the optimization of the parameter is quite important, the optimization process is consistent with n, namely, the model with the highest correlation coefficient of a prediction set corresponds to the optimal value m.
In the process of establishing the model, the optimal values of n and m are found in the previous step, and the water body COD spectral model established by using the optimal values of the n and m as parameters has the strongest generalization capability, so that the optimal values are used as parameters to establish a regression model. Fig. 4 is a flowchart of a rapid detection method for COD of water body according to another embodiment of the present invention, and specific flow can refer to fig. 4 and the above method embodiments.
In the rapid detection method for the water body COD provided by this embodiment, sample disturbance (corresponding to the number of decision trees) and attribute disturbance (corresponding to the number of features) are introduced into the base learner at the same time, and the decision trees are used as the base learner, so that the learners independent from each other are greatly different as much as possible, and the learners are integrated. Therefore, the method further prevents the model from being weak in generalization ability due to overfitting to a certain extent, and has the advantages of simplicity, easiness in implementation, excellent performance and the like.
Based on the content of the foregoing embodiments, as an alternative embodiment, acquiring spectral data of a water sample to be detected includes: and acquiring the spectral data of the water sample to be detected based on a laser-induced breakdown spectroscopy technology.
Currently, researchers propose to use ultraviolet spectroscopy and near-infrared spectroscopy to measure the COD of the water body, and although the two methods have the advantages of real time and environmental friendliness, the water body transmittance difference is large, so that the measuring range under the same optical path is small, and the method is rarely used for the actual rapid detection of the water quality.
The laser induced breakdown spectroscopy technology is a novel atomic spectrum analysis technology, a beam of high-energy pulse laser is focused on the surface of a sample through a convex lens, so that ground state atoms are excited to a high-energy-level unstable state, and the emission line of a plasma cloud is obtained in the process that the high energy level falls back to the low energy-level state. The technology has the advantages of environmental protection, rapidness, real-time performance, no need of sample pretreatment and the like, can almost measure chemical components in all substances, and has wide application in the quantitative and qualitative analysis of the current materials. In recent years, with the rapid development of software and hardware technologies, the application potential of the software and hardware technologies in liquid substance measurement is gradually explored.
Since LIBS does not require pretreatment, it has an incomparable advantage in terms of rapid measurement, and it would be a great progress if it could measure inorganic ions and organic matter in water at the same time.
A Dawa Series Q-Switched Nd YAG laser system, an HR2000+ spectrometer and a general computer with the model number of Dawa-200 can be used in the specific implementation process. The laser energy is 160mJ, the spectrometer integration time is 2ms, the spectral range is 198-976 nm, and the delay time is 3 mu s.
Based on the content of the foregoing embodiments, as an alternative embodiment, acquiring spectral data of a water sample to be detected includes: for each sample to be detected, acquiring a preset number of spectrums to obtain a plurality of spectrum data; and averaging the plurality of spectral data to obtain the spectral data of the water sample to be detected.
The method comprises the steps of collecting spectra of all samples by using a laser-induced breakdown spectroscopy technology, collecting a preset number of spectra, such as ten spectra, from each sample in order to prevent overlarge spectral difference of the same sample caused by non-uniformity of the surface of filter paper, and averaging to obtain one spectrum for extracting characteristic data, so that measurement errors are effectively reduced.
The technical solution of the present invention is further illustrated by a specific test. Water samples required by the experiment are taken from two rivers, wherein the river 1 is a water sample 10 group, the river 2 is a water sample 6 group, and each group is divided into two parts to obtain 32 water samples. And (3) conveying the 16 groups to an environmental quality detection center, and measuring the COD concentration of the water body of the river 1 to be 42.1000-90.7000 mg/L and the COD concentration of the river 2 to be 188.0000-453.0000 mg/L by using a rapid digestion spectrophotometry. And the other 16 groups are reserved as experimental samples, standing is carried out to extract a clear water sample, then the clear water sample is diluted to different concentration gradients, finally, the number of the river 1 samples is 99 groups, the COD concentration is 7.5179-90.7000mg/L, the river 2 is 60 groups, and the COD concentration is 33.5714mg/L-453.0000 mg/L.
Each sample is taken out and dropped on filter paper, the filter paper is placed on an objective table after being in a semi-dry state, 10 measuring points are randomly taken from each piece of filter paper, each measuring point is hit once through laser pulses to obtain ten spectra, then an average value is obtained to obtain one spectrum, and finally 159 spectra are obtained for two rivers (wherein river 1 obtains 99 analysis spectra, and river 2 obtains 60 analysis spectra).
When the 159 spectra are divided into the correction set and the prediction set, considering the consistency of data distribution, avoiding the phenomenon of model over-fitting or under-fitting caused by extra deviation introduced in the dividing process, randomly drawing 2/3 as the correction set, and taking the rest 1/3 as the prediction set, and manually checking to enable the concentration ranges covered by the correction set and the prediction set to be close.
And (3) after the spectra in the training set are put back to random sampling, optimizing the number of decision trees within the range of 5-500 by using the data of the correction set, and in the process, substituting the prediction set into the model to select an optimal value, wherein the n value corresponding to the model with the highest correlation coefficient of the prediction set being 0.9058 is 290. And optimizing the number m of the random variables in the range of 10-2000, wherein the optimizing process is consistent with n, namely the optimal m value of the model with the highest correlation coefficient 0.9248 in the prediction set is 725.
When the optimal parameter n of the model is determined to be 290 and m is determined to be 725, the model is adopted. The effect of the model is shown in table 1. Wherein R is2RMSE is the root mean square error for the correlation coefficient.
TABLE 1
Figure BDA0002455929140000091
As can be seen from Table 1, the best result of optimizing for n before m is determined is the correlation coefficient 0.9541 in the correction set with a root mean square error of 18.4655mg/L, the correlation coefficient in the prediction set of 0.9058 and a root mean square error of 28.1259 mg/L. When the optimal parameters of m are determined to be 725 and n is determined to be 290, the correlation coefficient of the correction set is 0.9584, the root mean square error is 17.5802, and the correlation coefficient and the root mean square error of the prediction set are 0.9248 and 25.1215 respectively. Therefore, after the optimal parameters of n and m are determined, the generalization capability of the model is slightly improved, and the optimal model can be obtained. The ratio of the prediction to sample actual value pairs for the prediction set samples of the optimal model is shown in fig. 5.
In order to show the superiority of the embodiment of the invention, a Partial Least Squares Regression (PLSR) algorithm is introduced for comparison, fig. 5 is a comparison graph of the prediction result of the optimal model of the embodiment of the invention on the prediction set sample and the actual value of the sample, a black solid line in fig. 5 shows that the prediction value is completely equal to the actual value, a hollow circular scattering point represents the prediction result of the nonlinear regression algorithm on the prediction set, and a black solid square scattering point represents the prediction result of the partial least squares algorithm on the prediction set.
Fig. 6 is a structural diagram of a rapid detection device for COD in water according to an embodiment of the present invention, and as shown in fig. 6, the rapid detection device for COD in water includes: a characteristic acquisition module 601 and a water body detection module 602. The characteristic acquisition module 601 is used for acquiring spectral data of a water sample to be detected and extracting characteristics to obtain characteristic data; the water body detection module 602 is configured to input the extracted characteristic data into a preset COD detection model, and obtain a COD value of the water body sample to be detected; the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
The device embodiment provided in the embodiments of the present invention is for implementing the above method embodiments, and for details of the process and the details, reference is made to the above method embodiments, which are not described herein again.
The rapid detection device for the water body COD provided by the embodiment of the invention only needs to acquire the spectral data of the water body sample to be detected, has the characteristics of simplicity and easiness in implementation, realizes the detection of the COD value through the COD detection model based on the decision tree algorithm, is short in time consumption and simple and convenient to operate, does not generate secondary pollution, and can meet the requirement of real-time on-site detection of water quality.
Fig. 7 is a schematic entity structure diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 7, the electronic device may include: a processor (processor)701, a communication Interface (Communications Interface)702, a memory (memory)703 and a bus 704, wherein the processor 701, the communication Interface 702 and the memory 703 complete communication with each other through the bus 704. The communication interface 702 may be used for information transfer of an electronic device. The processor 701 may invoke logic instructions in the memory 703 to perform a method comprising: acquiring spectral data of a water sample to be detected, and performing characteristic extraction to obtain characteristic data; inputting the extracted characteristic data into a preset COD detection model to obtain the COD value of the water sample to be detected; the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
In addition, the logic instructions in the memory 703 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above-described method embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the transmission method provided in the foregoing embodiments when executed by a processor, and for example, the method includes: acquiring spectral data of a water sample to be detected, and performing characteristic extraction to obtain characteristic data; inputting the extracted characteristic data into a preset COD detection model to obtain the COD value of the water sample to be detected; the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods of the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (9)

1. A rapid detection method for COD in a water body is characterized by comprising the following steps:
acquiring spectral data of a water sample to be detected, and performing characteristic extraction to obtain characteristic data;
inputting the extracted characteristic data into a preset COD detection model to obtain the COD value of the water body sample to be detected;
the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
2. The method for rapidly detecting the COD in the water body according to claim 1, wherein the step of inputting the extracted characteristic data into a preset COD detection model comprises the following steps:
inputting the extracted characteristic data into a plurality of decision tree sub-models of a preset COD detection model;
averaging according to the output result of each decision tree sub-model, and outputting the COD value of the water sample to be detected;
and each decision tree sub-model is obtained by random sampling training according to the correction set samples.
3. The method for rapidly detecting the COD in the water body according to claim 2, wherein before inputting the extracted characteristic data into a preset COD detection model, the method further comprises the following steps:
acquiring a plurality of spectrum samples with known COD values, and dividing the spectrum samples into a correction set and a prediction set according to a preset proportion;
respectively establishing a COD detection model according to the number of different decision trees;
for each COD detection model, performing putting-back sampling on the correction sets respectively to obtain a plurality of sub-correction sets corresponding to the number of the decision trees, and training the decision trees respectively by using the sub-correction sets;
and obtaining the detection result of each COD detection model based on the prediction set, selecting the COD detection model which enables the correlation coefficient of the prediction set to be the highest, and determining the number of corresponding decision trees to obtain the preset COD detection model.
4. The method according to claim 3, wherein the selecting the COD detection model with the highest correlation coefficient of the prediction set and determining the number of the corresponding decision trees to obtain the preset COD detection model further comprises:
within a preset characteristic number range, respectively obtaining detection results of a preset COD detection model based on the prediction set;
and selecting the characteristic number which enables the correlation coefficient of the prediction set to be the highest as the characteristic number of the input preset COD detection model.
5. The method for rapidly detecting the COD in the water body according to claim 1, wherein the step of acquiring the spectral data of the water body sample to be detected comprises the following steps:
and acquiring the spectral data of the water sample to be detected based on a laser-induced breakdown spectroscopy technology.
6. The method for rapidly detecting the COD in the water body according to claim 1, wherein the step of acquiring the spectral data of the water body sample to be detected comprises the following steps:
for each sample to be detected, acquiring a preset number of spectrums to obtain a plurality of spectrum data;
and averaging the plurality of spectral data to obtain the spectral data of the water sample to be detected.
7. The utility model provides a water COD short-term test device which characterized in that includes:
the characteristic acquisition module is used for acquiring spectral data of a water sample to be detected and extracting characteristics to obtain characteristic data;
the water body detection module is used for inputting the extracted characteristic data into a preset COD detection model and acquiring the COD value of the water body sample to be detected;
the preset COD detection model is constructed based on a decision tree algorithm and is obtained after training according to characteristic data corresponding to the water body sample with the COD value label.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the steps of the rapid detection method for COD in a water body according to any one of claims 1 to 6.
9. A non-transitory computer readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the method for rapid detection of COD in a body of water according to any one of claims 1 to 6.
CN202010306375.6A 2020-04-17 2020-04-17 Water body COD rapid detection method and device Pending CN111579547A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010306375.6A CN111579547A (en) 2020-04-17 2020-04-17 Water body COD rapid detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010306375.6A CN111579547A (en) 2020-04-17 2020-04-17 Water body COD rapid detection method and device

Publications (1)

Publication Number Publication Date
CN111579547A true CN111579547A (en) 2020-08-25

Family

ID=72124391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010306375.6A Pending CN111579547A (en) 2020-04-17 2020-04-17 Water body COD rapid detection method and device

Country Status (1)

Country Link
CN (1) CN111579547A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116630812A (en) * 2023-07-21 2023-08-22 四川发展环境科学技术研究院有限公司 Water body feature detection method and system based on visible light image analysis

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103267832A (en) * 2013-05-13 2013-08-28 安徽工程大学 Online water quality monitoring system for surface water
WO2014157753A1 (en) * 2013-03-28 2014-10-02 부산대학교 산학협력단 System and method for providing water quality information capable of diagnosing and predicting state of water quality of water system
CN107132266A (en) * 2017-06-21 2017-09-05 佛山科学技术学院 A kind of Classification of water Qualities method and system based on random forest
CN109459399A (en) * 2018-12-26 2019-03-12 南京波思途智能科技股份有限公司 A kind of spectral water quality COD, turbidity detection method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014157753A1 (en) * 2013-03-28 2014-10-02 부산대학교 산학협력단 System and method for providing water quality information capable of diagnosing and predicting state of water quality of water system
CN103267832A (en) * 2013-05-13 2013-08-28 安徽工程大学 Online water quality monitoring system for surface water
CN107132266A (en) * 2017-06-21 2017-09-05 佛山科学技术学院 A kind of Classification of water Qualities method and system based on random forest
CN109459399A (en) * 2018-12-26 2019-03-12 南京波思途智能科技股份有限公司 A kind of spectral water quality COD, turbidity detection method

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
刘云翔等: "基于改进CART决策树建立水华预警模型", 《中国农村水利水电》 *
叶松等: "基于激光诱导击穿光谱和化学计量学的水体COD实时测量方法", 《光谱学与光谱分析》 *
孙驷阳: "基于多源遥感与机器学习的密云水库水质参数反演研究", 《中国优秀硕士学位论文全文数据库工程科技Ⅰ辑》 *
李玉翠等: "基于机器学习的东湖富营养化研究", 《人民长江》 *
李盛芳等: "随机森林算法的水果糖分近红外光谱测量", 《光谱学与光谱分析》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116630812A (en) * 2023-07-21 2023-08-22 四川发展环境科学技术研究院有限公司 Water body feature detection method and system based on visible light image analysis
CN116630812B (en) * 2023-07-21 2023-09-26 四川发展环境科学技术研究院有限公司 Water body feature detection method and system based on visible light image analysis

Similar Documents

Publication Publication Date Title
CN109709057B (en) Water quality index prediction model construction method and water quality index monitoring method
Hu et al. Novel method of turbidity compensation for chemical oxygen demand measurements by using UV–vis spectrometry
CN106815643B (en) Infrared spectroscopy Model Transfer method based on random forest transfer learning
CN112051256B (en) CNN model-based LIBS (laser induced breakdown spectroscopy) measurement method and system for content of element to be measured
CN109142296A (en) The black smelly quick identification measuring method of urban water-body based on multi-source optical spectrum feature
CN103134767B (en) Method for liquor quality identification through infrared spectrum revision
CN109799195B (en) High-precision quantitative analysis method for laser-induced breakdown spectroscopy
CN103712939B (en) A kind of pollutant levels approximating method based on uv-vis spectra
CN103983595A (en) Water quality turbidity calculating method based on ultraviolet-visible spectroscopy treatment
CN103487411A (en) Method for recognizing steel grade by combining random forest algorithm with laser-induced breakdown spectroscopy
CN105486655A (en) Rapid detection method for organic matters in soil based on infrared spectroscopic intelligent identification model
CN104730042A (en) Method for improving free calibration analysis precision by combining genetic algorithm with laser induced breakdown spectroscopy
CN109520983B (en) DOM-based water quality evaluation method and device
CN111579547A (en) Water body COD rapid detection method and device
CN115236045A (en) Method and device for determining chemical oxygen demand in water by using fluorescence spectrometry and storage medium
Ye et al. Rapid determination of water COD using laser-induced breakdown spectroscopy coupled with partial least-squares and random forest
Li et al. In situ simultaneous quantitative analysis multi-elements of archaeological ceramics via laser-induced breakdown spectroscopy combined with machine learning strategy
Yu et al. Multi-component spectral detection based on neural network in water quality inspection
CN114894725A (en) Water quality multi-parameter spectral data Stacking fusion model and water quality multi-parameter measuring method
CN114460055A (en) Method and device for monitoring COD (chemical oxygen demand) by using clustering-regression-based spectroscopy
Wu et al. Dual-color time-integrated fluorescence cumulant analysis
CN113240006A (en) Method and device for monitoring wastewater discharge, electronic equipment and storage medium
CN108120694A (en) For the multivariate calibration methods and system of Dark sun-cured chemical composition analysis
CN110031407A (en) Chemical oxygen demand of water body spectrum on line detection method and device
CN115728290A (en) Method, system, equipment and storage medium for detecting chromium element in soil

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination