CN113049500A - Water quality detection model training and water quality detection method, electronic equipment and storage medium - Google Patents
Water quality detection model training and water quality detection method, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113049500A CN113049500A CN202110296084.8A CN202110296084A CN113049500A CN 113049500 A CN113049500 A CN 113049500A CN 202110296084 A CN202110296084 A CN 202110296084A CN 113049500 A CN113049500 A CN 113049500A
- Authority
- CN
- China
- Prior art keywords
- sample point
- water quality
- water body
- water
- spectral data
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
- G01N21/27—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands using photo-electric detection ; circuits for computing concentration
- G01N21/274—Calibration, base line adjustment, drift correction
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/47—Scattering, i.e. diffuse reflection
- G01N21/4738—Diffuse reflection, e.g. also for testing fluids, fibrous materials
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Pathology (AREA)
- Immunology (AREA)
- Biochemistry (AREA)
- Analytical Chemistry (AREA)
- Chemical & Material Sciences (AREA)
- Theoretical Computer Science (AREA)
- Spectroscopy & Molecular Physics (AREA)
- Mathematical Physics (AREA)
- Biophysics (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- Evolutionary Computation (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Biomedical Technology (AREA)
- Artificial Intelligence (AREA)
- Investigating Or Analysing Materials By Optical Means (AREA)
Abstract
The embodiment of the application provides a water quality detection model training and water quality detection method, an electronic device and a storage medium. The obtained spectral data of the water body at each sample point is subjected to simulated temperature drift processing, so that the condition that the spectral data of the water body at each sample point has temperature drift is simulated, and the obtained spectral data is more practical, therefore, the precision of the water quality detection model obtained by training based on the spectral data of the water body at each sample point after the simulated temperature drift processing and the actual water quality index parameters of the water body at each sample point is higher, and the accuracy of water quality detection by using the water quality detection model is improved.
Description
Technical Field
The application relates to the technical field of detection, in particular to a water quality detection model training and water quality detection method, electronic equipment and a storage medium.
Background
With the continuous development of society, the continuous acceleration of industrialization and urbanization processes, environmental pollution is more serious, particularly, the water quality conditions of water bodies such as rivers and lakes are continuously worsened, and phenomena such as eutrophication, water body area shrinkage and the like occur, so that the detection of the abnormal conditions of the water bodies and the correct response measures have very important significance. The water quality index refers to optical active substances influencing the optical properties of a water body under the natural environment, including chlorophyll, phycocyanin, total phosphorus, total nitrogen and the like, and can measure the eutrophication degree and transparency of the water area. The water quality index caused by the change of the optical properties of the water body is reflected on the spectral data reflected by the light waves on the surface of the water body, and corresponding water quality index parameters can be obtained by processing and analyzing the spectral data, so that the water quality detection is realized.
In the current water quality detection method, a deep learning method is adopted to detect water quality, a large amount of spectrum sample data and corresponding water quality index parameters are collected in the method, and an initial convolutional neural network is trained by utilizing the spectrum sample data and the corresponding water quality index parameters to obtain a water quality detection model; when the system is applied, the spectral data acquired in real time are input into the water quality detection model obtained by training, and corresponding water quality index parameters can be directly obtained, so that water quality detection is realized.
However, due to the influence of factors such as environment and acquisition strategy, the acquired spectrum sample data is prone to have deviation from the actual condition, which affects the accuracy of the water quality detection model training and thus affects the accuracy of water quality detection.
Disclosure of Invention
An object of the embodiment of the application is to provide a water quality detection model training method, a water quality detection method, an electronic device and a storage medium, so as to improve the precision of the water quality detection model training and further improve the accuracy of water quality detection. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a water quality detection model training method, including:
acquiring spectral data of water bodies at a plurality of sample points and actual water quality index parameters of the water bodies at the sample points;
carrying out simulated temperature drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing;
and training a preset neural network model based on the spectral data of the water body at each sample point after the temperature drift simulation treatment and the actual water quality index parameters of the water body at each sample point to obtain a water quality detection model.
Optionally, the step of performing temperature drift simulation processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing includes:
and performing spectral line drift processing and/or baseline drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing.
Optionally, the spectral data of the water body at the sample point includes the optical wavelength of the water body at the sample point and the reflectivity corresponding to the optical wavelength;
the method comprises the following steps of performing spectral line drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing, wherein the steps comprise:
and performing interpolation operation according to a preset drift wavelength based on the light wave wavelength and the reflectivity corresponding to the light wave wavelength of the water body at each sample point to obtain the light wave wavelength and the reflectivity of the water body at each sample point after interpolation.
Optionally, the spectral data of the water body at the sample point includes a reflectivity corresponding to the wavelength of the light wave of the water body at the sample point;
the method comprises the following steps of performing baseline drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing, wherein the steps comprise:
acquiring the intensity of ambient light;
and calculating the reflectivity of the water body at each sample point after baseline drift processing based on the baseline by taking the ambient light intensity as the baseline according to the reflectivity, the ambient light intensity and the preset value corresponding to the light wave wavelength of the water body at each sample point.
Optionally, the neural network model includes a plurality of residual error layers, a dimensionality reduction layer and an output layer connected in series; the residual error layer comprises convolution kernels of a plurality of scales, 1 × 1 convolution kernels for fusing the feature graphs output by the convolution kernels of the scales, a concat layer for connecting the feature graphs output by the 1 × 1 convolution kernels and an activation function layer, wherein the convolution kernels of the scales are used for fusing the feature graphs output by the convolution kernels of the scales; the dimensionality reduction layer is used for carrying out channel dimensionality reduction on the feature graph output by the last residual error layer; the output layers include convolutional layers and dropout layers.
Optionally, the spectral data of the water body at the sample point includes the optical wavelength of the water body at the sample point and the reflectivity corresponding to the optical wavelength;
the residual layer further comprises a weighting layer; the weighting layer is used for respectively utilizing each preset wavelength weight to carry out point multiplication operation on the characteristic vector of the reflectivity corresponding to the light wavelength output by the activation function layer to obtain a weighted characteristic diagram; wherein, each preset wavelength weight is respectively set for different light wave wavelengths.
Optionally, the actual water quality index parameters of the water body at each sample point include: a large amount of first actual water quality index parameters obtained by non-chemical measurement and a small amount of second actual water quality index parameters obtained by chemical measurement;
training a preset neural network model based on the spectral data of the water body at each sample point after the temperature drift simulation treatment and the actual water quality index parameters of the water body at each sample point to obtain a water quality detection model, wherein the step comprises the following steps of:
initializing parameters of each network layer in a preset neural network model;
inputting spectral data of the water body at the first sample point after the temperature drift simulation treatment corresponding to the first actual water quality index parameter into a neural network model to obtain a predicted water quality index parameter of the water body at the first sample point;
comparing the difference between the predicted water quality index parameter of the water body at the first sample point and the first actual water quality index parameter of the water body at the first sample point;
if the difference is greater than a first preset threshold value, adjusting parameters of each network layer in the neural network model based on the difference, returning to the step of inputting spectral data of the water body at a first sample point, which is subjected to temperature drift simulation processing and corresponds to the first actual water quality index parameter, into the neural network model to obtain a predicted water quality index parameter of the water body at the first sample point, and stopping training until the difference is less than the first preset threshold value or the number of times of cycle execution reaches a first preset number of times to obtain a trained neural network model;
inputting the spectral data of the water body at the second sample point after the temperature drift simulation treatment corresponding to the second actual water quality index parameter into the trained neural network model to obtain a predicted water quality index parameter of the water body at the second sample point;
calculating a gradient by using a preset loss function according to the predicted water quality index parameter of the water body at the second sample point, the actual water quality index parameter of the water body at the second sample point and a penalty term, wherein the penalty term is related to the parameter of the convolution layer in the trained neural network model;
and adjusting parameters of the convolution layer in the trained neural network model based on the gradient, returning to the step of inputting spectral data of the water body at the second sample point after the temperature drift simulation treatment corresponding to the second actual water quality index parameter into the trained neural network model to obtain the predicted water quality index parameter of the water body at the second sample point, and stopping training until the gradient is smaller than a second preset threshold or the number of times of cycle execution reaches a second preset number, and taking the currently trained neural network model as a water quality detection model.
In a second aspect, an embodiment of the present application provides a water quality detection method, including:
acquiring spectral data of water at each detection point in a water area to be detected;
sequentially inputting the spectral data of the water body at each detection point into the water quality detection model obtained by the method provided by the first aspect of the embodiment of the application to obtain the water quality index parameters of the water body at each detection point;
and analyzing the water quality index parameters of the water body at each detection point to obtain the water quality detection result of the water area to be detected.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory;
a memory for storing a computer program;
a processor, configured to implement the method provided by the first aspect or the method provided by the second aspect of the embodiments of the present application when executing the computer program stored in the memory.
In a fourth aspect, an embodiment of the present application provides a storage medium, where a computer program is stored, and when executed by a processor, the computer program implements the method provided by the first aspect or the method provided by the second aspect of the embodiment of the present application.
In a fifth aspect, embodiments of the present application further provide a computer program product containing instructions, which when executed on a computer, cause the computer to perform the method provided by the first aspect or the method provided by the second aspect of the embodiments of the present application.
According to the water quality detection model training and water quality detection method, the electronic device and the storage medium provided by the embodiment of the application, after the spectral data of the water body at the plurality of sample points are obtained, the spectral data of the water body at each sample point is subjected to simulated temperature drift processing to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing, and then the preset neural network model is trained on the basis of the spectral data of the water body at each sample point after the simulated temperature drift processing and the obtained actual water quality index parameters of the water body at each sample point to obtain the water quality detection model. The obtained spectral data of the water body at each sample point can be simulated to have temperature drift by performing simulated temperature drift processing on the obtained spectral data of the water body at each sample point, and the obtained spectral data is more practical, so that the precision of the water quality detection model obtained by training based on the spectral data of the water body at each sample point after simulated temperature drift processing and the practical water quality index parameters of the water body at each sample point is higher, and the accuracy of water quality detection by using the water quality detection model is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application 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 only some embodiments of the present application, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a water quality testing model training method according to an embodiment of the present application;
FIG. 2 is a spectral plot of an embodiment of the present application;
FIG. 3 is a schematic diagram of a model structure of a neural network model according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a residual layer structure according to an embodiment of the present application;
FIG. 5 is a schematic flow chart of a water quality detection method according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of a water quality testing model training device according to an embodiment of the present application;
FIG. 7 is a schematic structural diagram of a water quality detecting apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the description herein are intended to be within the scope of the present disclosure.
In order to improve the precision of water quality detection model training and further improve the accuracy of water quality detection, the embodiment of the application provides a water quality detection model training and water quality detection method, an electronic device and a storage medium.
Next, a water quality detection model training method provided in the embodiment of the present application will be described first. The execution subject of the water quality detection model training method provided by the embodiment of the application can be an electronic device (such as a training machine) with a model training function. The method for implementing the water quality testing model training method provided by the embodiment of the application may be at least one of software, hardware circuit and logic circuit arranged in the execution main body.
As shown in fig. 1, an embodiment of the present application provides a water quality testing model training method, which may include the following steps.
S101, acquiring spectral data of the water body at a plurality of sample points and actual water quality index parameters of the water body at each sample point.
And S102, performing simulated temperature drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing.
S103, training a preset neural network model based on the spectral data of the water body at each sample point after the temperature drift simulation treatment and the actual water quality index parameters of the water body at each sample point to obtain a water quality detection model.
By applying the scheme of the embodiment of the application, after the spectrum data of the water body at the plurality of sample points are obtained, the spectrum data of the water body at each sample point is subjected to simulated temperature drift processing to obtain the spectrum data of the water body at each sample point after the simulated temperature drift processing, and then the preset neural network model is trained on the basis of the spectrum data of the water body at each sample point after the simulated temperature drift processing and the obtained actual water quality index parameters of the water body at each sample point to obtain the water quality detection model. The obtained spectral data of the water body at each sample point can be simulated to have temperature drift by performing simulated temperature drift processing on the obtained spectral data of the water body at each sample point, and the obtained spectral data is more practical, so that the precision of the water quality detection model obtained by training based on the spectral data of the water body at each sample point after simulated temperature drift processing and the practical water quality index parameters of the water body at each sample point is higher, and the accuracy of water quality detection by using the water quality detection model is improved.
The water quality detection model is an end-to-end neural network model, and can realize inputting the spectral data of the water body at the detection point and directly outputting the spectral data to obtain the water quality index parameters of the water body at the detection point. The water quality detection model is obtained by training a large amount of sample data, specifically, the water quality detection model is trained by taking the spectral data of the water body at a plurality of sample points as sample data input and taking the water quality index parameters of the water body at each sample point as output during training.
The sample points refer to a plurality of designated detection points in water areas such as rivers and lakes, the spectral data refer to data generated by the light waves at the sample points, specifically, the data can be reflectivity corresponding to the wavelength of the light waves, intensity of the light waves and the like, and in practical application, the spectral data are spectral band data, that is, the spectral data include the wavelength of the light waves and the reflectivity corresponding to the intensity of the light waves/wavelength of the light waves and the like. The spectral data can be obtained by measurement of a spectrometer or by means of image acquisition. Specifically, the manner of acquiring the spectral data of the water body at the plurality of sample points may be: the method comprises the steps of collecting images of water bodies at a plurality of sample points, and then preprocessing the image data to obtain spectral data of the water bodies at the sample points, wherein the preprocessing comprises radiometric calibration, geometric correction, atmospheric correction, water body region cutting, normalization processing and the like.
When the water quality detection model is trained, the actual water quality index parameters of the water body at each sample point are required to be acquired as nominal information during training, and the water quality index parameters are the numerical expression of the water quality index and can be the concentration, density, content and the like of the water quality index. The specific way of obtaining the actual water quality index parameters of the water body at each sample point may be: the method comprises the steps of collecting water body samples at each sample point in advance, carrying out chemical analysis or other water quality analysis on the water body samples to obtain actual water quality index parameters of the water body at each sample point, then storing the actual water quality index parameters of the water body at the sample points, and reading the actual water quality index parameters of the water body at each sample point from a warehouse during training.
If the spectral data of the water body at each original sample point is used for training, the precision of the water quality detection model is seriously reduced under the condition that the spectral data generate temperature drift, and the accuracy of the water quality detection model for water quality detection is influenced. Therefore, the embodiment of the application provides a way for temperature drift resistance training, that is, after the spectral data of the water body at each sample point is obtained, the spectral data of the water body at each sample point is subjected to temperature drift simulation processing, so that the spectral data of the water body at each sample point after the temperature drift simulation processing is obtained. And then training a preset neural network model based on the spectral data of the water body at each sample point after the temperature drift simulation treatment and the actual water quality index parameters of the water body at each sample point to obtain a water quality detection model.
The spectral data of the water body at each sample point after the temperature drift simulation treatment is input during training, so that the condition that the spectral data of the water body at each sample point has the temperature drift can be simulated, and the obtained spectral data is more practical, therefore, the precision of the water quality detection model obtained by training based on the spectral data of the water body at each sample point after the temperature drift simulation treatment and the actual water quality index parameters of the water body at each sample point is higher, and the accuracy of water quality detection by using the water quality detection model is improved.
In an implementation manner of the embodiment of the present application, S102 may specifically be: and performing spectral line drift processing and/or baseline drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing.
In practical applications, the temperature drift of the spectral data mainly includes spectral line drift and baseline drift. The spectral line drift is the left drift or the right drift at the wavelength of the acquired spectral data; the baseline drift is a fixed value added or subtracted to the light wave intensity based on the ambient light intensity as a baseline. In a specific training process, both of the two kinds of drift processing may be performed, and of course, the probability of performing both of the two kinds of drift processing may be set to be 50%, or one kind of drift processing may be randomly selected, which is not specifically limited herein.
In an implementation manner of the embodiment of the present application, the spectral data of the water body at the sample point includes the optical wavelength of the water body at the sample point and the reflectivity corresponding to the optical wavelength. Correspondingly, the step of performing spectral line drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing may specifically be: and performing interpolation operation according to a preset drift wavelength based on the light wave wavelength and the reflectivity corresponding to the light wave wavelength of the water body at each sample point to obtain the light wave wavelength and the reflectivity of the water body at each sample point after interpolation.
The spectral line drift affects the left-right drift of the spectral data, which is equivalent to resampling the original spectral data, namely, based on the light wave wavelength and the reflectivity corresponding to the light wave wavelength of the water body at each sample point, interpolation operation is performed according to the preset drift wavelength, and the light wave wavelength and the reflectivity of the water body at each sample point after interpolation are obtained. The drift wavelength is a spectral line drift intensity parameter, which refers to the specific left drift or right drift at the wavelength of the acquired spectral data, and the resampling can be realized by performing interpolation operation according to the drift wavelength. In specific implementation, a spectrum curve may be first constructed based on the optical wavelength and the reflectivity corresponding to the optical wavelength of the water body at each sample point, where the horizontal axis of the spectrum curve is the optical wavelength and the vertical axis is the reflectivity corresponding to the optical wavelength (as shown in fig. 2). Then, interpolation is performed on the spectral curve according to a preset drift wavelength, taking bilinear interpolation as an example, if the reflectance is 1.0 when the wavelength of the light is 700nm, the reflectance is 0.8 when the wavelength of the light is 701nm, and the preset drift wavelength is 0.4nm, then spectral line drift processing is performed, and the reflectance corresponding to the wavelength of the light after drift is 701nm is 0.8 (1-0.4) +1.0 0.4 is 0.88, that is, after the spectral line drift processing, the reflectance corresponding to the wavelength of the light is 701nm is 0.88. Here, only bilinear interpolation operation is taken as an example, and more complex bicubic interpolation operation or other interpolation operation modes calculated by fields may also be used, which is not limited specifically here.
In another implementation of the embodiment of the present application, the spectral data of the water body at the sample point includes a reflectivity corresponding to a wavelength of light of the water body at the sample point. Correspondingly, the step of performing baseline shift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature shift processing may specifically be: acquiring the intensity of ambient light; and calculating the reflectivity of the water body at each sample point after baseline drift treatment based on the baseline by taking the ambient light intensity as the baseline according to the reflectivity, the ambient light intensity and the preset value corresponding to the light wave wavelength of the water body at each sample point.
When the spectral data of the water body at each sample point is collected, the spectral data of the ambient light (namely, the intensity of the ambient light) can also be collected, and then the baseline shift processing is performed, namely, the intensity of the ambient light is taken as a baseline, and a preset value is added or subtracted on the water body intensity spectrum at the sample point according to the reflectivity, the intensity of the ambient light and the preset value corresponding to the wavelength of the light wave of the water body at each sample point, so as to calculate the reflectivity of the water body at each sample point after the baseline shift processing, wherein the preset value can be generated according to uniform distribution or Gaussian distribution. Recording the water intensity spectrum at the sample point as WwThe intensity of ambient light is denoted as W as a moleculeeAs denominator, the reflectance is calculatedCalculating the baseline drift to the water intensity spectrum, adding or subtracting a preset value count generated by uniform distribution on the water intensity spectrum, dividing by the ambient light intensity, and obtaining the reflectivity again, namelyObtained Wr_newThe reflectivity corresponding to the light wave wavelength of the water body at the sample point after baseline drift processing based on the baseline is obtained.
And counting the performance of the data in the test set, wherein two indexes of errors of RMSE (Root Mean Square Error) and MSE (Mean Square Error) are used, the data with the predicted values within the range of the truth value +/-10% and the truth value +/-15% account for the total number of samples in the test set, and the spectral line drift of the spectral sensor at 20 ℃ is about 0.8 nm. The test results for the original model are shown in table 1, and the test results for the model after introducing the simulated temperature drift are shown in fig. 2.
TABLE 1 test results of the original model
RMSE | MSE | 10% by weight | 15% ratio | |
Original model | 1.47 | 2.17 | 76.5% | 87.8% |
Spectral line drift of 1.2nm | 1.77 | 3.16 | 66.7% | 81.6% |
Spectral line drift of-1.2 nm | 2.05 | 4.21 | 68.8% | 82.1% |
Baseline wander 10count | 1.49 | 2.23 | 75.3% | 86.5% |
Baseline wander-10 count | 1.74 | 3.05 | 71.2% | 83.8% |
Table 2 test results of the model after introduction of the simulated temperature drift
RMSE | MSE | 10% by weight | 15% ratio | |
Warm floating training model | 1.61 | 2.60 | 75.2% | 87.3% |
Spectral line drift of 1.2nm | 1.62 | 2.62 | 74.4% | 86.8% |
Spectral line drift of-1.2 nm | 1.61 | 2.60 | 74.9% | 87.2% |
Baseline wander 10count | 1.68 | 2.82 | 73.9% | 86.6% |
Baseline wander-10 count | 1.75 | 3.06 | 71.3% | 84.1% |
It can be seen from the above table that the model trained with normal data is less resistant to both drifts, especially spectral line drifts. After the simulated temperature drift is introduced into training, the testing precision of an original testing set is still equivalent, and then four kinds of drift transformation input model testing are carried out on the testing set, so that the obvious spectral line drift precision is better maintained, the baseline drift change is not large, and the baseline drift change is slightly improved. Tests show that the water quality detection model obtained by training can ensure that the output result is within a small amplitude error of a true value for drift change possibly generated within +/-20 degrees.
In an implementation manner of the embodiment of the application, a specific training process of the water quality detection model is as follows: initializing a preset model parameter of a neural network model; inputting the spectral data of the water body at the sample point after the temperature drift simulation treatment into a neural network model to obtain a predicted water quality index parameter of the water body at the sample point; comparing the difference between the predicted water quality index parameter of the water body at the sample point and the actual water quality index parameter of the water body at the sample point; if the difference is larger than the preset threshold value, adjusting model parameters of the neural network model based on the difference, returning to the step of inputting the spectral data of the water body at the sample point after the temperature drift simulation treatment into the neural network model to obtain the predicted water quality index parameters of the water body at the sample point, stopping training until the difference is smaller than the preset threshold value or the number of times of cyclic execution reaches the preset number of times, and taking the currently trained neural network model as the water quality detection model.
In one implementation of the embodiment of the present application, the neural network model includes a plurality of residual layers, a dimensionality reduction layer, and an output layer connected in series. The residual layer comprises convolution kernels of a plurality of scales, 1 × 1 convolution kernels for fusing the feature maps output by the convolution kernels of the scales, a concat layer for connecting the feature maps output by the 1 × 1 convolution kernels and an activation function layer. The dimensionality reduction layer is used for carrying out channel dimensionality reduction on the feature graph output by the last residual error layer; the output layers include convolutional layers and dropout layers.
The embodiment of the application adopts a residual error layer composed of a convolution kernel comprising a plurality of scales, a 1 × 1 convolution kernel for fusing a feature map output by the convolution kernel of each scale, a concat layer for connecting the feature maps output by the 1 × 1 convolution kernels and an activation function layer to replace a one-dimensional convolution layer in a conventional neural network model. By adopting convolution kernels of multiple scales, spectral data of various different receptive fields can be effectively extracted, then the convolution kernels of various scales are fused by utilizing 1 x 1 convolution kernels, under the condition that the effect of the convolution kernels is close to that of a conventional one-dimensional convolution layer, the calculated amount and the parameter amount which are approximate to one-fraction of a channel can be achieved, namely the calculated amount and the parameter amount are greatly reduced, a residual error structure is introduced, and gradient transfer can be effectively carried out in the model training process.
Different from the pooling layer used in the current common water quality detection model, the embodiment of the application is connected with the dimensionality reduction layer behind the last residual error layer, and the dimensionality reduction layer can perform channel dimensionality reduction processing on the feature map output by the last residual error layer, so that the parameter quantity is reduced, the spatial information is kept not lost as far as possible in the feature extraction stage, and specifically, the dimensionality reduction layer can be a convolution of 1 × 1. And then connecting an output layer after the dimension reduction layer, wherein the output layer comprises convolution layers and dropout layers, the number of the convolution layers and the dropout layers in the output layer can be one or more, the convolution layers are shared by a plurality of water quality indexes, the dropout layers are used for preventing over-fitting, a specific connection structure is that one dropout layer is connected behind each convolution layer, and finally each water quality index is divided into a path to output a predicted water quality index parameter, so that the subsequent index increase or other modification of the water quality detection model is facilitated.
Taking the example of including four residual layers and the output layer including two convolution layers and two dropout layers, the model structure of the neural network model is shown in fig. 3.
In an implementation manner of the embodiment of the present application, the spectral data of the water body at the sample point includes the optical wavelength of the water body at the sample point and the reflectivity corresponding to the optical wavelength. The residual error layer further comprises a weighting layer, wherein the weighting layer is used for performing point multiplication operation on the characteristic vectors of the reflectivity corresponding to the light wave wavelengths output by the activation function layer by using the preset wavelength weights respectively to obtain a weighted characteristic diagram. The preset wavelength weights are respectively set for different light wave wavelengths.
The characteristics of the water quality detection model are combined, the wave band which is known to be effective for estimating the water quality index parameters is strengthened, so that the model can extract useful information more quickly, convergence is accelerated in the training process, and the introduced calculated amount and parameter amount are less.
The spectral characteristics of chlorophyll are: the light wave length 443nm is the maximum absorption peak of chlorophyll, the wave band 520-560nm is also the wave band reflecting the characteristics of chlorophyll and total phosphorus, and correspondingly, other water quality indexes also have similar spectral characteristics, so wavelength weights can be set in advance for different light wave lengths, and in the weighting layer, the point multiplication operation is performed on the characteristic vectors of the reflectivity corresponding to the light wave lengths output by the activation function layer by using the preset wavelength weights, so as to obtain a weighted characteristic diagram. As shown in fig. 3, each residual layer has a wavelength weight, and in specific implementation, a signal similar to a square wave may be generated based on the wavelength weights, and then the signal is used to smooth a curve formed by feature vectors of reflectances of corresponding light wavelengths output by the activation function layer, so that the feature vectors of effective positions may be enhanced, the feature vectors of unimportant positions may be weakened, the precision of model training may be further improved, and the accuracy of the water quality detection model may be improved.
Fig. 4 is a schematic diagram showing a specific structure of the residual layer. After passing through a 1 × 1 convolutional layer, a feature map (feature map) output by a previous layer is separated into convolutional kernels of various scales (four convolutional kernels of 1 × 1, 1 × 3, 1 × 5 and 1 × 7 shown in the figure are only examples), then the convolutional kernels are respectively fused through 1 × 1 convolution, feature connection is performed through a concat layer, then the feature map is output through an activation function layer, point multiplication operation is performed on feature vectors of reflectivity of corresponding wavelengths output by the activation function layer through weighting layers by using preset wavelength weights, the feature map is finally output after global average pooling, full connection, a smoothing function and a scale function are performed, the output feature map is accumulated with a feature map output by the previous layer to realize a residual error, and finally the feature map of the active function layer is output by the activation function layer.
In an implementation manner of the embodiment of the present application, the actual water quality index parameters of the water body at each sample point include: a large number of first actual water quality indicator parameters measured by a non-chemical method and a small number of second actual water quality indicator parameters measured by a chemical method.
Correspondingly, S103 may be specifically implemented by the following steps:
firstly, initializing parameters of each network layer in a preset neural network model;
inputting spectral data of the water body at the first sample point after the temperature drift simulation treatment corresponding to the first actual water quality index parameter into a neural network model to obtain a predicted water quality index parameter of the water body at the first sample point;
thirdly, comparing the difference between the predicted water quality index parameter of the water body at the first sample point and the first actual water quality index parameter of the water body at the first sample point;
step four, if the difference is larger than a first preset threshold value, parameters of each network layer in the neural network model are adjusted based on the difference, the second step is executed again, and the training is stopped until the difference is smaller than the first preset threshold value or the number of times of the cyclic execution reaches a first preset number, so that the trained neural network model is obtained;
fifthly, inputting the spectral data of the water body at the second sample point after the temperature drift simulation treatment corresponding to the second actual water quality index parameter into the trained neural network model to obtain a predicted water quality index parameter of the water body at the second sample point;
sixthly, calculating a gradient by using a preset loss function according to the predicted water quality index parameter of the water body at the second sample point, the actual water quality index parameter of the water body at the second sample point and a penalty term, wherein the penalty term is related to the parameter of the convolution layer in the trained neural network model;
and seventhly, adjusting parameters of the convolutional layer in the trained neural network model based on the gradient, and returning to execute the fifth step until the gradient is smaller than a second preset threshold value or the number of times of cyclic execution reaches a second preset number, stopping training, and taking the currently trained neural network model as the water quality detection model.
Many water quality indexes such as total phosphorus, total nitrogen and the like need to be measured by a chemical method, the cost of sample labeling is high, and a large number of water quality index parameters with truth value labels cannot be obtained. The water quality indexes such as chlorophyll and phycocyanin can be obtained by non-chemical measurement, and image recognition is utilized, so that a large amount of spectral data of the water body at the first sample point after temperature drift simulation treatment corresponding to a large amount of first actual water quality index parameters obtained by non-chemical measurement can be utilized to train the neural network model first, parameters of each network layer in the neural network model are adjusted in the training process, and after the training is completed, the spectral data of the water body at the first sample point are utilized to train the neural network modelThe trained neural network model is trained again by the spectral data of the water body at the second sample point after the simulated temperature drift treatment corresponding to a small amount of second actual water quality index parameters measured by the chemical method, parameters of a residual error layer and a dimensionality reduction layer are fixed in the training, back propagation is not performed, only parameters of a convolution layer in an output layer are adjusted, and in order to prevent influence on detection effects of water quality characteristics such as chlorophyll, phycocyanin and the like, a loss function is set by using the methodWherein L' (theta) is gradient, L (theta) is common loss function such as MSE, which is the difference result between preset water quality index parameter and actual water quality index parameter,for penalty term, λ is a preset value, biIs a weight of the parameter(s),is a parameter theta of the trained convolutional layer based on the data corresponding to water quality indexes such as chlorophyll, phycocyanin and the likeiParameters of the convolutional layer being trained, biAndthe absolute magnitude of the median is proportional. The original more important parameter weight is rarely changed in the training process, the water quality index can be continuously increased in the subsequent training, and meanwhile, the detection effect of the water quality characteristics such as chlorophyll, phycocyanin and the like is effectively ensured not to be influenced.
As shown in fig. 5, an embodiment of the present application provides a water quality detection method, which may include the following steps.
S501, acquiring spectral data of the water body at each detection point in the water area to be detected.
And S502, sequentially inputting the spectral data of the water body at each detection point into the water quality detection model to obtain the water quality index parameters of the water body at each detection point.
Wherein, the water quality detection model is obtained by training through the method of the embodiment shown in figure 1.
S503, analyzing the water quality index parameters of the water body at each detection point to obtain the water quality detection result of the water area to be detected.
By applying the scheme of the embodiment of the application, the water quality detection model is obtained by training by using the method shown in FIG. 1, and the accuracy of the water quality detection model is high, so that the accuracy of the water quality detection is improved when the water quality detection model is used for water quality detection.
When water quality detection is performed, spectrum data of a water body at each detection point in a water area to be detected needs to be acquired, the detection points refer to a plurality of designated positions in the water area to be detected, the spectrum data refer to data generated by light waves at the detection points, specifically, the data can be reflectivity, light wave intensity and the like, and in actual application, the spectrum data are spectrum band data, that is, the spectrum data comprise light wave wavelength and reflectivity corresponding to the light wave intensity/the light wave wavelength. The spectral data can be obtained by measurement of a spectrometer or by means of image acquisition. Specifically, the mode of acquiring the spectral data of the water body at each detection point in the water area to be detected may be: the method comprises the steps of collecting an image of a water area to be detected, and then preprocessing image data of corresponding positions of detection points in the image to obtain spectral data of the water body at the detection points, wherein the preprocessing comprises radiometric calibration, geometric correction, atmospheric correction, water body area cutting, normalization processing and the like.
After the spectral data of the water body at each detection point are obtained, the spectral data of the water body at each detection point are sequentially input into a water quality detection model, the water quality detection model is an end-to-end neural network model, the spectral data of the water body at the detection point can be input, and the water quality index parameters of the water body at the detection point can be directly output. The water quality detection model is obtained by training a large amount of sample data, specifically, the water quality detection model is trained by taking the spectral data of the water body at a plurality of sample points as sample data input and taking the water quality index parameters of the water body at each sample point as output during training. The specific training mode is as shown in the embodiment of fig. 1, and is not described herein again.
After the water quality index parameters of the water body at each detection point are obtained, the water quality index parameters of the water body at each detection point can be analyzed, the specific analysis process can be concentration analysis, water quality index distribution analysis and the like, the water quality detection result of the water area to be detected can be obtained based on the analysis result, the results such as whether the water area to be detected is eutrophicated and how transparent can be obtained, and specifically, a water quality index parameter distribution diagram of the whole water area to be detected can be drawn according to the water quality index parameters of the water body at each detection point so as to more visually display the condition of the water area.
Corresponding to the above water quality testing model training method, an embodiment of the present application provides a water quality testing model training apparatus, as shown in fig. 6, the apparatus may include:
the first acquisition module 610 is used for acquiring spectral data of the water body at a plurality of sample points and actual water quality index parameters of the water body at each sample point;
the temperature drift processing module 620 is configured to perform simulated temperature drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing;
the training module 630 is configured to train a preset neural network model based on the spectral data of the water body at each sample point after the temperature drift simulation processing and the actual water quality index parameter of the water body at each sample point, so as to obtain a water quality detection model.
Optionally, the temperature drift processing module 620 may be specifically configured to: and performing spectral line drift processing and/or baseline drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing.
Optionally, the spectral data of the water body at the sample point includes the optical wavelength of the water body at the sample point and the reflectivity corresponding to the optical wavelength;
the temperature drift processing module 620 may be specifically configured to: and performing interpolation operation according to a preset drift wavelength based on the light wave wavelength and the reflectivity corresponding to the light wave wavelength of the water body at each sample point to obtain the light wave wavelength and the reflectivity of the water body at each sample point after interpolation.
Optionally, the spectral data of the water body at the sample point includes a reflectivity corresponding to the wavelength of the light wave of the water body at the sample point;
the temperature drift processing module 620 may be specifically configured to: acquiring the intensity of ambient light; and calculating the reflectivity of the water body at each sample point after baseline drift processing based on the baseline by taking the ambient light intensity as the baseline according to the reflectivity, the ambient light intensity and the preset value corresponding to the light wave wavelength of the water body at each sample point.
Optionally, the neural network model includes a plurality of residual error layers, a dimensionality reduction layer and an output layer connected in series; the residual error layer comprises convolution kernels of a plurality of scales, 1 × 1 convolution kernels for fusing the feature graphs output by the convolution kernels of the scales, a concat layer for connecting the feature graphs output by the 1 × 1 convolution kernels and an activation function layer, wherein the convolution kernels of the scales are used for fusing the feature graphs output by the convolution kernels of the scales; the dimensionality reduction layer is used for carrying out channel dimensionality reduction on the feature graph output by the last residual error layer; the output layers include convolutional layers and dropout layers.
Optionally, the spectral data of the water body at the sample point includes the optical wavelength of the water body at the sample point and the reflectivity corresponding to the optical wavelength;
the residual layer further comprises a weighting layer; the weighting layer is used for respectively utilizing each preset wavelength weight to carry out point multiplication operation on the characteristic vector of the reflectivity corresponding to the light wavelength output by the activation function layer to obtain a weighted characteristic diagram; wherein, each preset wavelength weight is respectively set for different light wave wavelengths.
Optionally, the actual water quality index parameters of the water body at each sample point include: a large amount of first actual water quality index parameters obtained by non-chemical measurement and a small amount of second actual water quality index parameters obtained by chemical measurement;
the training module 630 may be specifically configured to:
initializing parameters of each network layer in a preset neural network model;
inputting spectral data of the water body at the first sample point after the temperature drift simulation treatment corresponding to the first actual water quality index parameter into a neural network model to obtain a predicted water quality index parameter of the water body at the first sample point;
comparing the difference between the predicted water quality index parameter of the water body at the first sample point and the first actual water quality index parameter of the water body at the first sample point;
if the difference is greater than a first preset threshold value, adjusting parameters of each network layer in the neural network model based on the difference, returning to the step of inputting spectral data of the water body at a first sample point, which is subjected to temperature drift simulation processing and corresponds to the first actual water quality index parameter, into the neural network model to obtain a predicted water quality index parameter of the water body at the first sample point, and stopping training until the difference is less than the first preset threshold value or the number of times of cycle execution reaches a first preset number of times to obtain a trained neural network model;
inputting the spectral data of the water body at the second sample point after the temperature drift simulation treatment corresponding to the second actual water quality index parameter into the trained neural network model to obtain a predicted water quality index parameter of the water body at the second sample point;
calculating a gradient by using a preset loss function according to the predicted water quality index parameter of the water body at the second sample point, the actual water quality index parameter of the water body at the second sample point and a penalty term, wherein the penalty term is related to the parameter of the convolution layer in the trained neural network model;
and adjusting parameters of the convolution layer in the trained neural network model based on the gradient, returning to the step of inputting spectral data of the water body at the second sample point after the temperature drift simulation treatment corresponding to the second actual water quality index parameter into the trained neural network model to obtain the predicted water quality index parameter of the water body at the second sample point, and stopping training until the gradient is smaller than a second preset threshold or the number of times of cycle execution reaches a second preset number, and taking the currently trained neural network model as a water quality detection model.
By applying the scheme of the embodiment of the application, after the spectrum data of the water body at the plurality of sample points are obtained, the spectrum data of the water body at each sample point is subjected to simulated temperature drift processing to obtain the spectrum data of the water body at each sample point after the simulated temperature drift processing, and then the preset neural network model is trained on the basis of the spectrum data of the water body at each sample point after the simulated temperature drift processing and the obtained actual water quality index parameters of the water body at each sample point to obtain the water quality detection model. The obtained spectral data of the water body at each sample point can be simulated to have temperature drift by performing simulated temperature drift processing on the obtained spectral data of the water body at each sample point, and the obtained spectral data is more practical, so that the precision of the water quality detection model obtained by training based on the spectral data of the water body at each sample point after simulated temperature drift processing and the practical water quality index parameters of the water body at each sample point is higher, and the accuracy of water quality detection by using the water quality detection model is improved.
Corresponding to the above water quality detection method, an embodiment of the present application provides a water quality detection apparatus, as shown in fig. 7, the apparatus may include:
the second obtaining module 710 is configured to obtain spectral data of a water body at each detection point in the water area to be detected;
the detection module 720 is configured to sequentially input the spectral data of the water body at each detection point into the water quality detection model obtained by the method shown in fig. 1, so as to obtain water quality index parameters of the water body at each detection point;
and the analysis module 730 is used for analyzing the water quality index parameters of the water body at each detection point to obtain a water quality detection result of the water area to be detected.
By applying the scheme of the embodiment of the application, the water quality detection model is obtained by training by using the method shown in FIG. 1, and the accuracy of the water quality detection model is high, so that the accuracy of the water quality detection is improved when the water quality detection model is used for water quality detection.
An electronic device, as shown in fig. 8, includes a processor 801 and a memory 802. The memory 802 is used for storing computer programs; the processor 801 is configured to implement the water quality testing model training method or the water quality testing method provided in the embodiment of the present application when executing the computer program stored in the memory 802.
The Memory may include a RAM (Random Access Memory) or an NVM (Non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor including a CPU (Central Processing Unit), an NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
By applying the scheme of the embodiment of the application, after the spectrum data of the water body at the plurality of sample points are obtained, the spectrum data of the water body at each sample point is subjected to simulated temperature drift processing to obtain the spectrum data of the water body at each sample point after the simulated temperature drift processing, and then the preset neural network model is trained on the basis of the spectrum data of the water body at each sample point after the simulated temperature drift processing and the obtained actual water quality index parameters of the water body at each sample point to obtain the water quality detection model. The obtained spectral data of the water body at each sample point can be simulated to have temperature drift by performing simulated temperature drift processing on the obtained spectral data of the water body at each sample point, and the obtained spectral data is more practical, so that the precision of the water quality detection model obtained by training based on the spectral data of the water body at each sample point after simulated temperature drift processing and the practical water quality index parameters of the water body at each sample point is higher, and the accuracy of water quality detection by using the water quality detection model is improved.
In addition, the embodiment of the present application provides a storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the water quality detection model training method or the water quality detection method provided by the embodiment of the present application is implemented.
In another embodiment of the embodiments of the present application, there is also provided a computer program product containing instructions, which when run on a computer, causes the computer to execute the water quality testing model training method or the water quality testing method provided by the embodiments of the present application.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber, DSL (Digital Subscriber Line)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, a hard Disk, a magnetic tape), an optical medium (e.g., a DVD (Digital Versatile Disk)), or a semiconductor medium (e.g., a SSD (Solid State Disk)), etc.
For the embodiments of the water quality testing model training device, the water quality testing device identity recognition device, the electronic device, the storage medium and the computer program product, the contents of the related methods are basically similar to the foregoing embodiments of the methods, so the description is relatively simple, and the relevant points can be referred to the partial description of the embodiments of the methods.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the embodiments of the water quality testing model training device, the water quality testing device identity recognition device, the electronic device, the storage medium and the computer program product, since they are basically similar to the embodiments of the method, the description is relatively simple, and the relevant points can be referred to the description of the embodiments of the method.
The above description is only for the preferred embodiment of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims (10)
1. A water quality detection model training method is characterized by comprising the following steps:
acquiring spectral data of water bodies at a plurality of sample points and actual water quality index parameters of the water bodies at the sample points;
carrying out simulated temperature drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing;
and training a preset neural network model based on the spectral data of the water body at each sample point after the temperature drift simulation treatment and the actual water quality index parameters of the water body at each sample point to obtain a water quality detection model.
2. The method according to claim 1, wherein the step of performing the simulated temperature drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing comprises:
and performing spectral line drift processing and/or baseline drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing.
3. The method of claim 2, wherein the spectral data of the body of water at the sample point comprises the wavelength of light and the reflectance corresponding to the wavelength of light of the body of water at the sample point;
the step of performing spectral line drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the temperature drift simulation processing comprises the following steps:
and performing interpolation operation according to a preset drift wavelength based on the light wave wavelength and the reflectivity corresponding to the light wave wavelength of the water body at each sample point to obtain the light wave wavelength and the reflectivity of the water body at each sample point after interpolation.
4. The method of claim 2, wherein the spectral data of the body of water at the sample point comprises a reflectance corresponding to a wavelength of light of the body of water at the sample point;
the step of performing baseline drift processing on the spectral data of the water body at each sample point to obtain the spectral data of the water body at each sample point after the simulated temperature drift processing comprises the following steps:
acquiring the intensity of ambient light;
and calculating the reflectivity of the water body at each sample point after baseline drift treatment based on the baseline by taking the ambient light intensity as the baseline according to the reflectivity corresponding to the light wave wavelength of the water body at each sample point, the ambient light intensity and a preset value.
5. The method of claim 1, wherein the neural network model comprises a plurality of residual layers, dimensionality reduction layers, and output layers connected in series; the residual error layer comprises convolution kernels of a plurality of scales, a 1 x 1 convolution kernel for fusing the feature maps output by the convolution kernels of the scales aiming at the convolution kernels of the scales, a concat layer for connecting the feature maps output by the 1 x 1 convolution kernels and an activation function layer; the dimensionality reduction layer is used for carrying out channel dimensionality reduction on the feature graph output by the last residual error layer; the output layers include convolutional layers and dropout layers.
6. The method of claim 5, wherein the spectral data of the body of water at the sample point comprises the wavelength of light and the reflectance corresponding to the wavelength of light of the body of water at the sample point;
the residual layer further comprises a weighted layer; the weighting layer is used for respectively utilizing each preset wavelength weight to carry out dot product operation on the characteristic vector of the reflectivity corresponding to the light wave wavelength output by the activation function layer to obtain a weighted characteristic diagram; and the preset wavelength weights are respectively set for different light wave wavelengths.
7. The method of claim 5 or 6, wherein the actual water quality indicator parameter of the body of water at each sample point comprises: a large amount of first actual water quality index parameters obtained by non-chemical measurement and a small amount of second actual water quality index parameters obtained by chemical measurement;
the step of training a preset neural network model based on the spectral data of the water body at each sample point after the simulated temperature drift treatment and the actual water quality index parameters of the water body at each sample point to obtain a water quality detection model comprises the following steps:
initializing parameters of each network layer in a preset neural network model;
inputting the spectral data of the water body at the first sample point after the temperature drift simulation treatment corresponding to the first actual water quality index parameter into the neural network model to obtain a predicted water quality index parameter of the water body at the first sample point;
comparing the difference between the predicted water quality index parameter of the water body at the first sample point and the first actual water quality index parameter of the water body at the first sample point;
if the difference is larger than a first preset threshold value, adjusting parameters of each network layer in the neural network model based on the difference, returning to execute the step of inputting the spectral data of the water body at the first sample point, which is subjected to the temperature drift simulation treatment and corresponds to the first actual water quality index parameter, into the neural network model to obtain the predicted water quality index parameter of the water body at the first sample point, and stopping training until the difference is smaller than the first preset threshold value or the number of times of cycle execution reaches a first preset number of times to obtain a trained neural network model;
inputting the spectral data of the water body at the second sample point after the simulated temperature drift treatment corresponding to the second actual water quality index parameter into the trained neural network model to obtain a predicted water quality index parameter of the water body at the second sample point;
calculating a gradient by using a preset loss function according to the predicted water quality index parameter of the water body at the second sample point, the actual water quality index parameter of the water body at the second sample point and a penalty term, wherein the penalty term is related to the parameter of the convolution layer in the trained neural network model;
and adjusting parameters of a convolution layer in the trained neural network model based on the gradient, returning to execute the step of inputting the spectral data of the water body at the second sample point after the temperature drift simulation treatment corresponding to the second actual water quality index parameter into the trained neural network model to obtain the predicted water quality index parameter of the water body at the second sample point, stopping training until the gradient is smaller than a second preset threshold value or the number of times of cycle execution reaches a second preset number of times, and taking the currently trained neural network model as a water quality detection model.
8. A water quality detection method is characterized by comprising the following steps:
acquiring spectral data of water at each detection point in a water area to be detected;
sequentially inputting the spectral data of the water body at each detection point into the water quality detection model obtained by the method according to any one of claims 1 to 7 to obtain water quality index parameters of the water body at each detection point;
and analyzing the water quality index parameters of the water body at each detection point to obtain a water quality detection result of the water area to be detected.
9. An electronic device comprising a processor and a memory;
the memory is used for storing a computer program;
the processor, when executing the computer program stored in the memory, implementing the method of any of claims 1-7 or the method of claim 8.
10. A storage medium, characterized in that the storage medium has stored therein a computer program which, when being executed by a processor, carries out the method of any one of claims 1-7 or the method of claim 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110296084.8A CN113049500B (en) | 2021-03-19 | 2021-03-19 | Water quality detection model training and water quality detection method, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110296084.8A CN113049500B (en) | 2021-03-19 | 2021-03-19 | Water quality detection model training and water quality detection method, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113049500A true CN113049500A (en) | 2021-06-29 |
CN113049500B CN113049500B (en) | 2022-12-06 |
Family
ID=76514091
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110296084.8A Active CN113049500B (en) | 2021-03-19 | 2021-03-19 | Water quality detection model training and water quality detection method, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113049500B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113567357A (en) * | 2021-07-26 | 2021-10-29 | 杭州海康威视数字技术股份有限公司 | Spectral data fusion method and device |
CN117557917A (en) * | 2024-01-11 | 2024-02-13 | 杭州海康威视数字技术股份有限公司 | Water quality detection method and device |
CN117571634A (en) * | 2024-01-12 | 2024-02-20 | 杭州海康威视数字技术股份有限公司 | Camera for monitoring water quality |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040106213A1 (en) * | 2000-11-30 | 2004-06-03 | Mclaughlin James | System and method for gas discharge spectroscopy |
CN101968438A (en) * | 2010-09-25 | 2011-02-09 | 西北农林科技大学 | Method for distinguishing water injection of raw material muscles quickly |
CN102636452A (en) * | 2012-05-03 | 2012-08-15 | 中国科学院长春光学精密机械与物理研究所 | NIR (Near Infrared Spectrum) undamaged identification authenticity method for wild ginseng |
CN106769939A (en) * | 2016-12-30 | 2017-05-31 | 无锡中科光电技术有限公司 | The real-time calibration system and measurement calibration method of a kind of Multi-axial differential absorption spectrometer |
CN108007917A (en) * | 2017-03-16 | 2018-05-08 | 黑龙江八农垦大学 | Hilbert method establishes nitrogen content raman spectroscopy measurement model method in rice strain |
CN108007916A (en) * | 2017-03-16 | 2018-05-08 | 黑龙江八农垦大学 | Hilbert Huang method establishes copolymerization Jiao's microscopic Raman measurement model of rice strain nitrogen content |
CN109064553A (en) * | 2018-10-26 | 2018-12-21 | 东北林业大学 | Solid wood board knot form inversion method based on near-infrared spectrum analysis |
CN109811032A (en) * | 2019-01-04 | 2019-05-28 | 山东省科学院海洋仪器仪表研究所 | A kind of seawater microbial biomass spectral method of detection |
CN110068544A (en) * | 2019-05-08 | 2019-07-30 | 广东工业大学 | Material identification network model training method and tera-hertz spectra substance identification |
CN110389114A (en) * | 2019-07-23 | 2019-10-29 | 上海市水文总站 | A kind of medium and small water quality kind identification method based on unmanned plane imaging spectral |
CN111693487A (en) * | 2020-05-28 | 2020-09-22 | 济南大学 | Fruit sugar degree detection method and system based on genetic algorithm and extreme learning machine |
CN112014331A (en) * | 2020-08-21 | 2020-12-01 | 中国第一汽车股份有限公司 | Method, device and equipment for detecting water body pollution and storage medium |
-
2021
- 2021-03-19 CN CN202110296084.8A patent/CN113049500B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040106213A1 (en) * | 2000-11-30 | 2004-06-03 | Mclaughlin James | System and method for gas discharge spectroscopy |
CN101968438A (en) * | 2010-09-25 | 2011-02-09 | 西北农林科技大学 | Method for distinguishing water injection of raw material muscles quickly |
CN102636452A (en) * | 2012-05-03 | 2012-08-15 | 中国科学院长春光学精密机械与物理研究所 | NIR (Near Infrared Spectrum) undamaged identification authenticity method for wild ginseng |
CN106769939A (en) * | 2016-12-30 | 2017-05-31 | 无锡中科光电技术有限公司 | The real-time calibration system and measurement calibration method of a kind of Multi-axial differential absorption spectrometer |
CN108007917A (en) * | 2017-03-16 | 2018-05-08 | 黑龙江八农垦大学 | Hilbert method establishes nitrogen content raman spectroscopy measurement model method in rice strain |
CN108007916A (en) * | 2017-03-16 | 2018-05-08 | 黑龙江八农垦大学 | Hilbert Huang method establishes copolymerization Jiao's microscopic Raman measurement model of rice strain nitrogen content |
CN109064553A (en) * | 2018-10-26 | 2018-12-21 | 东北林业大学 | Solid wood board knot form inversion method based on near-infrared spectrum analysis |
CN109811032A (en) * | 2019-01-04 | 2019-05-28 | 山东省科学院海洋仪器仪表研究所 | A kind of seawater microbial biomass spectral method of detection |
CN110068544A (en) * | 2019-05-08 | 2019-07-30 | 广东工业大学 | Material identification network model training method and tera-hertz spectra substance identification |
CN110389114A (en) * | 2019-07-23 | 2019-10-29 | 上海市水文总站 | A kind of medium and small water quality kind identification method based on unmanned plane imaging spectral |
CN111693487A (en) * | 2020-05-28 | 2020-09-22 | 济南大学 | Fruit sugar degree detection method and system based on genetic algorithm and extreme learning machine |
CN112014331A (en) * | 2020-08-21 | 2020-12-01 | 中国第一汽车股份有限公司 | Method, device and equipment for detecting water body pollution and storage medium |
Non-Patent Citations (1)
Title |
---|
余果等: "基于神经网络模型的湛江湾水体有色溶解有机物的遥感估算", 《海洋科学》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113567357A (en) * | 2021-07-26 | 2021-10-29 | 杭州海康威视数字技术股份有限公司 | Spectral data fusion method and device |
CN113567357B (en) * | 2021-07-26 | 2024-05-24 | 杭州海康威视数字技术股份有限公司 | Fusion method and device of spectrum data |
CN117557917A (en) * | 2024-01-11 | 2024-02-13 | 杭州海康威视数字技术股份有限公司 | Water quality detection method and device |
CN117557917B (en) * | 2024-01-11 | 2024-05-03 | 杭州海康威视数字技术股份有限公司 | Water quality detection method and device |
CN117571634A (en) * | 2024-01-12 | 2024-02-20 | 杭州海康威视数字技术股份有限公司 | Camera for monitoring water quality |
CN117571634B (en) * | 2024-01-12 | 2024-04-12 | 杭州海康威视数字技术股份有限公司 | Camera for monitoring water quality |
Also Published As
Publication number | Publication date |
---|---|
CN113049500B (en) | 2022-12-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113049500B (en) | Water quality detection model training and water quality detection method, electronic equipment and storage medium | |
CN108447057B (en) | SAR image change detection method based on significance and depth convolution network | |
CN116879297B (en) | Soil moisture collaborative inversion method, device, equipment and medium | |
Bailer-Jones | The ILIUM forward modelling algorithm for multivariate parameter estimation and its application to derive stellar parameters from Gaia spectrophotometry | |
CN113283419B (en) | Convolutional neural network pointer instrument image reading identification method based on attention | |
CN112528559B (en) | Chlorophyll a concentration inversion method combining pre-classification and machine learning | |
Wang et al. | Land cover change detection with a cross‐correlogram spectral matching algorithm | |
CN111879709B (en) | Lake water body spectral reflectivity inspection method and device | |
CN108846200B (en) | Quasi-static bridge influence line identification method based on iteration method | |
Khokhlov et al. | Signatures of low-dimensional chaos in hourly water level measurements at coastal site of Mariupol, Ukraine | |
CN115049026A (en) | Regression analysis method of space non-stationarity relation based on GSNNR | |
CN112859034B (en) | Natural environment radar echo amplitude model classification method and device | |
CN111461923A (en) | Electricity stealing monitoring system and method based on deep convolutional neural network | |
Küppers et al. | Bayesian confidence calibration for epistemic uncertainty modelling | |
CN117669394A (en) | Mountain canyon bridge long-term performance comprehensive evaluation method and system | |
Oga et al. | River state classification combining patch-based processing and CNN | |
CN117392564B (en) | River water quality inversion method based on deep learning, electronic equipment and storage medium | |
CN113903407A (en) | Component identification method, component identification device, electronic equipment and storage medium | |
CN107944474A (en) | Multiple dimensioned cooperation table based on local auto-adaptive dictionary reaches hyperspectral classification method | |
CN111222543B (en) | Substance identification method and apparatus, and computer-readable storage medium | |
Zhao et al. | Exploring an application-oriented land-based hyperspectral target detection framework based on 3D–2D CNN and transfer learning | |
CN103903258B (en) | Method for detecting change of remote sensing image based on order statistic spectral clustering | |
Liu et al. | A generic composite measure of similarity between geospatial variables | |
Krüger et al. | Evaluating spatial data acquisition and interpolation strategies for river bathymetries | |
CN115985415A (en) | Method for predicting common physicochemical properties of organic molecules based on multi-learning model |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |