A low-flow sewage monitoring method and system based on deep learning

By using deep learning methods of multi-layer perceptron and attention mechanism in low-flow sewage monitoring, sewage data is processed and analyzed, the problem of poor monitoring effect in low-flow sewage is solved, and higher monitoring accuracy and reliability are achieved.

CN119397485BActive Publication Date: 2025-03-11HUNAN YI KANG ENVIRONMENTAL PROTECTION TECHCO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510000318.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-03-11
Estimated Expiration
2045-01-02

AI Technical Summary

Technical Problem

Traditional low-flow sewage monitoring methods based on deep learning are difficult to effectively deal with the problems of low pollutant concentration and large fluctuations in components, resulting in poor monitoring results.

Method used

The pH sensor, chemical oxygen demand sensor and ammonia nitrogen sensor are used to collect sewage data in real time. After pretreatment and feature enhancement, a noise classifier is built using a long-term memory network, a multi-layer perceptron and attention mechanism, and the noise data is eliminated and feature extraction and fusion are performed to determine industrial sewage discharge.

Benefits of technology

It significantly improves the accuracy and reliability of sewage monitoring, can more effectively capture the inherent characteristics of low-flow sewage data, reduces the impact of noise, and improves the performance of the monitoring system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119397485B_ABST
    Figure CN119397485B_ABST
Patent Text Reader

Abstract

The present invention discloses a low-flow sewage monitoring method and system based on deep learning, including: S1: real-time collection of raw sewage data and pre-processing to obtain pre-processed sewage data; S2: combining the mean and variance of the pre-processed sewage data to generate feature enhancement data; constructing a noise classifier and denoising the feature enhancement data to obtain denoised sewage data; S3: constructing a gated cyclic unit based on attention update to extract pH value features, chemical oxygen demand features and ammonia nitrogen features; S4: extracting ammonia nitrogen fluctuation features, updating ammonia nitrogen features, and correcting ammonia nitrogen data in denoised sewage data; S5: performing feature fusion on the updated ammonia nitrogen features, pH value features and chemical oxygen demand features to determine whether there is industrial sewage discharge. The present invention solves the problem that traditional sewage monitoring methods are difficult to cope with the poor monitoring effect caused by low concentration and large fluctuation of pollutant components in low-flow sewage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of sewage monitoring, and in particular to a low-flow sewage monitoring method and system based on deep learning. Background Art

[0002] Low-flow sewage monitoring refers to the regular monitoring of sewage with relatively small discharge flow in residential areas, small towns, etc., in order to grasp the concentration, type and changing trends of pollutants, and provide important basis for environmental protection and water resources management.

[0003] Traditional low-flow sewage monitoring methods based on deep learning still face many challenges in algorithms, and it is difficult to effectively deal with the problem of low pollutant concentration and large fluctuations in sewage composition in low-flow sewage. The concentration of pollutants in low-flow sewage is often low, which makes the pollution signal weak and difficult to capture in the background noise. In addition, the composition of low-flow sewage is complex and fluctuates greatly. There are significant differences in sewage composition at different times and locations. Traditional deep learning models are difficult to adapt to this rapidly changing data distribution, resulting in unstable model performance and poor monitoring results. Summary of the invention

[0004] In view of this, the present invention aims to propose a low-flow sewage monitoring method and system based on deep learning, so as to solve the problem that traditional sewage monitoring methods are difficult to cope with the poor monitoring effect caused by low concentration and large fluctuation of pollutants in low-flow sewage.

[0005] A low-flow sewage monitoring method based on deep learning, comprising:

[0006] S1: Use pH sensor, chemical oxygen demand sensor and ammonia nitrogen sensor to collect raw sewage data in real time; remove outliers in the raw sewage data, and then perform normalization to obtain pre-treated sewage data;

[0007] S2: input the mean and variance of the pretreated sewage data into the random number generator of the Gaussian distribution probability density function and the Poisson distribution probability density function to generate Gaussian distribution noise data and Poisson distribution noise data;

[0008] The fusion ratio is calculated by a multi-layer perceptron, and the Gaussian distribution noise data, the Poisson distribution noise data and the pre-treated sewage data are fused according to the fusion ratio to obtain feature enhanced data;

[0009] Based on long short-term memory network, multi-layer perceptron and attention mechanism, a noise classifier is constructed, and the noise data in the feature enhancement data is removed by the noise classifier to obtain the denoised sewage data;

[0010] S3: Construct a gated recurrent unit based on attention update, and then extract features of the pH value, chemical oxygen demand, and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features, and ammonia nitrogen features;

[0011] S4: extract ammonia nitrogen fluctuation features based on the ammonia nitrogen data in the denoised sewage data, and fuse them with the ammonia nitrogen features to obtain updated ammonia nitrogen features; then correct the ammonia nitrogen data in the denoised sewage data based on the updated ammonia nitrogen features to obtain corrected ammonia nitrogen data;

[0012] S5: Perform feature fusion on the updated ammonia nitrogen characteristics, pH value characteristics and chemical oxygen demand characteristics to obtain fused characteristics; then determine whether there is industrial wastewater discharge based on the fused characteristics; use the corrected ammonia nitrogen data, pH value and chemical oxygen demand in the denoised wastewater data as detection indicators in the data report.

[0013] Furthermore, the step S1 includes:

