Water Quality Image Analysis Method, System, Device and Medium Based on Deep Learning
The restricted Boltzmann machine model enhances water quality image analysis by dynamically determining pixel weights, improving speed and accuracy through noise filtering and pixel normalization, addressing the limitations of existing static image analysis methods.
Patent Information
- Application Number
- CN202180004731.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-16
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-04-16
AI Technical Summary
The existing water quality image analysis methods cannot perform dynamic image analysis, and their anti-interference ability is weak, resulting in inaccurate detection results, slow speed and low efficiency.
The restricted Boltzmann machine model based on deep learning is adopted to dynamically obtain the weight value of each pixel point, and combine the weighted averaging method, noise detection and filtering processing to perform grayscale and abnormal judgment to achieve accurate image processing.
It improves the accuracy and speed of image analysis, enhances the anti-interference ability, and ensures the accuracy and efficiency of water quality analysis.
Smart Images

Figure CN114207665B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of water quality analysis, and particularly relates to a water quality image analysis method, system, device and medium based on deep learning. Background Art
[0002] Water quality monitoring is a process of monitoring and measuring the types of pollutants in water bodies, the concentrations of various pollutants and their changing trends, and evaluating the water quality status. The monitoring scope is very wide, mainly including the monitoring of water pollution / status in fields such as industrial enterprises and the discharge outlets of river and lake basins.
[0003] At present, there are mainly two forms of water pollution monitoring: one is to determine whether there is pollution or a specific state of water quality through water quality component detection. The monitoring system has a high cost, a complex system, and a high usage cost; the other is to judge whether there is an abnormal situation by analyzing the color, impurities or defects of the measured object through static sampling images. This judgment method cannot perform dynamic image analysis, and the image analysis has weak anti-interference ability, resulting in problems such as inaccurate detection results, slow speed, and low efficiency. Summary of the Invention
[0004] The purpose of the present invention is to provide a water quality image analysis method, system, device and medium based on deep learning for the problems in the prior art that the water quality image analysis method cannot perform dynamic image analysis, has weak anti-interference ability, and results in inaccurate detection results, slow speed and low efficiency.
[0005] The present invention solves the above technical problems through the following technical solutions: A water quality image analysis method based on deep learning includes the following steps:
[0006] Step 1: Obtain multiple historical water body color images, and obtain a data set {θ|R, G, B, W R , W G , W B} from the multiple historical water body color images. Among them, R, G, and B respectively represent the three color component values of each pixel point in the historical water body color image, and W R , W G , W B respectively represent the weight values corresponding to the three color component values R, G, and B of the corresponding pixel point;
[0007] Step 2: Establish a restricted Boltzmann machine model, and use the data set {θ|R, G, B, W R , W G , W B} as the training sample of the restricted Boltzmann machine model to train it. Among them, use {R, G, B} as the training input sample, and use {W R , W G , WB} As the training output sample, a trained restricted Boltzmann machine model is obtained;
[0008] Step 3: Obtain multiple consecutive colored water body images;
[0009] Step 4: Input the three color component values R’, G’, and B’ of each pixel point in each of the colored water body images in Step 3 into the trained restricted Boltzmann machine model to obtain the weight values W R ’, W G ’, W B ’ corresponding to the three color component values R’, G’, and B’ of the corresponding pixel point;
[0010] Step 5: According to the weight values W R ’, W G ’, W B ’ corresponding to the three color component values R’, G’, and B’ of each pixel point in Step 4, use the weighted average method to calculate the gray value P’ of each pixel point in each water body image, and perform graying processing on each of the colored water body images;
[0011] Step 6: Perform noise detection and filtering processing on the grayed water body images;
[0012] Step 7: Perform anomaly judgment on the filtered water body images to eliminate the influence of the defects of the water body images themselves on water quality analysis;
[0013] Step 8: Determine the time interval according to the sedimentation velocity of the pollutant, and judge whether the gray value of each pixel point in the anomaly-free water body images within the time interval exceeds the corresponding mean value ±△δ. If it exceeds, assign the corresponding mean value to the pixel point to achieve the normalization processing of each pixel point in all the anomaly-free water body images within the time interval;
[0014] The corresponding mean value refers to the average value of the gray values of all the same pixel points in the anomaly-free multiple consecutive water body images corresponding to the pixel point within the time interval;
[0015] Step 9: According to the gray value of each pixel point in each of the water body images, obtain the light transmittance and the reflected light intensity of the water body image; and then perform water quality analysis according to the light transmittance and the reflected light intensity.
[0016] In the present invention, when performing water quality image analysis, the weight value of each pixel is dynamically obtained according to the restricted Boltzmann machine model, rather than uniformly using a fixed weight value, so that the grayscale image can more accurately reflect the image distribution and characteristics, thereby improving the accuracy of subsequent water quality analysis; the anti-interference ability of the image is improved through noise detection and filtering, the image analysis speed is increased, and the accuracy of water quality analysis is further improved; the dynamic image error is eliminated through the judgment and elimination of abnormal images, and the accuracy of water quality analysis is further improved; the accuracy of dynamic image information is improved through the normalization processing of each pixel.
[0017] Further, in step 1, the weight values W R 、W G 、W B corresponding to the three color component values R, G, and B are determined as follows:
[0018] Step 1.1: Set the weight values W R 、W G 、W B corresponding to the three color component values R, G, and B of each pixel in each of the historical water body color images;
[0019] Step 1.2: Perform grayscale processing on each of the historical water body color images by using the weighted average method to obtain the grayscale value P of each pixel in each of the historical water body images;
[0020] Step 1.3: Perform noise detection and filtering on the grayscale historical water body images;
[0021] Step 1.4: Obtain the lowest light transmittance intensity or the highest light reflection intensity according to the grayscale value P of each pixel in each of the historical water body images, and calculate the first difference between the lowest light transmittance intensity and the light transmittance intensity of the standard sample, or calculate the first difference between the highest light reflection intensity and the light reflection intensity of the standard sample;
[0022] Step 1.5: Compare the first difference with a preset difference to determine whether there is an abnormality in each of the historical water body images; when the first difference exceeds the preset difference, there is an abnormality, and adjust the corresponding weight values W R 、W G 、W B , and repeat steps 1.2 to 1.5 until there is no abnormality in the historical water body images, and determine the weight values W B 、W G 、W B .
[0023] Further, in step 3, an image acquisition unit is used to obtain multiple consecutive color images of the water body. The image acquisition unit is arranged on the side of the storage tank containing the water body sample, and light sources are provided at the bottom and / or around the storage tank.
[0024] Further, in step 5, the calculation formula for the gray value P’ of each pixel is:
[0025] P′ = W R ′R + W G ′G + W B ′B
[0026] where P′ represents the gray value of each pixel in the water body image, R’, G’, B’ represent the three color component values of the corresponding pixel, and W R ’, W G ’, W B ’ represent the weight values corresponding to the three color component values R’, G’, B’ of the corresponding pixel.
[0027] Further, in step 6, the local extreme value method is used for image noise detection, and the median filtering method is used for filtering processing.
[0028] Further, in step 7, the specific implementation process of water body image abnormality judgment is as follows:
[0029] Step 7.1: Perform the first abnormality judgment on each water body image according to the gray value P’ of each pixel in each water body image. If the water body image is abnormal, go to step 7.2 for the second abnormality judgment; if all water body images are normal, go to step 8;
[0030] Step 7.2: When the moving distance of the same pixel in multiple water body images within the time interval exceeds the corresponding set range, and the gray values of multiple pixels in a certain area of a certain water body image exceed the first set threshold, it indicates that the water body image is abnormal, and these multiple water body images and this one water body image are excluded;
[0031] Or, when the gray value of a certain pixel in a certain water body image exceeds the second set threshold, it indicates that this water body image is abnormal, and this water body image is excluded;
[0032] Or, when the gray values of multiple pixels in a certain area of a certain water body image exceed the first set threshold, it indicates that this water body image is abnormal, and this water body image is excluded;
[0033] The time interval refers to the time difference between the acquisition time of the first water body image and the last water body image among multiple water body images.
[0034] Further, in step 7.1, the specific implementation process of the first abnormal judgment of the water body image is as follows:
[0035] Step 7.1: Obtain the lowest light transmittance intensity or the highest reflected light intensity according to the gray value P' of each pixel point in each water body image, and calculate the second difference between the lowest light transmittance intensity and the standard sample light transmittance intensity, or calculate the second difference between the highest reflected light intensity and the standard sample reflected light intensity;
[0036] Step 7.2: Compare the second difference with a preset difference. If the second difference exceeds the preset difference, the water body image is abnormal; otherwise, the water body image is normal.
[0037] Further, the method further includes the step of retraining the restricted Boltzmann machine model, and the specific implementation process is as follows:
[0038] Use the data set obtained from the non-abnormal water body images and historical water body images after the abnormal judgment in step 7 as the training samples to train the restricted Boltzmann machine model.
[0039] The richer the training samples are, the more accurate the model training is. When analyzing, the weight values W R 、W G 、W B obtained by the model are more accurate, which further improves the accuracy of image processing and the accuracy of water quality analysis.
[0040] The present invention also provides a water quality image analysis system based on deep learning, including:
[0041] A data set acquisition unit for acquiring multiple historical water body color images, and obtaining a data set {θ|R, G, B, W R , W G , W B} from the multiple historical water body color images, where R, G, and B respectively represent the three color component values R, G, and B of each pixel point in the historical water body color image, and W R , W G , W B respectively represent the weight values corresponding to the three color component values R, G, and B of the corresponding pixel points;
[0042] A model establishment and training unit for establishing a restricted Boltzmann machine model, and using the data set {θ|R, G, B, W R , W G , W B} as the training samples of the restricted Boltzmann machine model to train it, where {R, G, B} is used as the training input samples, and {W R , W G,W B} As the training output sample, a trained restricted Boltzmann machine model is obtained;
[0043] A real-time image acquisition unit for acquiring multiple consecutive color water body images;
[0044] A grayscale processing unit for inputting the three color component values R’, G’, and B’ of each pixel point of each of the color water body images into the trained restricted Boltzmann machine model to obtain the weight values W corresponding to the three color component values R’, G’, and B’ of the corresponding pixel point R ’,W G ’,W B ’. The weighted average method is used to calculate the grayscale value P’ of each pixel point of each water body image;
[0045] A filtering processing unit for performing noise detection and filtering processing on the water body image after grayscale processing;
[0046] A first anomaly judgment unit for performing a first anomaly judgment on each of the water body images after filtering processing according to the grayscale value P’ of each pixel point in each of the water body images. If the water body image is abnormal, it is transferred to the second anomaly judgment unit for a second anomaly judgment; if all water body images are normal, it is transferred to the normalization processing unit for pixel normalization processing;
[0047] A second anomaly judgment unit for when the moving distance of the same pixel point within the time interval in multiple water body images exceeds the corresponding set range, and the grayscale values of multiple pixel points within a certain area in a certain water body image exceed the first set threshold, it indicates that the water body image is abnormal, and these multiple water body images and this one water body image are excluded;
[0048] Or, when the grayscale value of a certain pixel point in a certain water body image exceeds the second set threshold, it indicates that this water body image is abnormal, and this water body image is excluded;
[0049] Or, when the grayscale values of multiple pixel points within a certain area in a certain water body image exceed the first set threshold, it indicates that this water body image is abnormal, and this water body image is excluded;
[0050] The time interval refers to the acquisition time difference between the first water body image and the last water body image in multiple water body images;
[0051] A normalization processing unit for determining a time interval according to the sedimentation rate of pollutants, and judging whether the grayscale value of each pixel point in the abnormal-free water body images within the time interval exceeds the corresponding mean value ±△δ. If it exceeds, the corresponding mean value is assigned to this pixel point to achieve pixel normalization processing for all abnormal-free water body images within the time interval;
[0052] The corresponding mean value refers to the average value of the gray values of all the same pixel points in multiple consecutive water body images without anomalies within the time interval corresponding to the pixel point.
[0053] A water quality analysis unit, which is used to obtain the light transmission intensity and reflection light intensity of the water body image according to the gray value of each pixel point in each water body image; and then perform water quality analysis according to the light transmission intensity and reflection light intensity.
[0054] The present invention also provides a device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the above-mentioned water quality image analysis method based on deep learning is implemented.
[0055] The present invention also provides a medium, on which a computer program is stored. When the program is executed by a processor, the above-mentioned water quality image analysis method based on deep learning is implemented.
[0056] Beneficial effects
[0057] Compared with the prior art, the advantages of the present invention are as follows:
[0058] 1. The weight value of each pixel point is dynamically obtained according to the restricted Boltzmann machine model, rather than uniformly using a fixed weight value, so that the image after grayscale processing can more accurately reflect the image distribution and features, thereby improving the accuracy of subsequent water quality analysis;
[0059] 2. By noise detection and filtering, the anti-interference ability of the image is improved, the image analysis speed is increased, and the accuracy of water quality analysis is further improved;
[0060] 3. By judging and eliminating abnormal images, dynamic image errors are eliminated, and the accuracy of water quality analysis is further improved;
[0061] 4. By normalizing each pixel point, the accuracy of dynamic image information is improved. Description of the drawings
[0062] In order to more clearly illustrate the technical solutions of the present invention, the accompanying drawings required for the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only one embodiment of the present invention. For those of ordinary skill in the art, other accompanying drawings can be obtained based on these drawings without creative efforts.
[0063] Figure 1 It is a flowchart of a water quality image analysis method based on deep learning in Embodiment 1 of the present invention;
[0064] Figure 2It is the flow chart of the first image anomaly judgment in Embodiment 1 of the present invention;
[0065] Figure 3 It is the flow chart of the first implementation manner of the second image anomaly judgment in Embodiment 1 of the present invention;
[0066] Figure 4 It is the flow chart of the second implementation manner of the second image anomaly judgment in Embodiment 1 of the present invention;
[0067] Figure 5 It is the flow chart of the third implementation manner of the second image anomaly judgment in Embodiment 1 of the present invention;
[0068] Figure 6(a) - Figure 6(e) It is the result of processing the normal image in Embodiment 2 of the present invention through the analysis method described in Embodiment 1. Among them, Fig. 6(a) is the original normal image, Fig. 6(b) is the fixed-weight grayscale image, Fig. 6(c) is the variable-weight grayscale image, Fig. 6(d) is the image after dynamic image averaging without the first / second anomaly processing, and Fig. 6(e) is the image after dynamic image averaging with the first / second anomaly processing;
[0069] Figure 7(a) - Figure 7(e) It is the result of processing the abnormal image in Embodiment 2 of the present invention through the analysis method described in Embodiment 1. Among them, Fig. 7(a) is the original abnormal image, Fig. 7(b) is the fixed-weight grayscale image, Fig. 7(c) is the variable-weight grayscale image, Fig. 7(d) is the image after dynamic image averaging without the first / second anomaly processing, and Fig. 7(e) is the image after dynamic image averaging with the first / second anomaly processing. Detailed implementation manner
[0070] Combined with the attached drawings in the embodiments of the present invention below, the technical solutions in the present invention are clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present invention.
[0071] Embodiment 1
[0072] As Figure 1 shown, a water quality image analysis method based on deep learning provided in this embodiment includes the following steps:
[0073] 1. Obtain training samples
[0074] Obtain multiple historical water body color images, and obtain the data set {θ|R, G, B, W R , W G , W B}, where R, G, and B respectively represent the three color component values of each pixel point in the historical water body color image, and W R 、W G 、W B respectively represent the weight values corresponding to the three color component values R, G, and B of the corresponding pixel point.
[0075] In this embodiment, the weight values W R 、W G 、W B corresponding to the three color component values R, G, and B are determined as follows:
[0076] Step 1.1: Set the weight values corresponding to the three color component values R, G, and B of each pixel point in each historical water body color image as W R 、W G 、W B .
[0077] Initially, the weight values are set, and then it is determined whether the set weight values meet the requirements through the gray value. If they do not meet the requirements, the weight values are adjusted until they meet the requirements.
[0078] Step 1.2: Use the weighted average method to grayscale each historical water body color image to obtain the gray value P of each pixel point in each historical water body image. The specific calculation formula is:
[0079] P = W R R + W G G + W B B
[0080] S.T. W R + W G + W B = 1
[0081] Step 1.3: Perform noise detection and filtering on the grayscale historical water body image.
[0082] In this embodiment, local extreme value method is used for noise detection. After grayscaling, random black and white dots are shown on the historical water body image. The gray values of these black and white dots are quite different from those of other surrounding pixel points. That is, noise detection is achieved by detecting the maximum or minimum gray value of pixel points in a local area to obtain the noise pollution situation and noise distribution.
[0083] In this embodiment, median filtering method is used for filtering. Specifically: Determine the size of the filtering window according to the noise pollution situation of each area in the image, take a rectangular frame according to the size of the filtering window with each noise point as the center, and perform median filtering on this noise point.
[0084] Step 1.4: Obtain the lowest light transmittance intensity or the highest reflected light intensity based on the gray value P of each pixel point in each historical water body image, and calculate the first difference between the lowest light transmittance intensity and the standard sample light transmittance intensity, or calculate the first difference between the highest reflected light intensity and the standard sample reflected light intensity.
[0085] In this embodiment, there are two ways to judge whether the historical water body image is abnormal. One is based on the lowest light transmittance intensity, and the other is based on the highest reflected light intensity. When performing water quality analysis, these two judgment methods are also used for the first abnormal judgment (Step 7) of the water body image.
[0086] When the image acquisition unit, such as a camera, acquires the water body image in the storage tank, light sources are provided at the bottom and / or around the storage tank. When the light source is arranged at the bottom, the lowest light transmittance intensity P2 is obtained based on the gray value P of each pixel point in the historical water body image, and the first difference k between the lowest light transmittance intensity P2 and the standard sample light transmittance intensity P1 is calculated j , that is, k j = P1 - P2.
[0087] When the light source is arranged in a ring shape, the highest reflected light intensity P4 is obtained based on the gray value P of each pixel point in the historical water body image, and the first difference k between the highest reflected light intensity P4 and the standard sample reflected light intensity P3 is calculated i , that is, k i = P4 - P3.
[0088] Step 1.5: Compare the first difference k j or k i with the preset difference k max to judge whether each historical water body image is abnormal; when the first difference k j or k i exceeds the preset difference k max , there is an abnormality, and the corresponding weight values W R , W G , W B are adjusted, and Steps 1.2 to 1.5 are repeated until there is no abnormality in the historical water body image, and the weight values W R , W G , W B corresponding to the three color component values R, G, and B of each pixel point are determined.
[0089] In this embodiment, pure water is used as the standard sample. The light transmittance intensity P1 is analyzed to be 80%, and the reflected light intensity P3 is 2%. The water body sample when the solution sample with a dilution factor of 125 times is arranged at the bottom of the light source is analyzed, and its lowest light transmittance intensity P2 is 66%. The water body sample when the sample with a suspended matter of 100 mg / L is arranged in a ring around the light source is analyzed, and its highest reflected light intensity P4 is 43%. The specific data are shown in Table 1 and Table 2 respectively.
[0090] Table 1 Analysis data table of dilution factor samples when the light source is arranged at the bottom
[0091] Serial number Sample category Concentration Transmittance intensity 1 Purified water None 80% 2 Diluted solution 125 times 66%
[0092] Table 2 Analysis data table of suspended matter samples when the light source is arranged in a ring
[0093] Serial number Sample category Concentration Reflected light intensity 1 Purified water None 2% 2 Water body with suspended matter 100mg / L 43%
[0094] In this embodiment, a preset difference k max is set to 5%. Based on this, it is judged whether the historical water body image is abnormal and whether the corresponding weight value W R 、W G 、W B needs to be adjusted. Each pixel point corresponds to a set of {R, G, B, W R , W G , W B}. Each historical water body image has multiple pixel points, and there are multiple historical water body images, thus constituting a dataset {θ | R, G, B, W R 、W G 、W B} of the weight values W R , W G , W B corresponding to the three color component values R, G, and B. A large amount of data is obtained as the training samples for the subsequent restricted Boltzmann machine model. The richer the training samples, the higher the model training accuracy.
[0095] The preset difference is the difference between the gray value of the standard dischargeable water body and the gray value of the polluted water body reaching the recognizable limit, and is generally set to 5%.
[0096] 2. Establishment and training of the restricted Boltzmann machine model
[0097] The restricted Boltzmann machine RBM is a stochastic generative neural network that can learn the probability distribution through the input dataset. This model includes a visible layer and a hidden layer. The visible layer and the hidden layer are composed of multiple neurons, and the neurons are computational nodes. Let the input vector of the visible layer nodes be v, and the input vector of the hidden layer nodes be h. Let there be m nodes in the visible layer, and the input of the j-th node is represented by v j ; there are n nodes in the hidden layer, and the input of the i-th node is represented by hi representation
[0098] Let the visible vector v = (v1, v2…, v m ) T , and the hidden vector h = (h1, h2…, h n ) T . Select the sigmoid function as the activation function for all visible and hidden nodes of the RBM, that is 1 ≤ i ≤ n, v j ∈ {0, 1}, h i ∈ {0, 1}. E P (·) represents the mathematical expectation with respect to the distribution p, and p((h)|v l , θ′) represents the conditional probability distribution of the hidden vector when the visible vector is v (l) .
[0099] The allocation model of the weight values W R , W G , W B is as follows:
[0100]
[0101] where ω ij is the connection weight, a j is the bias of the visible layer, b j is the bias of the hidden layer, θ′ = {W R , W G , W B}}. Substitute the R, G, and B of each pixel point into the model in reverse to obtain the weight values W R , W G , W B , and complete the judgment process based on the RBM learning algorithm.
[0102] After the model is established, use the data set {θ|R, G, B, W R , W G , W B} as the training samples of the restricted Boltzmann machine model to train it. Among them, use {R, G, B} as the training input samples and {W R , W G , W B} as the training output samples to obtain the trained restricted Boltzmann machine model for subsequent application in water quality analysis.
[0103] 3. Obtain multiple consecutive color images of water bodies.
[0104] An image acquisition unit (such as a camera or a high-definition camera) is used to obtain multiple consecutive color images of water bodies. The image acquisition unit is arranged on the side of a storage tank containing water body samples. Light sources are provided at the bottom and / or around the storage tank. The storage tank is made of transparent acrylic material. The images acquired by the image acquisition unit are sent to a computer device or a controller, and subsequent processing and analysis are carried out by the computer device or the controller. The above steps 1 and 2 are also implemented in the computer device or the controller.
[0105] In this embodiment, the acquisition speed of the image acquisition unit is [number of images] / 100ms.
[0106] 4. Obtain weight values from the model
[0107] Input the three color component values R’, G’, and B’ of each pixel point in each color image of the water body in step 3 into the trained restricted Boltzmann machine model, and the corresponding weight values W R ’, W G ’, W B ’ can be obtained. To achieve high adaptability between high-speed dynamic images and the actual environment, the weight values are not fixed values, but are adaptively obtained by the restricted Boltzmann machine model according to each set of input color component values R’, G’, B’ to obtain the corresponding W R ’, W G ’, W B ’.
[0108] 5. Grayscale processing
[0109] According to the weight values W R ’, W G ’, W B ’ corresponding to the three color component values R’, G’, and B’ of each pixel point in step 4, the weighted average method is used to calculate the grayscale value P’ of each pixel point in each water body image, and each of the color images of the water body is subjected to grayscale processing.
[0110] Specifically, the calculation formula for the grayscale value P’ of each pixel point is:
[0111] P′ = W R ′R + W G ′G + W B ′B
[0112] where P′ represents the grayscale value of each pixel point in the water body image, R’, G’, and B’ represent the three color component values of the corresponding pixel point, and W R ’, W G ’, W B ’ represents the weight values corresponding to the three color component values R’, G’, and B’ of the corresponding pixel point.
[0113] 6. Noise Detection and Filtering
[0114] Perform noise detection and filtering on the grayscale water body image. Similar to step 1.3, local extreme value method is used for noise detection and median filtering method is used for filtering.
[0115] 7. First Image Abnormality Judgment
[0116] For the filtered water body image, perform abnormality judgment on each water body image according to the gray value P' of each pixel point in each water body image. If the water body image is abnormal, go to step 8; if all water body images are normal, go to step 10.
[0117] In this embodiment, the abnormality judgment of the water body image is the same as steps 1.4 and 1.5. The specific steps are as follows:
[0118] Step 7.1: Obtain the lowest light transmittance intensity or the highest reflected light intensity according to the gray value P' of each pixel point in each water body image, and calculate the second difference between the lowest light transmittance intensity and the light transmittance intensity of the standard sample, or calculate the second difference between the highest reflected light intensity and the reflected light intensity of the standard sample;
[0119] Step 7.2: Compare the second difference with the preset difference k max If the second difference exceeds the preset difference k max then the water body image is abnormal, otherwise the water body image is normal.
[0120] 8. Second Image Abnormality Judgment
[0121] To improve the accuracy of water quality analysis and avoid the influence of image abnormality on water quality analysis, this embodiment judges whether the image is abnormal from the aspects of time continuity and spatial continuity. If the water body is polluted, such as suspended solid pollution or whole water body pollution (the pollution particles are not static but moving), in terms of time continuity, it is impossible for the moving distance of the same pixel point in multiple consecutive images within the time interval to exceed the corresponding set range, nor is it possible for the gray value of a certain pixel point in a certain image among multiple consecutive images to mutate, that is, exceed the second set threshold; in terms of spatial continuity, it is impossible for the gray values of multiple pixel points in a certain area on an image to be higher than those in other areas, that is, exceed the first set threshold. The image is judged as an abnormal image by combining time continuity and spatial continuity, eliminating the image abnormality that may be caused by other reasons such as reflection, rather than the real pollution of the water body.
[0122] Specifically, as Figure 3As shown, when the moving distance of the same pixel point within the time interval in multiple consecutive water body images exceeds the corresponding set range, and the gray values of multiple pixel points within a certain area in a certain water body image exceed the first set threshold, it indicates that the water body image is abnormal, and these multiple water body images and this one water body image are excluded.
[0123] Or, as Figure 4 shown, when the gray value of a certain pixel point in a certain water body image G1 exceeds the second set threshold, it indicates that this water body image is abnormal, and this water body image G1 is excluded.
[0124] Or, as Figure 5 shown, when the gray values of multiple pixel points within a certain area in a certain water body image G2 exceed the first set threshold, it indicates that this water body image is abnormal, and this water body image G2 is excluded.
[0125] G1 and G2 can be the same image or two different images.
[0126] In this embodiment, the time interval t refers to the time difference between the acquisition times of the first water body image and the last water body image in multiple consecutive water body images. In order to improve the efficiency and accuracy of abnormal judgment, the time interval t is slightly less than the time required for suspended matter or particles to move from the water surface to the water bottom.
[0127] In this embodiment, the first set threshold is set to the mean value of the gray values of the same pixel point in consecutive images ±3%; the second set threshold is set to the mean value of the gray values of the same pixel point in consecutive images ±5%; the set range is set according to the water flow velocity and the particle limiting settling velocity formula to calculate the particle moving velocity, and is generally set to 4mm ±20%.
[0128] 9. Normalization processing of pixel points
[0129] After deleting the abnormal images, the remaining ones are all normal images, avoiding the influence of other non-pollution factors causing image abnormalities on the water quality analysis results. The obtained normal images, together with the historical normal images obtained in step 1, form a training image set, and from the training image set, a data set {θ|R, G, B, W R , W G , W B} is obtained. Using this data set {θ|R, G, B, W R , W G , W B} as training samples to train the restricted Boltzmann machine model again, the more training samples, the higher the model accuracy. Each time a water quality analysis is performed, normal images are used to train the model again, greatly improving the accuracy or precision of the model, enhancing the ability of the dynamic image to adapt to the actual environment, improving the accuracy of dynamic image information extraction, and thus improving the accuracy of subsequent water quality analysis.
[0130] To improve the accuracy of dynamic image information, the gray values of pixel points are normalized. The normalization process is as follows: Determine the time interval T according to the sedimentation velocity of pollutants, and judge whether the gray value of each pixel point in the abnormal water body image within the time interval T exceeds the corresponding mean value ±△δ. If it exceeds, assign the corresponding mean value to the pixel point to achieve the normalization of each pixel point in all abnormal water body images within the time interval.
[0131] Starting from the force analysis of a single spherical particle in a stationary fluid, the sedimentation velocity of suspended matter or sediment particles (referred to as the sedimentation velocity) uses the principle of force balance, and there is the following limit sedimentation velocity formula:
[0132]
[0133] Among them, ω d is the sedimentation velocity of sediment particles (spheres); C d is the drag coefficient; γ d is the sediment specific gravity; γ is the fluid (water) specific gravity; g is the acceleration due to gravity; d is the sediment particle diameter. According to the sedimentation velocity, combined with the distance from the water surface to the bottom, the time interval T can be obtained.
[0134] In this embodiment, the corresponding mean value refers to the average value of the gray values of all the same pixel points in multiple consecutive abnormal water body images within the time interval T corresponding to the pixel point. Suppose the number of consecutive abnormal water body images within the time interval T is 60. Then the gray value of the same pixel point on the 60 images is equal to the sum of the gray values of 60 pixel points divided by 60, that is, the corresponding mean value of the pixel point is obtained. Compare the pixel point on the 60 images with the corresponding mean value ±△δ. If it exceeds this range, assign the corresponding mean value to the pixel point that exceeds this range.
[0135] 10. Water quality analysis
[0136] According to the gray value of each pixel point in each water body image, the light transmittance and reflected light intensity of the water body image are obtained; then water quality analysis is performed according to the light transmittance and reflected light intensity.
[0137] Corresponding to the above-mentioned water quality image analysis method based on deep learning, this embodiment also provides a water quality image analysis system based on deep learning, including:
[0138] A dataset acquisition unit for acquiring multiple historical water body color images, and obtaining a dataset {θ|R, G, B, W R , W G , W B} from the multiple historical water body color images, where R, G, and B respectively represent the three color component values R, G, and B of each pixel point in the historical water body color image, and WR , W G , W B respectively represent the weight values corresponding to the three color component values R, G, and B of the corresponding pixel points.
[0139] The model establishment and training unit is used to establish a restricted Boltzmann machine model, and use the data set {θ | R, G, B, W R , W G , W B} as the training samples of the restricted Boltzmann machine model to train it. Among them, {R, G, B} is used as the training input samples, and {W R , W G , W B} is used as the training output samples to obtain the trained restricted Boltzmann machine model.
[0140] The real-time image acquisition unit is used to acquire multiple consecutive water body color images.
[0141] The grayscale processing unit is used to input the three color component values R’, G’, and B’ of each pixel point of each water body color image into the trained restricted Boltzmann machine model to obtain the weight values W R ’, W G ’, W B ’ corresponding to the three color component values R’, G’, and B’ of the corresponding pixel points, and use the weighted average method to calculate the grayscale value P’ of each pixel point of each water body image.
[0142] The filtering processing unit is used to perform noise detection and filtering processing on the water body image after grayscale processing.
[0143] The first anomaly judgment unit is used to perform the first anomaly judgment on each water body image after filtering processing according to the grayscale value P’ of each pixel point in each water body image. If the water body image has an anomaly, it will transfer to the second anomaly judgment unit for the second anomaly judgment; if all water body images have no anomaly, it will transfer to the normalization processing unit for pixel normalization processing.
[0144] The second anomaly judgment unit is used to indicate that the water body image is abnormal and eliminate the multiple water body images and the one water body image when the moving distance of the same pixel point in multiple water body images within a time interval exceeds the corresponding set range, and the grayscale values of multiple pixel points in a certain area of a certain water body image exceed the first set threshold;
[0145] Or, when the grayscale value of a certain pixel point in a certain water body image exceeds the second set threshold, it indicates that the water body image is abnormal and eliminates the water body image;
[0146] Alternatively, when the gray values of multiple pixel points in a certain area of a water body image exceed the first set threshold, it indicates that the water body image is abnormal, and this water body image is excluded;
[0147] The time interval refers to the time difference between the acquisition time of the first water body image and the last water body image among multiple water body images.
[0148] The normalization processing unit is used to determine a time interval according to the sedimentation rate of pollutants, and judge whether the gray value of each pixel point in the water body images without abnormality within the time interval exceeds the corresponding mean value ±△δ. If it exceeds, the corresponding mean value is assigned to the pixel point to achieve the normalization processing of each pixel point in all water body images without abnormality within the time interval;
[0149] The corresponding mean value refers to the average value of the gray values of all the same pixel points in multiple consecutive water body images without abnormality within the time interval corresponding to the pixel point.
[0150] The water quality analysis unit is used to obtain the light transmission intensity and reflection light intensity of the water body image according to the gray value of each pixel point in each water body image; and then perform water quality analysis according to the light transmission intensity and reflection light intensity.
[0151] Embodiment 2
[0152] Figure 6(a) - Figure 6(e) Shows the diagrams of each stage obtained after processing a normal water body image by using the analysis method described in Embodiment 1.
[0153] Among them, Fig. 6(b) is the fixed weight gray scale image, and Fig. 6(c) is the variable weight gray scale image. By comparing Fig. 6(b) and Fig. 6(c), it can be concluded that after image gray scale processing by using the variable weight method, the pixel points with inappropriate gray scale processing caused by light source fluctuation, environmental influence, etc. can be reduced, and the accuracy of subsequent water quality analysis can be improved; among them, Fig. 6(d) is the image without the first / second abnormal processing after the dynamic image mean value, and Fig. 6(e) is the image after the first / second abnormal processing after the dynamic image mean value. By comparing Fig. 6(d) and Fig. 6(e), it can be concluded that after the first / second abnormal processing, the interference caused by the sudden change of the gray value of the pixel points in the image caused by system noise, signal noise, etc. can be reduced, and the accuracy of water quality analysis is further improved.
[0154] Figure 7(a) - Figure 7(e) Shows the diagrams of each stage obtained after processing an abnormal water body image by using the analysis method described in Embodiment 1.
[0155] Among them, Fig. 7(b) is the grayscale image with fixed weights, and Fig. 7(c) is the grayscale image with variable weights. By comparing Fig. 7(b) and Fig. 7(c), it can be concluded that after image grayscale processing using the variable weight method, the pixel points with inappropriate grayscale processing caused by light source fluctuations, environmental impacts, etc. can be reduced, improving the accuracy of subsequent water quality analysis. Among them, Fig. 7(d) is the image without the first / second anomaly processing after dynamic image averaging, and Fig. 7(e) is the image after the first / second anomaly processing after dynamic image averaging. By comparing Fig. 7(d) and Fig. 7(e), it can be concluded that after the first / second anomaly processing, the interference caused by the sudden change of pixel grayscale in the image due to system noise, signal noise, etc. can be reduced, further improving the accuracy of water quality analysis.
[0156] The specific embodiments disclosed above are only for the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or variations, which should all be covered within the protection scope of the present invention.
Claims
1. A water quality image analysis method based on deep learning, characterized in that, Including the following steps: Step 1: Obtain multiple historical water body color images, and obtain a data set {θ|R, G, B, W R , W G , W B} from the multiple historical water body color images, where R, G, and B respectively represent the three color component values of each pixel point in the historical water body color image, and W R , W G , W B respectively represent the weight values corresponding to the three color component values R, G, and B of the corresponding pixel point; Step 2: Establish a restricted Boltzmann machine model, using the data set {θ|R, G, B, W R , W G , W B} as the training samples of the restricted Boltzmann machine model for training. Among them, using {R, G, B} as the training input samples and {W R , W G , W B} as the training output samples to obtain a trained restricted Boltzmann machine model; Step 3: Obtain multiple consecutive colored water body images; Step 4: Input the three color component values R′, G′, and B′ of each pixel point of each of the water body color images in Step 3 into the trained restricted Boltzmann machine model to obtain the weight values W R ′, W G ′, W B ′; Step 5: According to the weight values W R ′, W G ′, W B ′ corresponding to the three color component values R′, G′, B′ of each pixel in the said Step 4, calculate the gray value P’ of each pixel of each water body image by the weighted average method, and perform graying processing on each said water body color image; Step 6: Perform noise detection and filtering on the grayscale water body image; Step 7: Perform abnormality judgment on the filtered water body image to eliminate the influence of the defects of the water body image itself on water quality analysis; Step 8: Determine the time interval according to the sedimentation rate of the pollutant, and judge whether the gray value of each pixel point in the abnormal-free water body images within the time interval exceeds the corresponding mean value ±Δδ. If it exceeds, assign the corresponding mean value to the pixel point to achieve the normalization processing of each pixel point in all abnormal-free water body images within the time interval; The corresponding mean value refers to the average value of the gray values of all the same pixel points in the abnormal-free multiple consecutive water body images within the time interval corresponding to the pixel point; Step 9: Obtain the light transmittance intensity and the reflected light intensity of the water body image according to the gray value of each pixel point in each water body image; then perform water quality analysis according to the light transmittance intensity and the reflected light intensity.
2. The water quality image analysis method based on deep learning according to claim 1, characterized in that, In the said step 1, the determination steps for the weight values W R , W G , W B corresponding to the three color component values R, G, and B are as follows: Step 1.1: Set the weight values W R , W G , and W B corresponding to the three color component values R, G, and B of each pixel point in each of the historical water body color images. R 、W G 、W B ; Step 1.2: Perform grayscale processing on each historical colored water body image by using the weighted average method to obtain the gray value P of each pixel point in each historical water body image; Step 1.3: Perform noise detection and filtering on the grayscale historical water body image; Step 1.4: Obtain the lowest light transmittance intensity or the highest reflected light intensity according to the gray value P of each pixel point in each historical water body image, and calculate the first difference between the lowest light transmittance intensity and the light transmittance intensity of the standard sample, or calculate the first difference between the highest reflected light intensity and the reflected light intensity of the standard sample; Step 1.5: Compare the first difference with the preset difference to judge whether each historical water body image is abnormal; When the first difference exceeds the preset difference, there is an anomaly, and the corresponding weight values W R , W G , W B are adjusted. Repeat steps 1.2 to 1.5 until there is no anomaly in the historical water body image, and determine the weight values W R , W G , W B corresponding to the three color component values R, G, and B of each pixel point.
3. The water quality image analysis method based on deep learning according to claim 1, wherein, In the said Step 5, the calculation formula of the gray value P' of each pixel point is: P′ = W R ′R + W G ′G + W B ′B Among them, P′ represents the gray value of each pixel in the water body image, and R′, G′, B′ represent the three color component values of the corresponding pixel, and W R ′, W G ′, W B ′ represents the weight values corresponding to the three color component values R′, G′, B′ of the corresponding pixel.
4. The water quality image analysis method based on deep learning according to claim 1, wherein In the said Step 6, the local extreme value method is used for image noise detection, and the median filtering method is used for filtering processing.
5. The water quality image analysis method based on deep learning according to any one of claims 1, characterized in that In the said Step 7, the specific implementation process of the water body image abnormality judgment is: Step 7.1: Perform the first abnormality judgment on each water body image according to the gray value P' of each pixel point in each water body image. If the water body image is abnormal, go to Step 7.2 for the second abnormality judgment; if all water body images are abnormal-free, go to Step 8; Step 7.2: When the moving distance of the same pixel point within the time interval in multiple water body images exceeds the corresponding set range, and the gray values of multiple pixel points in a certain area in a water body image exceed the first set threshold, it indicates that the water body image is abnormal, and these multiple water body images and this one water body image are excluded; Or, when the gray value of a certain pixel point in a water body image exceeds the second set threshold, it indicates that this water body image is abnormal, and this water body image is excluded; Or, when the gray values of multiple pixel points in a certain area in a water body image exceed the first set threshold, it indicates that this water body image is abnormal, and this water body image is excluded; The time interval refers to the time difference between the acquisition time of the first water body image and the last water body image in multiple water body images.
6. The water quality image analysis method based on deep learning according to claim 5, wherein In step 7.1, the specific implementation process of the first abnormal judgment of the water body image is as follows: Step 7.11: Obtain the lowest light transmission intensity or the highest reflected light intensity according to the gray value P' of each pixel point in each water body image, and calculate the second difference between the lowest light transmission intensity and the standard sample light transmission intensity, or calculate the second difference between the highest reflected light intensity and the standard sample reflected light intensity; Step 7.12: Compare the second difference with a preset difference. If the second difference exceeds the preset difference, the water body image is abnormal; otherwise, the water body image is normal.
7. The method for water quality image analysis based on deep learning according to any one of claims 1 to 6, characterized in that The method further includes the step of retraining the restricted Boltzmann machine model, and the specific implementation process is as follows: Using the data set obtained from the abnormal-free water body images and historical water body images after the abnormal judgment process in step 7 as training samples, train the restricted Boltzmann machine model.
8. A water quality image analysis system based on deep learning, characterized in that, Including: A dataset acquisition unit for acquiring multiple historical water body color images, and obtaining a dataset {θ|R, G, B, W R , W G , W B} from the multiple historical water body color images, where R, G, and B respectively represent the three color component values R, G, and B of each pixel point in the historical water body color image, and W R , W G , W B respectively represent the weight values corresponding to the three color component values R, G, and B of the corresponding pixel points; Model establishment and training unit, which is used to establish a restricted Boltzmann machine model, and use the data set {θ|R, G, B, W R , W G , W B} as the training samples of the restricted Boltzmann machine model to train it. Among them, {R, G, B} is used as the training input sample, and {W R , W G , W B} is used as the training output sample to obtain a trained restricted Boltzmann machine model; A real-time image acquisition unit for acquiring multiple consecutive water body color images; The grayscale processing unit is configured to input the three color component values R′, G′, and B′ of each pixel of each of the water body color images into the trained restricted Boltzmann machine model to obtain the weight values W corresponding to the three color component values R′, G′, and B of the corresponding pixel R ′, W G ′, W B ′, and calculate the grayscale value P′ of each pixel of each water body image by using the weighted average method; A filtering processing unit for performing noise detection and filtering processing on the gray-scaled water body image; A first abnormal judgment unit for performing the first abnormal judgment on each water body image after filtering processing according to the gray value P' of each pixel point in each water body image. If the water body image is abnormal, transfer it to the second abnormal judgment unit for the second abnormal judgment; if all water body images are normal, transfer it to the normalization processing unit for pixel normalization processing; A second abnormal judgment unit for indicating that the water body image is abnormal and rejecting the multiple water body images and the one water body image when the moving distance of the same pixel point within the time interval in multiple water body images exceeds the corresponding set range, and the gray values of multiple pixel points in a certain area of a water body image exceed the first set threshold; Or, when the gray value of a certain pixel point in a water body image exceeds the second set threshold, it indicates that the water body image is abnormal, and the water body image is rejected; Or, when the gray values of multiple pixel points in a certain area of a water body image exceed the first set threshold, it indicates that the water body image is abnormal, and the water body image is rejected; The time interval refers to the time difference between the acquisition time of the first water body image and the last water body image in multiple water body images; A normalization processing unit for determining a time interval according to the sedimentation speed of the pollutant, and judging whether the gray value of each pixel point in the abnormal-free water body images within the time interval exceeds the corresponding mean value ±△δ. If it exceeds, assign the corresponding mean value to the pixel point to implement the normalization processing of each pixel point in all abnormal-free water body images within the time interval; The corresponding mean value refers to the average value of the gray values of all the same pixel points in the abnormal-free multiple consecutive water body images corresponding to the pixel point within the time interval; A water quality analysis unit for obtaining the light transmission intensity and the reflected light intensity of the water body image according to the gray value of each pixel point in each water body image; and then performing water quality analysis according to the light transmission intensity and the reflected light intensity.
9. An apparatus, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the deep learning-based water quality image analysis method according to any one of claims 1 to 7.
10. A medium on which a computer program is stored, characterized in that, When the program is executed by the processor, it implements the deep learning-based water quality image analysis method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Depth regression model based remote sensing water quality monitoring method
CN105912790A
Water recognition method based on high resolution remote sensing images
CN108229425A