A method and device for water environment detection
By building a deep learning network model and adjusting parameters, the problem of insufficient accuracy and stability of spectral detection technology in water environment detection is solved, and high accuracy and stability of water quality, water blossom and sediment content detection is achieved, supporting the on-site deployment of equipment and unattended.
Patent Information
- Application Number
- CN202411159878.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2044-08-22
AI Technical Summary
Spectroscopic detection technology has problems with low detection accuracy and stability in water environment detection, especially in water quality, water blossom and sediment content monitoring scenarios. Due to the influence of material spectral signal stacking and light noise, the phenomenon of heterospectral and heterospectral of heterospectral is more common.
By building a deep learning network model, pre-training the model using the spectral training data set, and parameter adjustments are made based on the spectral test data set, a multi-parameter detection model for water environment is established to achieve automatic calibration and accuracy improvement of the parameters of spectral detection equipment.
It improves the accuracy and stability of water environment detection, meets the field deployment needs of spectral detection equipment in water quality, water blossoms and sediment content detection objects, and realizes real-time online deployment and unattended equipment.
Smart Images

Figure CN118782172B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water environment detection, and particularly relates to a water environment detection method and device. Background Art
[0002] Spectral detection is a very important material analysis and detection technology. Its main principle is to determine information such as the composition, structure, and properties of a substance by acquiring and analyzing the optical characteristics of the substance. With the development of spectral detection technology and the mastery of the spectral characteristics of substances, such as the principles and technologies of absorption, transmission, reflection, scattering, and fluorescence spectra, more and more new spectral detection devices and models are used in the field of ecological environment protection, especially in scenarios of sequential water quality, algal bloom, and sediment content monitoring.
[0003] However, due to the inherent defects of spectral detection technology, namely the stacking of substance spectral signals and the influence of optical noise, the phenomenon of "the same substance with different spectra and different substances with the same spectra" is likely to occur. At the same time, due to the diversity and complexity of the components of water environment substances, even the optical characteristics of different substances of the same type may have certain differences, resulting in relatively low detection accuracy and detection stability for the water environment. Summary of the Invention
[0004] In view of this, the present invention provides a water environment detection method and device to solve the problem of relatively low detection accuracy and detection stability for the water environment caused by spectral detection technology.
[0005] In a first aspect, the present invention provides a water environment detection method, which includes:
[0006] Collect water environment parameters of a target area, and construct a spectral training data set and a spectral test data set based on the water environment parameters;
[0007] Construct a deep learning network model, and pre-train the deep learning network model based on the spectral training data set to obtain an initialized detection model;
[0008] Adjust the parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model;
[0009] Collect spectral real-time data, and input the spectral real-time data into the multi-parameter water environment detection model to obtain a water environment detection result.
[0010] A water environment detection method provided by this embodiment pre-trains a deep learning network model using a spectral training data set, adjusts the parameters of the initialized detection model based on a spectral test data set, and then uses a multi-parameter water environment detection model to detect the water environment. By pre-training the model and adjusting the parameters, the parameters of the initialized detection model are automatically calibrated, and the obtained water environment detection results are more accurate, improving the detection accuracy and detection stability of the multi-parameter water environment detection model, and meeting the field deployment requirements of spectral detection equipment for detection objects such as water quality, algal blooms, and sediment content.
[0011] In an alternative embodiment, the deep learning network model consists of a backward neural network layer and a fully connected layer; constructing the deep learning network model and pre-training the deep learning network model based on the spectral training data set to obtain an initialized detection model includes:
[0012] Construct a spectral vector matrix based on the spectral training data set, and perform backward convolution processing using the backward neural network layer based on the spectral vector matrix to obtain spectral feature information;
[0013] Input the spectral feature information into the fully connected layer to obtain the weight coefficients corresponding to the spectral feature information;
[0014] Determine the water environment fitting value based on the spectral feature information and the weight coefficients;
[0015] Calculate the loss function value based on the water environment parameters and the water environment fitting value, and adjust the weight coefficients based on the loss function value to obtain the initialized detection model.
[0016] A water environment detection method provided by this embodiment accurately extracts spectral feature information through the backward neural network layer, reduces the data dimension, and quantifies the weight coefficients of different spectral feature information through the fully connected layer. The construction of the initialized detection model meets the monitoring accuracy requirements of field-deployed spectral detection equipment for the water environment.
[0017] In an alternative embodiment, constructing the deep learning network model and pre-training the deep learning network model based on the spectral training data set to obtain the initialized detection model further includes:
[0018] Store the spectral feature information and the weight coefficients in the spectral feature library.
[0019] In an alternative embodiment, adjusting the parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model includes:
[0020] Input the spectral test data set into the initialized detection model to generate a prediction result of the water environment parameters;
[0021] Judge whether the initialization detection model needs to adjust network parameters based on the prediction results of water environment parameters;
[0022] If the initialization detection model needs to adjust network parameters, adjust the network parameters of the initialization detection model based on the spectral test data set to obtain a multi-parameter water environment detection model.
[0023] A water environment detection method provided in this embodiment utilizes the empirical knowledge in the initialization detection model, improves the detection performance of the multi-parameter water environment detection model by adjusting the network parameters of the initialization detection model, and solves the problem of automatic calibration of model parameters by adjusting the network parameters of the initialization detection model with the spectral test data set, providing a constructive technical route and thinking for truly and effectively promoting the spectral detection equipment, such as water quality detection equipment and sediment content detection equipment, for real-time online deployment, unmanned operation in the wild, and equipment calibration-free.
[0024] In an alternative embodiment, judging whether the initialization detection model needs to adjust network parameters based on the prediction results of water environment parameters includes:
[0025] Input the spectral test data set into the backpropagation neural network to obtain spectral feature vectors;
[0026] Calculate the spectral feature similarity based on the spectral feature vectors and the spectral feature information in the spectral feature library;
[0027] Determine the test results of water environment parameters based on the spectral test data set, and calculate the average relative error and correlation value based on the test results of water environment parameters and the prediction results of water environment parameters;
[0028] If the spectral feature similarity is less than the first preset threshold, the average relative error is greater than the second preset threshold, and the correlation value is less than the third threshold, the initialization detection model needs to adjust network parameters.
[0029] A water environment detection method provided in this embodiment determines whether the initialization detection model needs to adjust network parameters by comparing the spectral feature similarity, and the average relative error and correlation value of the test results of water environment parameters and the prediction results of water environment parameters with the corresponding preset threshold results, realizing the determination of whether the initialization detection model fully meets the water environment monitoring accuracy requirements of field-deployed equipment, and thus laying a foundation for subsequent adjustment of the network parameters of the initialization detection model and improving the detection accuracy of the multi-parameter water environment detection model.
[0030] In an alternative embodiment, if the initialization detection model needs to adjust network parameters, adjusting the network parameters of the initialization detection model based on the spectral test data set to obtain a multi-parameter water environment detection model includes:
[0031] If network parameter adjustment is required for initializing the detection model, freeze the backward neural network layer and adjust the network parameters corresponding to the fully connected layer based on the spectral test data set to obtain a multi-parameter water environment detection model.
[0032] In a second aspect, the present invention provides a water environment detection device, which includes:
[0033] A construction module for collecting water environment parameters of a target area and constructing a spectral training data set and a spectral test data set based on the water environment parameters;
[0034] A training module for constructing a deep learning network model and pre-training the deep learning network model based on the spectral training data set to obtain an initialized detection model;
[0035] An adjustment module for adjusting the parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model;
[0036] A detection module for collecting real-time spectral data and inputting the real-time spectral data into the multi-parameter water environment detection model to obtain a water environment detection result.
[0037] In a third aspect, the present invention provides a computer device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the water environment detection method according to the first aspect or any corresponding embodiment thereof.
[0038] In a fourth aspect, the present invention provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to cause a computer to execute the water environment detection method according to the first aspect or any corresponding embodiment thereof.
[0039] In a fifth aspect, the present invention provides a computer program product, including computer instructions, and the computer instructions are used to cause a computer to execute the water environment detection method according to the first aspect or any corresponding embodiment thereof. Description of the Drawings
[0040] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0041] Figure 1 It is a flowchart of a water environment detection method according to an embodiment of the present invention;
[0042] Figure 2 is a schematic flowchart of another water environment detection method according to an embodiment of the present invention;
[0043] Figure 3 is a schematic flowchart of water environment spectral detection according to an embodiment of the present invention;
[0044] Figure 4 is a schematic flowchart of yet another water environment detection method according to an embodiment of the present invention;
[0045] Figure 5 is a structural block diagram of a water environment detection device according to an embodiment of the present invention;
[0046] Figure 6 is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Specific Embodiments
[0047] To make the objectives, 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 accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0048] Spectral detection technology has been widely applied in the fields of chemistry, biology, medicine, environment, etc. Specifically, spectral detection technology mainly has the following advantages: (1) Non-contact in-situ detection, which will not cause damage and pollution to the sample; (2) Multiple components can be detected simultaneously; (3) Fast detection speed, enabling near real-time monitoring; (4) High detection sensitivity; (5) Greatly reduced detection cost.
[0049] Although spectral detection technology plays a huge role in the field of ecological environment protection. However, due to the inherent defects of spectral detection technology, namely the stacking of spectral signals of substances and the influence of optical noise, it is relatively easy to present the phenomena of "the same substance with different spectra, different substances with the same spectrum". At the same time, due to the diversity and complexity of substance components, there may be certain differences in the optical characteristics of even the same type of different substances. Therefore, it is difficult to establish a unified high-precision and high-generalization ability water environment multi-parameter detection model algorithm. If the generalization ability and stability of the model detection can be improved on the basis of ensuring the accuracy of the spectral detection algorithm model, it can truly effectively promote the development of spectral detection equipment such as water quality detection equipment and sediment content detection equipment towards real-time online deployment, unmanned operation in the wild, and equipment-free calibration and maintenance, taking an important step forward.
[0050] An embodiment of the present invention provides a water environment detection method, which is applied to devices such as servers. The server-like device can be an external device of a water environment spectral detection device or integrated into the water environment spectral detection device. To meet the on-site deployment requirements for detection objects such as water quality, water blooms, and sediment content, it automatically optimizes the detection accuracy of the model and solves the problem of automatic calibration of model parameters.
[0051] According to an embodiment of the present invention, an embodiment of a water environment detection method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0052] In this embodiment, a water environment detection method is provided, which can be used for the above-mentioned server-like devices. Figure 1 It is a flowchart of a water environment detection method according to an embodiment of the present invention, as Figure 1 shown. The process includes the following steps:
[0053] Step S101, collect water environment parameters of the target area, and construct a spectral training data set and a spectral test data set based on the water environment parameters.
[0054] Specifically, the water environment parameters include water quality, water blooms, sediment content, etc.
[0055] Step S102, construct a deep learning network model, and pre-train the deep learning network model based on the spectral training data set to obtain an initialized detection model.
[0056] Specifically, the data in the spectral vector set is randomly divided into a spectral training data set and a spectral test data set. The model is trained using the spectral training data set and tested using the spectral test data set. When the experimental accuracy of both the training set and the test set is better than 90%, it can be used as an initialized detection model for on-site deployment.
[0057] Step S103, adjust the parameters of the initialized detection model based on the spectral test data set to obtain a water environment multi-parameter detection model.
[0058] Specifically, the purpose of adjusting the parameters of the initialized detection model is to use the empirical knowledge of the pre-trained model (i.e., the initialized detection model) to accelerate the training of the new model (i.e., the water environment multi-parameter detection model) and improve the performance of the new model.
[0059] Step S104, collect spectral real-time data, and input the spectral real-time data into the water environment multi-parameter detection model to obtain a water environment detection result.
[0060] Specifically, the water environment detection results include the spectral detection values of different substances in water environment parameters such as water quality, water bloom, and sediment content.
[0061] A water environment detection method provided in this embodiment pre-trains a deep learning network model using a spectral training data set, and adjusts the parameters of the initialized detection model based on a spectral test data set. Then, the water environment multi-parameter detection model is used to detect the water environment. Through pre-training the model and adjusting the parameters, the parameters of the initialized detection model are automatically calibrated, and the obtained water environment detection results are more accurate, improving the detection accuracy and detection stability of the water environment multi-parameter detection model, and meeting the field deployment requirements of spectral detection equipment for detection objects such as water quality, water bloom, and sediment content.
[0062] In this embodiment, a water environment detection method is provided, which can be used for devices such as the above-mentioned servers. Figure 2 It is a flowchart of a water environment detection method according to an embodiment of the present invention, as Figure 2 shown. The process includes the following steps:
[0063] Step S201, collect the water environment parameters of the target area, and construct a spectral training data set and a spectral test data set based on the water environment parameters. For details, please refer to Figure 1 Step S101 of the shown embodiment, which will not be elaborated here.
[0064] Step S202, construct a deep learning network model, and pre-train the deep learning network model using the spectral training data set to obtain an initialized detection model.
[0065] Specifically, the deep learning network model is composed of a backward neural network layer and a fully connected layer; the deep learning network model is a neural network model, and the neural network model is an artificial neural network based on biological neural networks, which can be used to solve problems such as classification and regression. The training process of the neural network model includes steps such as defining the model, loss function, optimizer, and model training; through experimental tests, when establishing a deep learning network model for water environment indicators such as water quality, water bloom, and sediment content, only a small number of samples with true value labels need to be collected and a lightweight network structure needs to be designed to initialize a water environment multi-parameter detection model with high accuracy; according to the experience of statistical models and semi-empirical models, when designing the network activation function, linear or nonlinear activation functions commonly used can be selected, including but not limited to them. For designing a regression model, a multi-layer backward neural network is usually established first to extract spectral features and reduce the data dimension; on this basis, 1 to 3 fully connected layers are added to determine the weight coefficients of the obtained feature information.
[0066] Further, the above step S202 includes:
[0067] In step S2021, a spectral vector matrix is constructed based on the spectral training dataset, and backward convolution processing is performed using the backward neural network layer based on the spectral vector matrix to obtain spectral feature information.
[0068] Specifically, the vector expression for collecting the water environment parameters of area A using the water environment detection device is: A = [a1, a2, a3... a n ; At the same time, the vector expression for collecting the water environment parameters of area B using the water environment detection device is: B = [b1, b2, b3... b n , where a n and b n represent different absorption spectrum information collected by the spectral detection device at wavelength n, and n represents that the detection device can collect absorption spectrum information at n different wavelengths; Assuming spectral collection is performed for m regions, the spectral vector matrix All can be expressed as:
[0069]
[0070] where M represents the collection area of the water environment parameters.
[0071] Further, the matrices All of n different wavelengths of m regions are input into the first-layer backward neural network, and the first-layer backward neural network performs backward convolution processing as shown in the following expression:
[0072] y 1 = f(x 1 ) (2)
[0073] where y 1 represents the result output after the backward convolution processing of the first-layer backward neural network (i.e., local features), x 1 represents the spectral vector matrix, and f represents the convolution operation function.
[0074] Further, in the subsequent backward neural network, the input data is the result calculated in the previous-layer backward neural network, and its formula is as follows:
[0075] y i+1 = f(y i ) (3)
[0076] where i represents the layer number of the backward neural network, and when i is between 3 and 5 layers, the feature information in the spectral data can be effectively extracted. Too deep or too shallow convolution layers will affect the feature extraction ability.
[0077] In step S2022, the spectral feature information is input into the fully connected layer to obtain the weight coefficients corresponding to the spectral feature information.
[0078] Specifically, after performing backward convolution processing using the backward neural network layer, spectral feature information is obtained. However, for regression problems, it is still necessary to quantify the weight coefficients of different features to obtain the final water environment detection result. Therefore, a fully connected layer is used to replace the regression model, and the spectral feature information extracted after being processed by the backward neural network layer is input into the fully connected layer to optimize the weight coefficients.
[0079] Further, when the number of layers of the fully connected layer is 1, the process of optimizing the weight coefficients can be expressed as follows:
[0080]
[0081] Where y represents the water environment parameter, α represents the weight coefficient, represents the spectral feature information, b represents a constant, and k represents the number of spectral feature information.
[0082] Specifically, the spectral feature information and the weight coefficients are stored in the spectral feature library.
[0083] Further, as Figure 3 shown, in the long-term time series of the same river basin, there will also be a large range of fluctuations in water environment parameters. The reasons for the fluctuations are mainly caused by periodic changes, trend changes, random noise, and emergencies, etc. Therefore, even when monitoring the water environment of the same river section in the same river basin, it is difficult to comprehensively obtain the changes in the water environment components in the early stage of equipment deployment. Furthermore, a spectral feature library for automatically constructing water environment features is established to obtain more water environment feature information with large differences and the corresponding weight coefficients of this water environment feature information. The specific steps include: extracting the water environment spectral feature vector set F all [F1, F2, F3…] through the backward neural network layer, and obtaining its corresponding weight coefficient vector set W all [W1, W2, W3…] through the fully connected layer. In the stage of constructing the spectral feature library, the spectral feature vector set F all and its corresponding weight coefficient vector set W all are recorded according to the one-to-one and one-to-many mapping relationships.
[0084] Further, the spectral feature library has conventional database functions such as addition, deletion, update, and query. And in the mapping relationship between the spectral feature information and the weight coefficients, if the network parameters of the initialization detection model in this period are fine-tuned, that is, it is necessary to record the weight coefficients corresponding to the spectral features after modifying the network parameters, and mark this record with a timestamp.
[0085] Step S2023, determining the water environment fitting value based on the spectral feature information and the weight coefficients.
[0086] Specifically, the product of the spectral feature information and the weight coefficient is used as the water environment fitting value.
[0087] Step S2024: Calculate the loss function value based on the water environment parameters and the water environment fitting value, and adjust the weight coefficient based on the loss function value to obtain an initial detection model.
[0088] Specifically, the deep learning network model uses the Adam algorithm (Adaptive Moment Estimation algorithm) as the optimizer, uses the rectified linear unit activation function to accelerate the convergence of the network after filtering, and the loss function uses the mean square error (MSE) to measure the gap between the water environment parameters and the water environment fitting value. The calculation formula of MSE is as follows:
[0089] MSE = ι(y T - y p ) (5)
[0090] where ι represents the loss function, y T represents the water environment parameters, and y p represents the water environment fitting value.
[0091] Furthermore, compare the loss function value with a preset threshold. When the loss function value is less than the preset threshold, an initial detection model is obtained.
[0092] Step S203: Adjust the parameters of the initial detection model based on the spectral test data set to obtain a multi-parameter water environment detection model. For details, please refer to step S103 of the embodiment shown Figure 1 and will not be elaborated here.
[0093] Step S204: Collect spectral real-time data, and input the spectral real-time data into the multi-parameter water environment detection model to obtain a water environment detection result.
[0094] Specifically, input the spectral real-time data into the multi-parameter water environment detection model, use the backward neural network layer to extract the spectral feature vector, automatically match the spectral feature vector with the spectral feature library. If the similarity between the two feature vectors exceeds 90%, it can be determined that the two features are of the same type, so the feature database does not need to be updated and new data does not need to be added. Furthermore, obtain the weight coefficient corresponding to the spectral feature vector, and perform detection using the fully connected layer based on the spectral feature vector to obtain a water environment detection result.
[0095] The water environment detection method provided in this embodiment realizes the accurate extraction of spectral feature information through the backward neural network layer, reduces the data dimension, and quantifies the weight coefficients of different spectral feature information through the fully connected layer. The construction of the initial detection model meets the monitoring accuracy requirements of the on-site deployed spectral detection equipment for the water environment.
[0096] In this embodiment, a water environment detection method is provided, which can be used for devices such as the above-mentioned servers. Figure 4 It is a flowchart of a water environment detection method according to an embodiment of the present invention, as Figure 4 shown, the process includes the following steps:
[0097] Step S401, collect water environment parameters of the target area, and construct a spectral training data set and a spectral test data set based on the water environment parameters. For details, please refer to Figure 2 step S201 of the embodiment shown, which will not be elaborated here.
[0098] Step S402, construct a deep learning network model, and pre-train the deep learning network model based on the spectral training data set to obtain an initialized detection model. For details, please refer to Figure 2 step S202 of the embodiment shown, which will not be elaborated here.
[0099] Step S403, adjust the parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model.
[0100] Specifically, the above step S403 includes:
[0101] Step S4031, input the spectral test data set into the initialized detection model to generate a prediction result of water environment parameters.
[0102] Specifically, in the field deployment stage, since the sensing device is for water environment monitoring of a fixed river section, the initialized detection model may not fully meet the requirements for water environment feature recognition, extraction, and initialization weight setting of this river section. Therefore, it is first necessary to determine whether the initialized detection model fully meets the accuracy requirements for water environment monitoring of the field-deployed device; in the experimental test stage, randomly collect water samples within three months after the field deployment of the water environment monitoring device, and send them to the laboratory to obtain true value label information. Use the above data as the spectral test data set; at the same time, substitute the spectral information obtained by the water environment sensing device into the initialized detection model to solve the blind test result of water environment parameters, that is, the prediction result of water environment parameters.
[0103] Step S4032, determine whether the initialized detection model needs to adjust network parameters based on the prediction result of water environment parameters.
[0104] In some optional implementation manners, the above step S4032 includes:
[0105] Step a1, input the spectral test data set into the backpropagation neural network to obtain a spectral feature vector.
[0106] Step a2: Calculate the spectral feature similarity based on the spectral feature vector and the spectral feature information in the spectral feature library.
[0107] Specifically, the cosine similarity is used to quantify the similarity between the spectral feature vector and the spectral feature information. The specific calculation formula is as follows:
[0108]
[0109] where F1 represents the spectral feature vector, F2 represents the spectral feature information, Sim(F1, F2) represents the spectral feature similarity, · represents the vector dot product operation, and || || represents the norm operation.
[0110] Step a3: Determine the test results of water environment parameters based on the spectral test data set, and calculate the average relative error and the correlation value based on the test results of water environment parameters and the predicted results of water environment parameters.
[0111] Step a4: If the spectral feature similarity is less than the first preset threshold, and the average relative error is greater than the second preset threshold, and the correlation value is less than the third threshold, then the initialization detection model needs to adjust the network parameters.
[0112] Specifically, if the spectral feature similarity is lower than 0.7, and the average relative error is greater than 10%, and the correlation value is lower than 0.7, it can be determined that the initialization detection model is not suitable for water environment monitoring in the target area. Therefore, the network parameters need to be adjusted; otherwise, the initialization detection model is used as the water environment multi-parameter detection model.
[0113] A water environment detection method provided in this embodiment determines that the initialization detection model needs to adjust the network parameters by comparing the spectral feature similarity, the average relative error and the correlation value of the test results of water environment parameters and the predicted results of water environment parameters with the corresponding preset thresholds, realizes the determination of whether the initialization detection model fully meets the water environment monitoring accuracy requirements of the field-deployed equipment, and further lays a foundation for adjusting the network parameters of the initialization detection model, improving the detection accuracy of the water environment multi-parameter detection model.
[0114] Step S4033: If the initialization detection model needs to adjust the network parameters, then adjust the network parameters of the initialization detection model based on the spectral test data set to obtain a water environment multi-parameter detection model.
[0115] Specifically, if the initialization detection model needs to adjust the network parameters, then freeze the backward neural network layer, and adjust the network parameters corresponding to the fully connected layer based on the spectral test data set to obtain a water environment multi-parameter detection model.
[0116] Further, for the neural network layer after freezing, the prerequisite for training the fully connected layer is defaulted to that the water environment feature part has been fully recognized and extracted by the initialized detection model. However, there are certain differences when determining the weight coefficients for different spectral feature information. Therefore, adjustment is required in the field scenario. Furthermore, a small amount of new water sample data and ground truth labels collected within three months are used to train the fully connected layer.
[0117] Further, in special cases, the backward neural network layer of the initialized detection model can be selected for training, and the subsequent fully connected layer is frozen. The prerequisite is defaulted to that the feature part of the water environment in the target area has not been fully recognized and extracted. Therefore, it is necessary to learn the spectral feature information of this area.
[0118] Step S404: Collect real-time spectral data and input the real-time spectral data into the water environment multi-parameter detection model to obtain the water environment detection result. For details, please refer to Figure 2 Step S204 of the illustrated embodiment, which will not be elaborated here.
[0119] A water environment detection method provided in this embodiment utilizes the empirical knowledge in the initialized detection model and improves the detection performance of the water environment multi-parameter detection model by adjusting the network parameters of the initialized detection model. Moreover, by adjusting the network parameters of the initialized detection model with the spectral test data set, the problem of automatic calibration of model parameters is solved, providing a constructive technical route and thinking for truly and effectively promoting the spectral detection equipment, such as water quality detection equipment and sediment content detection equipment, for real-time online deployment, unattended operation in the wild, and equipment-free calibration.
[0120] In this embodiment, a water environment detection device is also provided. This device is used to implement the above-mentioned embodiment and preferred implementation manners, and those that have been described will not be elaborated again. As used hereinafter, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0121] This embodiment provides a water environment detection device, as Figure 5 shown, including:
[0122] A construction module 501, configured to collect water environment parameters of a target area and construct a spectral training data set and a spectral test data set based on the water environment parameters;
[0123] A training module 502, configured to construct a deep learning network model and pre-train the deep learning network model based on the spectral training data set to obtain an initialized detection model;
[0124] An adjustment module 503, configured to adjust parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter detection model for water environment;
[0125] A detection module 504, configured to collect real-time spectral data and input the real-time spectral data into the multi-parameter detection model for water environment to obtain a water environment detection result.
[0126] In some alternative embodiments, the training module 502 includes:
[0127] A convolution unit, configured to construct a spectral vector matrix based on the spectral training data set, and perform backward convolution processing using a backward neural network layer based on the spectral vector matrix to obtain spectral feature information;
[0128] A first calculation unit, configured to input the spectral feature information into a fully connected layer to obtain a weight coefficient corresponding to the spectral feature information;
[0129] A determination unit, configured to determine a water environment fitting value based on the spectral feature information and the weight coefficient;
[0130] A second calculation unit, configured to calculate a loss function value based on the water environment parameters and the water environment fitting value, and adjust the weight coefficient based on the loss function value to obtain the initialized detection model.
[0131] In some alternative embodiments, the training module 502 further includes:
[0132] A storage unit, configured to store the spectral feature information and the weight coefficient into a spectral feature library.
[0133] In some alternative embodiments, the adjustment module 503 includes:
[0134] A generation unit, configured to input the spectral test data set into the initialized detection model to generate a prediction result of water environment parameters;
[0135] A judgment unit, configured to judge whether the initialized detection model needs to perform network parameter adjustment based on the prediction result of water environment parameters;
[0136] An adjustment unit, configured to, if the initialized detection model needs to perform network parameter adjustment, perform network parameter adjustment on the initialized detection model based on the spectral test data set to obtain a multi-parameter detection model for water environment.
[0137] In some alternative embodiments, the judgment unit includes:
[0138] A generation subunit, configured to input the spectral test data set into a backward neural network to obtain a spectral feature vector;
[0139] A calculation subunit, configured to calculate a spectral feature similarity based on a spectral feature vector and spectral feature information in a spectral feature library;
[0140] A determination subunit, configured to determine a water environment parameter test result based on a spectral test data set, and calculate an average relative error and a correlation value based on the water environment parameter test result and a water environment parameter prediction result;
[0141] An adjustment subunit, configured to initialize that network parameters of a detection model need to be adjusted if the spectral feature similarity is less than a first preset threshold, the average relative error is greater than a second preset threshold, and the correlation value is less than a third threshold.
[0142] In some optional embodiments, the adjustment unit is specifically configured to, if the network parameters of the initialization detection model need to be adjusted, freeze the backward neural network layer, and adjust the network parameters corresponding to the fully connected layer based on the spectral test data set to obtain a water environment multi-parameter detection model.
[0143] The further function descriptions of the above-mentioned various modules and units are the same as those in the corresponding embodiments above, and will not be repeated here.
[0144] A water environment detection device in this embodiment is presented in the form of functional units. Here, the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0145] An embodiment of the present invention further provides a computer device having the above Figure 5 shown water environment detection device.
[0146] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of a computer device provided by an optional embodiment of the present invention. As shown in Figure 6As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including a high-speed interface and a low-speed interface. Each component communicates and connects with each other using different buses and can be installed on a common motherboard or in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (such as an array of servers, a set of blade servers, or a multi-processor system). Figure 6 In the figure, a processor 10 is taken as an example.
[0147] The processor 10 can be a central processing unit, a network processor, or a combination thereof. Among them, the processor 10 can further include a hardware chip. The above-mentioned hardware chip can be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The above-mentioned programmable logic device can be a complex programmable logic device, a field-programmable gate array, a generic array logic, or any combination thereof.
[0148] Among them, the memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiments.
[0149] The memory 20 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the computer device, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 can optionally include a memory remotely set relative to the processor 10, and these remote memories can be connected to the computer device through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0150] The memory 20 can include a volatile memory, such as a random access memory; the memory can also include a non-volatile memory, such as a flash memory, a hard disk, or a solid-state drive; the memory 20 can also include a combination of the above types of memories.
[0151] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or communication networks.
[0152] Embodiments of the present invention also provide a computer-readable storage medium. The method according to the embodiments of the present invention can be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented as computer code that is originally stored in a remote storage medium or a non-transitory machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored as such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.
[0153] A part of the present invention can be applied as a computer program product, such as computer program instructions, which when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should be able to understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Herein, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0154] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A water environment detection method, characterized in that, The method includes: Collecting water environment parameters of a target area, and constructing a spectral training data set and a spectral test data set based on the water environment parameters; Constructing a deep learning network model, and pre-training the deep learning network model based on the spectral training data set to obtain an initialized detection model; Adjusting parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model; Collecting real-time spectral data, and inputting the real-time spectral data into the multi-parameter water environment detection model to obtain a water environment detection result; Adjusting parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model, including: Inputting the spectral test data set into the initialized detection model to generate a predicted result of water environment parameters; Judging whether the initialized detection model needs to adjust network parameters based on the predicted result of water environment parameters; If the initialized detection model needs to adjust network parameters, adjusting the network parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model; Judging whether the initialized detection model needs to adjust network parameters based on the predicted result of water environment parameters, including: Inputting the spectral test data set into a backward neural network to obtain a spectral feature vector; Calculating a spectral feature similarity based on the spectral feature vector and spectral feature information in a spectral feature library; Determining a test result of water environment parameters based on the spectral test data set, and calculating an average relative error and a correlation value based on the test result of water environment parameters and the predicted result of water environment parameters; If the spectral feature similarity is less than a first preset threshold, the average relative error is greater than a second preset threshold, and the correlation value is less than a third threshold, the initialized detection model needs to adjust network parameters.
2. The method according to claim 1, wherein The deep learning network model is composed of a backward neural network layer and a fully connected layer; constructing the deep learning network model, and pre-training the deep learning network model based on the spectral training data set to obtain an initialized detection model, including: Constructing a spectral vector matrix based on the spectral training data set, and performing backward convolution processing on the spectral vector matrix by using the backward neural network layer to obtain spectral feature information; Inputting the spectral feature information into the fully connected layer to obtain weight coefficients corresponding to the spectral feature information; Determining a water environment fitting value based on the spectral feature information and the weight coefficients; Calculating a loss function value based on the water environment parameters and the water environment fitting value, and adjusting the weight coefficients based on the loss function value to obtain the initialized detection model.
3. The method according to claim 2, wherein Constructing the deep learning network model, and pre-training the deep learning network model based on the spectral training data set to obtain an initialized detection model, further including: Storing the spectral feature information and the weight coefficients into a spectral feature library.
4. The method according to claim 2, wherein If the initialized detection model needs to adjust network parameters, adjusting the network parameters of the initialized detection model based on the spectral test data set to obtain a multi-parameter water environment detection model, including: If the initialization detection model needs to adjust network parameters, freeze the backward neural network layer, and adjust the network parameters corresponding to the fully connected layer based on the spectral test data set to obtain the multi-parameter water environment detection model.
5. A water environment detection device, characterized in that, The device includes: A construction module, configured to collect water environment parameters of a target area and construct a spectral training data set and a spectral test data set based on the water environment parameters; A training module, configured to construct a deep learning network model and pre-train the deep learning network model based on the spectral training data set to obtain an initialization detection model; An adjustment module, configured to adjust the parameters of the initialization detection model based on the spectral test data set to obtain a multi-parameter water environment detection model; A detection module, configured to collect spectral real-time data and input the spectral real-time data into the multi-parameter water environment detection model to obtain a water environment detection result; The adjustment module includes: A generation unit, configured to input the spectral test data set into the initialization detection model to generate a prediction result of water environment parameters; A judgment unit, configured to judge whether the initialization detection model needs to adjust network parameters based on the prediction result of water environment parameters; An adjustment unit, configured to, if the initialization detection model needs to adjust network parameters, adjust the network parameters of the initialization detection model based on the spectral test data set to obtain a multi-parameter water environment detection model; The judgment unit includes: A generation sub-unit, configured to input the spectral test data set into the backward neural network to obtain a spectral feature vector; A calculation sub-unit, configured to calculate a spectral feature similarity based on the spectral feature vector and the spectral feature information in the spectral feature library; A determination sub-unit, configured to determine a water environment parameter test result based on the spectral test data set, and calculate an average relative error and a correlation value based on the water environment parameter test result and the prediction result of water environment parameters; An adjustment sub-unit, configured to, if the spectral feature similarity is less than a first preset threshold, the average relative error is greater than a second preset threshold, and the correlation value is less than a third threshold, the initialization detection model needs to adjust network parameters.
6. A computer device, characterized in that, It includes: A memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the water environment detection method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, Computer instructions are stored on the computer-readable storage medium, and the computer instructions are used to cause a computer to execute the water environment detection method according to any one of claims 1 to 4.
8. A computer program product, characterized in that, It includes computer instructions, and the computer instructions are used to cause a computer to execute the water environment detection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Seawater comprehensive spectrum ecological parameter rapid monitoring method based on cross neural network
CN116434866A