[0014] S11: using a pH sensor, a chemical oxygen demand sensor and an ammonia nitrogen sensor respectively, to collect the pH value, chemical oxygen demand and ammonia nitrogen data in the sewage in real time to obtain the raw sewage data;

[0015] S12: Using the 3sigma principle, detect and remove outliers in the raw sewage data to obtain data after outliers are removed;

[0016] S13: The data after outliers are removed are normalized using the maximum and minimum method to obtain pre-treated sewage data.

[0017] Furthermore, the step S2 includes:

[0018] S21: inputting the mean and variance of the pre-treated sewage data into the random number generators of Gaussian distribution and Poisson distribution probability density functions, respectively, to generate Gaussian distribution noise data and Poisson distribution noise data;

[0019] The fusion ratio is calculated by multi-layer perceptron, and the Gaussian distribution noise data, Poisson distribution noise data and pre-treated sewage data are fused according to the fusion ratio to obtain feature enhanced data. The specific calculation method is:

[0020] ;

[0021] in, is the fusion ratio, is the sigmoid function, is a multi-layer perceptron, is the sewage data after the i-th pretreatment, i is the data index, is the mean of the pretreated sewage data, is the variance of the pretreated sewage data, Enhance the data for the i-th feature, is the i-th Gaussian distribution noise data, is the i-th Poisson distribution noise data; By Input into the random number generator of Gaussian distribution probability density function to generate, By Input into the random number generator of Poisson distribution probability density function to generate;

[0022] S22: Build a noise classifier, the calculation method is:

[0023] ;

[0024] in, is the i-th long short-term memory hidden state, is the long short-term memory network, is the i-1th long short-term memory hidden state, is the i-th initial attention value, is the initial attention weight matrix, is the initial attention bias vector, is the i-th attention value, is the vector concatenation operation, is the probability distribution of the i-th data point category, is the softmax function, is the attention fusion weight matrix, is the attention fusion bias vector; after obtaining the probability distribution of the i-th data point category, select the data point category with the largest probability as the category of the data point; the data point categories include: noise data and normal data;

[0025] S23: Use the noise classifier to traverse all feature enhancement data, filter the feature enhancement data for noise, and obtain the denoised sewage data ; The judgment standard of the noise filtering is that when the category of the feature enhanced data is noise data, it is deleted; when the category of the feature enhanced data is normal data, it is retained.

[0026] Step S21 of the present invention generates feature-enhanced data by calculating the mean and variance of the pretreated sewage data; the mean reflects the overall level of the data, and the variance reveals the degree of discreteness of the data; through the combination of these two statistics, the intrinsic characteristics of the sewage data can be captured more comprehensively, and the feature enhancement method combining the mean and variance not only retains the key information of the original data, but also enhances the data by means of statistical features; secondly, the present invention uses a multi-layer perceptron to calculate the fusion ratio of the two distributions, which also makes the enhanced data have adaptive capabilities and higher robustness, so that the noise classifier in the subsequent steps can more accurately identify and filter out noise signals, thereby obtaining more accurate denoised sewage data;

[0027] When faced with low-flow sewage data, traditional methods are often difficult to accurately classify due to large data fluctuations and complex noise components. The attention mechanism in step S22 of the present invention is different from the traditional attention mechanism. It focuses more on processing time series data, captures time series features through LSTM, and dynamically adjusts the weights of different time steps in combination with the attention mechanism to cope with the volatility and noise of low-flow sewage data. By dynamically adjusting the weights of different data points, the noise classifier can pay more attention to those data points that are more critical to the classification task, while reducing the focus on noise data, providing a purer data source for subsequent processing steps, which helps to improve the performance of the entire monitoring system.

[0028] Furthermore, in the step S3, the attention-updating gated recurrent unit introduces an attention mechanism inside the gated recurrent unit to dynamically adjust the hidden state calculation of each time step; the attention-updating gated recurrent unit calculates the gated recurrent attention value using the attention mechanism, and combines the gated recurrent attention value, the gated recurrent update gate, and the gated recurrent hidden state at the previous moment to calculate the gated recurrent hidden state at the current moment.

[0029] Furthermore, the step S3 includes:

[0030] S31: Building a Gated Recurrent Unit with Attention-Based Updates , calculated as:

[0031] ;

[0032] in, is the reset gate at time t, t is the first time index, To reset the gate weight matrix, is the gated cyclic hidden state at time t-1, is time t The input data, To reset the gate bias vector, is the candidate hidden state of the gated cycle at time t, is the hyperbolic tangent function, is the candidate hidden state weight matrix, is element-wise multiplication, is the candidate hidden state bias vector, is the gated recurrent attention value at time t, is the gated recurrent attention weight matrix, is the gated recurrent attention bias vector, is the gated recurrent hidden state at time t, Update the gate for the gating cycle at time t;

[0033] S32: Using the attention-updating based gated recurrent unit, feature extraction is performed on the pH value, chemical oxygen demand and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features and ammonia nitrogen features. The calculation method is:

[0034] ;

[0035] in, is the pH characteristic, is the chemical oxygen demand characteristic, Ammonia nitrogen characteristics, is the pH value data of the denoised sewage data at time t, is the chemical oxygen demand data in the denoised sewage data at time t, is the ammonia nitrogen data in the denoised sewage data at time t.

[0036] The gated loop attention value in step S31 of the present invention is calculated by the softmax function, which measures the importance of each element in the gated loop hidden state at the previous moment to the gated loop hidden state at the current moment; the element-by-element multiplication of the gated loop attention value and the gated loop update gate can take into account more information that is considered important by the attention mechanism when updating the gated loop hidden state, and dynamically adjust the update amplitude; compared with the traditional gated loop unit, the gated loop unit based on attention update proposed in the present invention has stronger feature extraction capability, and during model training, the parameter update is more dynamic and intelligent, and it is more efficient and accurate when processing low-flow sewage data, which can improve the performance of the entire monitoring system.

[0037] Furthermore, the step S4 includes:

[0038] S41: Extract ammonia nitrogen fluctuation characteristics based on the ammonia nitrogen data in the denoised sewage data. The calculation method is:

[0039] ;

[0040] in, is the first-order difference of the ammonia nitrogen data in the sewage data after denoising at time t, is the ammonia nitrogen data in the denoised sewage data at time t-1, is the second-order difference of the ammonia nitrogen data in the sewage data after denoising at time t, is the first-order difference of the ammonia nitrogen data in the sewage data after denoising at time t-1, is the moving average of the ammonia nitrogen data in the sewage data after denoising at time t, To move the window size, is the ammonia nitrogen data in the denoised sewage data at time k, k is the index at the second time, is the moving average difference at time t, To take the absolute value, is the ammonia nitrogen fluctuation index at time t, It is characterized by ammonia nitrogen fluctuations;

[0041] S42: The ammonia nitrogen fluctuation feature is merged with the ammonia nitrogen feature to obtain an updated ammonia nitrogen feature, which is calculated as follows:

[0042] ;

[0043] in, is the updated ammonia nitrogen characteristic;

[0044] S43: Correct the ammonia nitrogen data in the denoised sewage data according to the updated ammonia nitrogen characteristics to obtain corrected ammonia nitrogen data, and the calculation method is:

[0045] ;

[0046] in, is the corrected ammonia nitrogen data at time t.

[0047] In step S41 of the present invention, the difference of ammonia nitrogen data at adjacent moments is calculated by first-order difference to describe the changing trend of data in a short period of time, which is mainly used to capture the instantaneous fluctuation of ammonia nitrogen data; the acceleration of data fluctuation or the change of changing trend is further revealed by second-order difference, which is mainly used to identify mutation points or trend turning points in the data; the moving average reflects the changing speed of the long-term trend of the data; the ammonia nitrogen fluctuation index comprehensively quantifies the volatility of ammonia nitrogen data by combining the square root of the sum of the squares of the first-order difference, the second-order difference and the moving average difference; finally, the ammonia nitrogen fluctuation characteristics are extracted in combination with the ammonia nitrogen fluctuation index, and after being fused with the ammonia nitrogen characteristics, the data change characteristics with large fluctuations in ammonia nitrogen data can be more accurately described, thereby enhancing the adaptability of the model to the volatility of ammonia nitrogen data.

[0048] Furthermore, the step S5 includes:

[0049] S51: The updated ammonia nitrogen feature, pH value feature and chemical oxygen demand feature are fused to obtain the fused feature, and the calculation method is:

[0050] ;

[0051] in, is the fused feature;

[0052] S52: Based on the fused features, determine whether there is industrial wastewater discharge. The calculation method is:

[0053] ;

[0054] in, is the probability distribution of whether there is industrial wastewater discharge, when When When the industrial wastewater is discharged, it is considered that there is no industrial wastewater discharge;

[0055] S53: The corrected ammonia nitrogen data, pH value and chemical oxygen demand in the denoised sewage data are used as detection indicators in the data report.

[0056] The present invention also discloses a camera intelligent operation and maintenance system based on deep learning, comprising:

[0057] Sewage data collection and pretreatment module: pH sensors, chemical oxygen demand sensors and ammonia nitrogen sensors are used to collect raw sewage data in real time, remove abnormal values, and then perform normalization processing to obtain pretreated sewage data;

[0058] Feature enhancement and denoising module: Combine the mean and variance of the pre-treated sewage data, and use Gaussian distribution and Poisson distribution to generate feature enhancement data; secondly, build a noise classifier and traverse all feature enhancement data, filter the noise of the feature enhancement data, and obtain the denoised sewage data;

[0059] Feature extraction module: construct a gated recurrent unit based on attention update, and then extract features from the pH value, chemical oxygen demand, and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features, and ammonia nitrogen features;

[0060] Feature fusion and correction module: extract ammonia nitrogen fluctuation features based on the ammonia nitrogen data in the denoised sewage data, and fuse them with the ammonia nitrogen features to obtain updated ammonia nitrogen features; then correct the ammonia nitrogen data in the denoised sewage data based on the updated ammonia nitrogen features to obtain corrected ammonia nitrogen data;

[0061] Discrimination module: The updated ammonia nitrogen features, pH value features and chemical oxygen demand features are fused to obtain fused features; then, based on the fused features, it is determined whether there is industrial wastewater discharge; the pH value and chemical oxygen demand in the corrected ammonia nitrogen data and the denoised sewage data are used as detection indicators in the data report.

[0062] Compared with the prior art, the present invention has the following beneficial effects:

[0063] (1) The present invention constructs a noise classifier to effectively filter out noise data in low-flow sewage and retain normal data; then, the present invention proposes a gated recurrent unit based on attention update to extract features from the denoised sewage data and correct the original ammonia nitrogen data according to the updated ammonia nitrogen features, which effectively solves the problem of poor monitoring effect caused by low concentration and large fluctuation of pollutants in traditional methods in low-flow sewage monitoring, and significantly improves the accuracy and reliability of sewage monitoring.

[0064] (2) The present invention generates feature-enhanced data by calculating the mean and variance of the pretreated sewage data; the mean reflects the overall level of the data, and the variance reveals the degree of discreteness of the data; through the combination of these two statistics, the intrinsic characteristics of the low-flow sewage data can be captured more comprehensively, so that the noise classifier in the subsequent steps can more accurately identify and filter out the noise signal, thereby obtaining more accurate denoised sewage data.

[0065] (3) The present invention proposes a gated recurrent unit based on attention updating. The element-by-element multiplication of the gated recurrent attention value in the unit and the gated recurrent update gate can take more information considered important by the attention mechanism into consideration when updating the gated recurrent hidden state, and dynamically adjust the update amplitude. Compared with the traditional gated recurrent unit, the gated recurrent unit based on attention updating proposed in the present invention has stronger feature extraction capability. During model training, the parameter update is more dynamic and intelligent. It is more efficient and accurate when processing low-flow sewage data, and can improve the performance of the entire low-flow sewage monitoring system. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 A schematic diagram of the process of the low-flow sewage monitoring method based on deep learning provided by the present invention;

[0067] Figure 2 This is a schematic diagram of the algorithm flow of the noise classifier provided by the present invention. DETAILED DESCRIPTION

[0068] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.

[0069] Example 1: A low-flow sewage monitoring method based on deep learning, such as Figure 1 As shown, the following steps are included:

[0070] S1: Use pH sensor, chemical oxygen demand sensor and ammonia nitrogen sensor to collect raw sewage data in real time; remove outliers in the raw sewage data, and then perform normalization to obtain pre-treated sewage data, including:

[0071] S11: using a pH sensor, a chemical oxygen demand sensor and an ammonia nitrogen sensor respectively, to collect the pH value, chemical oxygen demand and ammonia nitrogen data in the sewage in real time to obtain the raw sewage data;

[0072] S12: Using the 3sigma principle, detect and remove outliers in the raw sewage data to obtain data after outliers are removed;

[0073] S13: The data after outliers are removed are normalized using the maximum and minimum method to obtain pre-treated sewage data.

[0074] S2: Input the mean and variance of the pretreated sewage data into the random number generator of the Gaussian distribution probability density function and the Poisson distribution probability density function to generate Gaussian distribution noise data and Poisson distribution noise data; calculate the fusion ratio through the multi-layer perceptron, and fuse the Gaussian distribution noise data, Poisson distribution noise data and the pretreated sewage data according to the fusion ratio to obtain feature enhanced data; construct a noise classifier based on the long short-term memory network, the multi-layer perceptron and the attention mechanism, and use the noise classifier to eliminate the noise data in the feature enhanced data to obtain the denoised sewage data, including:

[0075] S21: inputting the mean and variance of the pre-treated sewage data into the random number generators of Gaussian distribution and Poisson distribution probability density functions, respectively, to generate Gaussian distribution noise data and Poisson distribution noise data;

[0076] The fusion ratio is calculated by multi-layer perceptron, and the Gaussian distribution noise data, Poisson distribution noise data and pre-treated sewage data are fused according to the fusion ratio to obtain feature enhanced data. The specific calculation method is:

[0077] ;

[0078] in, is the fusion ratio, is the sigmoid function, is a multi-layer perceptron, is the sewage data after the i-th pretreatment, i is the data index, is the mean of the pretreated sewage data, is the variance of the pretreated sewage data, Enhance the data for the i-th feature, is the i-th Gaussian distribution noise data, is the i-th Poisson distribution noise data; By Input into the random number generator of Gaussian distribution probability density function to generate, By Input into the random number generator of Poisson distribution probability density function to generate;

[0079] S22: Construct a noise classifier, such as Figure 2 As shown, the calculation method is:

[0080] ;

[0081] in, is the i-th long short-term memory hidden state, is the long short-term memory network, is the i-1th long short-term memory hidden state, is the i-th initial attention value, is the initial attention weight matrix, is the initial attention bias vector, is the i-th attention value, is the vector concatenation operation, is the probability distribution of the i-th data point category, is the softmax function, is the attention fusion weight matrix, is the attention fusion bias vector; after obtaining the probability distribution of the i-th data point category, select the data point category with the largest probability as the category of the data point; the data point categories include: noise data and normal data;

[0082] S23: Use the noise classifier to traverse all feature enhancement data, filter the feature enhancement data for noise, and obtain the denoised sewage data ; The judgment standard of the noise filtering is that when the category of the feature enhanced data is noise data, it is deleted; when the category of the feature enhanced data is normal data, it is retained.

[0083] Step S21 of the present invention generates feature-enhanced data by calculating the mean and variance of the pretreated sewage data; the mean reflects the overall level of the data, and the variance reveals the degree of discreteness of the data; through the combination of these two statistics, the intrinsic characteristics of the sewage data can be captured more comprehensively, and the feature enhancement method combining the mean and variance not only retains the key information of the original data, but also enhances the data by means of statistical features; secondly, the present invention uses a multi-layer perceptron to calculate the fusion ratio of the two distributions, which also makes the enhanced data have adaptive capabilities and higher robustness, so that the noise classifier in the subsequent steps can more accurately identify and filter out noise signals, thereby obtaining more accurate denoised sewage data;

[0084] When faced with low-flow sewage data, traditional methods are often difficult to accurately classify due to large data fluctuations and complex noise components. The attention mechanism in step S22 of the present invention is different from the traditional attention mechanism. It focuses more on processing time series data, captures time series features through LSTM, and dynamically adjusts the weights of different time steps in combination with the attention mechanism to cope with the volatility and noise of low-flow sewage data. By dynamically adjusting the weights of different data points, the noise classifier can pay more attention to those data points that are more critical to the classification task, while reducing the focus on noise data, providing a purer data source for subsequent processing steps, which helps to improve the performance of the entire monitoring system.

[0085] For example, there is a sequence containing 10 feature augmentation data points with the following values:

[0086] ;

[0087] The noise classifier classified these data points and gave the following classification results (1 represents normal data and 0 represents noise data):

[0088] ;

[0089] According to the classification results of the noise classifier, the data points classified as noise are removed, and the data points classified as normal data are retained. The denoised sewage data sequence is as follows:

[0090]

[0091] Finally, 7 data points that were considered normal were retained as the final denoised sewage data.

[0092] S3: Construct a gated recurrent unit based on attention update, and then extract features of the pH value, chemical oxygen demand, and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features, and ammonia nitrogen features, including:

[0093] S31: Building a Gated Recurrent Unit with Attention-Based Updates , calculated as:

[0094] ;

[0095] in, is the reset gate at time t, t is the first time index, To reset the gate weight matrix, is the gated cyclic hidden state at time t-1, is time t The input data, To reset the gate bias vector, is the candidate hidden state of the gated cycle at time t, is the hyperbolic tangent function, is the candidate hidden state weight matrix, is element-wise multiplication, is the candidate hidden state bias vector, is the gated recurrent attention value at time t, is the gated recurrent attention weight matrix, is the gated recurrent attention bias vector, is the gated recurrent hidden state at time t, Update the gate for the gating cycle at time t;

[0096] The main difference between the attention-updating gated recurrent unit and the conventional gated recurrent unit is that the unit introduces an attention mechanism inside the conventional gated recurrent unit to dynamically adjust the hidden state calculation of each time step; the unit calculates the gated recurrent attention value by using the attention mechanism, and calculates the gated recurrent hidden state at the current moment by combining the gated recurrent attention value, the gated recurrent update gate and the gated recurrent hidden state at the previous moment;

[0097] S32: Using the attention-updating based gated recurrent unit, feature extraction is performed on the pH value, chemical oxygen demand and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features and ammonia nitrogen features. The calculation method is:

[0098] ;

[0099] in, is the pH characteristic, is the chemical oxygen demand characteristic, Ammonia nitrogen characteristics, is the pH value data of the denoised sewage data at time t, is the chemical oxygen demand data in the denoised sewage data at time t, is the ammonia nitrogen data in the denoised sewage data at time t.

[0100] The gated loop attention value in step S31 of the present invention is calculated by the softmax function, which measures the importance of each element in the gated loop hidden state at the previous moment to the gated loop hidden state at the current moment; the element-by-element multiplication of the gated loop attention value and the gated loop update gate can take into account more information that is considered important by the attention mechanism when updating the gated loop hidden state, and dynamically adjust the update amplitude; compared with the traditional gated loop unit, the gated loop unit based on attention update proposed in the present invention has stronger feature extraction capability, and during model training, the parameter update is more dynamic and intelligent, and it is more efficient and accurate when processing low-flow sewage data, which can improve the performance of the entire monitoring system.

[0101] S4: extracting ammonia nitrogen fluctuation features based on the ammonia nitrogen data in the denoised sewage data, and fusing them with the ammonia nitrogen features to obtain updated ammonia nitrogen features; and then correcting the ammonia nitrogen data in the denoised sewage data based on the updated ammonia nitrogen features to obtain corrected ammonia nitrogen data, including;

[0102] S41: Extract ammonia nitrogen fluctuation characteristics based on the ammonia nitrogen data in the denoised sewage data. The calculation method is:

[0103] ;

[0104] in, is the first-order difference of the ammonia nitrogen data in the sewage data after denoising at time t, is the ammonia nitrogen data in the denoised sewage data at time t-1, is the second-order difference of the ammonia nitrogen data in the sewage data after denoising at time t, is the first-order difference of the ammonia nitrogen data in the sewage data after denoising at time t-1, is the moving average of the ammonia nitrogen data in the sewage data after denoising at time t, To move the window size, is the ammonia nitrogen data in the denoised sewage data at time k, k is the index at the second time, is the moving average difference at time t, To take the absolute value, is the ammonia nitrogen fluctuation index at time t, It is characterized by ammonia nitrogen fluctuations;

[0105] S42: The ammonia nitrogen fluctuation feature is merged with the ammonia nitrogen feature to obtain an updated ammonia nitrogen feature, which is calculated as follows:

[0106] ;

[0107] in, is the updated ammonia nitrogen characteristic;

[0108] S43: Correct the ammonia nitrogen data in the denoised sewage data according to the updated ammonia nitrogen characteristics to obtain corrected ammonia nitrogen data, and the calculation method is:

[0109]

[0110] in, is the corrected ammonia nitrogen data at time t.

[0111] In step S41 of the present invention, the difference of ammonia nitrogen data at adjacent moments is calculated by first-order difference to describe the changing trend of data in a short period of time, which is mainly used to capture the instantaneous fluctuation of ammonia nitrogen data; the acceleration of data fluctuation or the change of changing trend is further revealed by second-order difference, which is mainly used to identify mutation points or trend turning points in the data; the moving average reflects the changing speed of the long-term trend of the data; the ammonia nitrogen fluctuation index comprehensively quantifies the volatility of ammonia nitrogen data by combining the square root of the sum of the squares of the first-order difference, the second-order difference and the moving average difference; finally, the ammonia nitrogen fluctuation characteristics are extracted in combination with the ammonia nitrogen fluctuation index, and after being fused with the ammonia nitrogen characteristics, the data change characteristics with large fluctuations in ammonia nitrogen data can be more accurately described, thereby enhancing the adaptability of the model to the volatility of ammonia nitrogen data.

[0112] For example, here are the ammonia nitrogen data (unit: mg / L) in the denoised sewage data at the following five time points:

[0113] ;

[0114] Then, the ammonia nitrogen data were corrected using the GRU network with an attention mechanism, and the following corrected ammonia nitrogen data sequence was obtained:

[0115] ;

[0116] The revised data takes into account the temporal and fluctuation characteristics of ammonia nitrogen, and more accurately reflects the actual ammonia nitrogen concentration at each time point.

[0117] S5: The updated ammonia nitrogen feature, pH value feature and chemical oxygen demand feature are fused to obtain the fused feature; then, based on the fused feature, it is determined whether there is industrial wastewater discharge; the pH value and chemical oxygen demand in the corrected ammonia nitrogen data and the denoised wastewater data are used as detection indicators in the data report, including:

[0118] S51: The updated ammonia nitrogen feature, pH value feature and chemical oxygen demand feature are fused to obtain the fused feature, and the calculation method is:

[0119] ;

[0120] in, is the fused feature;

[0121] In particular, if the ammonia nitrogen data in the low-flow sewage fluctuates greatly, the following fusion method can be used to replace step S51, and the calculation method is:

[0122] ;

[0123] This formula processes the updated ammonia nitrogen features using a single multi-layer perceptron, avoiding data interference in the initial stage of feature fusion and achieving more stable results when ammonia nitrogen data fluctuates greatly.

[0124] S52: Based on the fused features, determine whether there is industrial wastewater discharge. The calculation method is:

[0125] ;

[0126] in, is the probability distribution of whether there is industrial wastewater discharge, when When When the industrial wastewater is discharged, it is considered that there is no industrial wastewater discharge;

[0127] S53: The corrected ammonia nitrogen data, pH value and chemical oxygen demand in the denoised sewage data are used as detection indicators in the data report.

[0128] For example, the data is reported as:

[0129] Testing date: January 1, 2024;

[0130] Testing location: sewage outlet in a residential area of ​​a small town;

[0131] Test indicators and results:

[0132] Corrected ammonia nitrogen data:

[0133] Detection value: 0.59 mg / L;

[0134] The corrected ammonia nitrogen data is the data corrected by the GRU network with an attention mechanism, which more accurately reflects the ammonia nitrogen concentration under current environmental conditions.

[0135] pH values ​​in the denoised sewage data:

[0136] Detection value: 7.2;

[0137] The denoised sewage data has removed noise interference and reflects the actual pH value of the sewage.

[0138] Chemical Oxygen Demand (COD):

[0139] Detection value: 30 mg / L;

[0140] Chemical oxygen demand refers to the amount of oxygen required for the oxidation of organic matter in sewage, and is an important indicator for assessing the degree of sewage pollution.

[0141] Comprehensive conclusion: The monitoring results show that the ammonia nitrogen concentration, pH value and COD in the low-flow sewage discharged from this residential area are at a low level and the trend is stable, indicating that the water quality is relatively good and there is no industrial sewage discharge.

[0142] Embodiment 2: The present invention also discloses a low-flow sewage monitoring system based on deep learning, comprising:

[0143] Sewage data collection and pretreatment module: pH sensors, chemical oxygen demand sensors and ammonia nitrogen sensors are used to collect raw sewage data in real time, remove abnormal values, and then perform normalization processing to obtain pretreated sewage data;

[0144] Feature enhancement and denoising module: Combine the mean and variance of the pre-treated sewage data, and use Gaussian distribution and Poisson distribution to generate feature enhancement data; secondly, build a noise classifier and traverse all feature enhancement data, filter the noise of the feature enhancement data, and obtain the denoised sewage data;

[0145] Feature extraction module: construct a gated recurrent unit based on attention update, and then extract features from the pH value, chemical oxygen demand, and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features, and ammonia nitrogen features;

[0146] Feature fusion and correction module: extract ammonia nitrogen fluctuation features based on the ammonia nitrogen data in the denoised sewage data, and fuse them with the ammonia nitrogen features to obtain updated ammonia nitrogen features; then correct the ammonia nitrogen data in the denoised sewage data based on the updated ammonia nitrogen features to obtain corrected ammonia nitrogen data;

[0147] Discrimination module: The updated ammonia nitrogen features, pH value features and chemical oxygen demand features are fused to obtain fused features; then, based on the fused features, it is determined whether there is industrial wastewater discharge; the pH value and chemical oxygen demand in the corrected ammonia nitrogen data and the denoised sewage data are used as detection indicators in the data report.

[0148] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.

[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, including a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in multiple embodiments of the present invention.

[0150] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A low-flow sewage monitoring method based on deep learning, characterized in that: The following steps are involved: S1: Use pH sensor, chemical oxygen demand sensor and ammonia nitrogen sensor to collect raw sewage data in real time; Eliminate outliers in the original sewage data, and then perform normalization to obtain pre-treated sewage data; S2: input the mean and variance of the pretreated sewage data into the random number generator of the Gaussian distribution probability density function and the Poisson distribution probability density function to generate Gaussian distribution noise data and Poisson distribution noise data; The fusion ratio is calculated by a multi-layer perceptron, and the Gaussian distribution noise data, the Poisson distribution noise data and the pre-treated sewage data are fused according to the fusion ratio to obtain feature enhanced data; Based on long short-term memory network, multi-layer perceptron and attention mechanism, a noise classifier is constructed, and the noise data in the feature enhancement data is removed by the noise classifier to obtain the denoised sewage data; S3: Construct a gated recurrent unit based on attention update, and then extract features of the pH value, chemical oxygen demand, and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features, and ammonia nitrogen features; S4: Extract ammonia nitrogen fluctuation features based on the ammonia nitrogen data in the denoised sewage data, and fuse them with the ammonia nitrogen features to obtain updated ammonia nitrogen features; Then, according to the updated ammonia nitrogen characteristics, the ammonia nitrogen data in the denoised sewage data is corrected to obtain the corrected ammonia nitrogen data; S5: Perform feature fusion on the updated ammonia nitrogen characteristics, pH value characteristics and chemical oxygen demand characteristics to obtain fused characteristics; then determine whether there is industrial wastewater discharge based on the fused characteristics; use the corrected ammonia nitrogen data, pH value and chemical oxygen demand in the denoised wastewater data as detection indicators in the data report.

2. The low-flow sewage monitoring method based on deep learning according to claim 1 is characterized in that: The S1 step includes: S11: using a pH sensor, a chemical oxygen demand sensor and an ammonia nitrogen sensor respectively, to collect the pH value, chemical oxygen demand and ammonia nitrogen data in the sewage in real time to obtain the raw sewage data; S12: Using the 3sigma principle, detect and remove outliers in the raw sewage data to obtain data after outliers are removed; S13: The data after outliers are removed are normalized using the maximum and minimum method to obtain pre-treated sewage data.

3. The low-flow sewage monitoring method based on deep learning according to claim 1 is characterized in that: The S2 step includes: S21: inputting the mean and variance of the pre-treated sewage data into the random number generators of Gaussian distribution and Poisson distribution probability density functions, respectively, to generate Gaussian distribution noise data and Poisson distribution noise data; The fusion ratio is calculated by multi-layer perceptron, and the Gaussian distribution noise data, Poisson distribution noise data and pre-treated sewage data are fused according to the fusion ratio to obtain feature enhanced data. The specific calculation method is: ; in, is the fusion ratio, is the sigmoid function, is a multi-layer perceptron, is the sewage data after the i-th pretreatment, i is the data index, is the mean of the pretreated sewage data, is the variance of the pretreated sewage data, Enhance the data for the i-th feature, is the i-th Gaussian distribution noise data, is the i-th Poisson distribution noise data; By Input into the random number generator of Gaussian distribution probability density function to generate, By Input into the random number generator of Poisson distribution probability density function to generate; S22: Build a noise classifier, the calculation method is: ; in, is the i-th long short-term memory hidden state, is the long short-term memory network, is the i-1th long short-term memory hidden state, is the i-th initial attention value, is the initial attention weight matrix, is the initial attention bias vector, is the i-th attention value, is the vector concatenation operation, is the probability distribution of the i-th data point category, is the softmax function, is the attention fusion weight matrix, is the attention fusion bias vector; after obtaining the probability distribution of the i-th data point category, select the data point category with the largest probability as the category of the data point; the data point categories include: noise data and normal data; S23: Use the noise classifier to traverse all feature enhancement data, filter the feature enhancement data for noise, and obtain the denoised sewage data ; The judgment standard of the noise filtering is that when the category of the feature enhanced data is noise data, it is deleted; when the category of the feature enhanced data is normal data, it is retained.

4. The low-flow sewage monitoring method based on deep learning according to claim 3 is characterized in that: In the step S3, the attention-updating gated recurrent unit introduces an attention mechanism inside the gated recurrent unit to dynamically adjust the hidden state calculation of each time step; the attention-updating gated recurrent unit calculates the gated recurrent attention value using the attention mechanism, and combines the gated recurrent attention value, the gated recurrent update gate, and the gated recurrent hidden state at the previous moment to calculate the gated recurrent hidden state at the current moment.

5. The low-flow sewage monitoring method based on deep learning according to claim 4 is characterized in that: The S3 step comprises: S31: Building a Gated Recurrent Unit with Attention-Based Updates , calculated as: ; in, is the reset gate at time t, t is the first time index, To reset the gate weight matrix, is the gated cyclic hidden state at time t-1, is time t The input data, To reset the gate bias vector, is the candidate hidden state of the gated cycle at time t, is the hyperbolic tangent function, is the candidate hidden state weight matrix, is element-wise multiplication, is the candidate hidden state bias vector, is the gated recurrent attention value at time t, is the gated recurrent attention weight matrix, is the gated recurrent attention bias vector, is the gated recurrent hidden state at time t, Update the gate for the gating cycle at time t; S32: Using the attention-updating based gated recurrent unit, feature extraction is performed on the pH value, chemical oxygen demand and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features and ammonia nitrogen features. The calculation method is: ; in, is the pH characteristic, is the chemical oxygen demand characteristic, Ammonia nitrogen characteristics, is the pH value data of the denoised sewage data at time t, is the chemical oxygen demand data in the denoised sewage data at time t, is the ammonia nitrogen data in the denoised sewage data at time t.

6. The low-flow sewage monitoring method based on deep learning according to claim 5 is characterized in that: The S4 step comprises: The ammonia nitrogen fluctuation index is obtained by calculating the first-order difference, second-order difference, moving average and moving average difference of the ammonia nitrogen data in the denoised sewage data; the ammonia nitrogen fluctuation characteristics are obtained by combining the gated recurrent unit based on attention update; the ammonia nitrogen fluctuation characteristics are fused with the ammonia nitrogen characteristics through a multi-layer perceptron to obtain updated ammonia nitrogen characteristics, and the ammonia nitrogen data in the denoised sewage data are corrected according to the updated ammonia nitrogen characteristics to obtain corrected ammonia nitrogen data.

7. The low-flow sewage monitoring method based on deep learning according to claim 6 is characterized in that: The S4 step comprises: S41: Extract ammonia nitrogen fluctuation characteristics based on the ammonia nitrogen data in the denoised sewage data. The calculation method is: ; in, is the first-order difference of the ammonia nitrogen data in the sewage data after denoising at time t, is the ammonia nitrogen data in the denoised sewage data at time t-1, is the second-order difference of the ammonia nitrogen data in the sewage data after denoising at time t, is the first-order difference of the ammonia nitrogen data in the sewage data after denoising at time t-1, is the moving average of the ammonia nitrogen data in the sewage data after denoising at time t, To move the window size, is the ammonia nitrogen data in the denoised sewage data at time k, k is the index at the second time, is the moving average difference at time t, To take the absolute value, is the ammonia nitrogen fluctuation index at time t, It is characterized by ammonia nitrogen fluctuations; S42: The ammonia nitrogen fluctuation feature is merged with the ammonia nitrogen feature to obtain an updated ammonia nitrogen feature, which is calculated as follows: ; in, is the updated ammonia nitrogen characteristic; S43: Correct the ammonia nitrogen data in the denoised sewage data according to the updated ammonia nitrogen characteristics to obtain corrected ammonia nitrogen data, and the calculation method is: ; in, is the corrected ammonia nitrogen data at time t.

8. The low-flow sewage monitoring method based on deep learning according to claim 7 is characterized in that: The step S5 comprises: S51: The updated ammonia nitrogen feature, pH value feature and chemical oxygen demand feature are fused to obtain the fused feature, and the calculation method is: ; in, is the fused feature; S52: Based on the fused features, determine whether there is industrial wastewater discharge. The calculation method is: ; in, is the probability distribution of whether there is industrial wastewater discharge, when When When the industrial wastewater is discharged, it is considered that there is no industrial wastewater discharge; S53: The corrected ammonia nitrogen data, pH value and chemical oxygen demand in the denoised sewage data are used as detection indicators in the data report.

9. A low-flow sewage monitoring system based on deep learning, characterized in that: include: Sewage data collection and pretreatment module: pH sensors, chemical oxygen demand sensors and ammonia nitrogen sensors are used to collect raw sewage data in real time, remove abnormal values, and then perform normalization processing to obtain pretreated sewage data; Feature enhancement and denoising module: Combines the mean and variance of the pre-treated sewage data and uses Gaussian distribution and Poisson distribution to generate feature enhanced data; Secondly, a noise classifier is constructed and all feature-enhanced data are traversed to filter the noise of the feature-enhanced data to obtain the denoised sewage data; Feature extraction module: construct a gated recurrent unit based on attention update, and then extract features from the pH value, chemical oxygen demand, and ammonia nitrogen data in the denoised sewage data to obtain pH value features, chemical oxygen demand features, and ammonia nitrogen features; Feature fusion and correction module: extract ammonia nitrogen fluctuation features based on the ammonia nitrogen data in the denoised sewage data, and fuse them with the ammonia nitrogen features to obtain updated ammonia nitrogen features; Then, according to the updated ammonia nitrogen characteristics, the ammonia nitrogen data in the denoised sewage data is corrected to obtain the corrected ammonia nitrogen data; Discrimination module: The updated ammonia nitrogen features, pH value features and chemical oxygen demand features are fused to obtain fused features; then, based on the fused features, it is determined whether there is industrial wastewater discharge; the pH value and chemical oxygen demand in the corrected ammonia nitrogen data and the denoised wastewater data are used as detection indicators in the data report; To realize the low-flow sewage monitoring method based on deep learning as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Industrial sewage treatment soft measurement method based on feature structure optimization and deep learning

    CN115758125A

  • Sewer pipe inspection and diagnostic system and method

    US20170323163A1