Method for dynamically detecting flocculation state in sewage
By using a multi-source heterogeneous feature fusion and LSTM-SVM hybrid prediction model, the real-time and accuracy issues of flocculation state detection in wastewater treatment were solved, enabling dynamic detection and cross-scenario adaptation of flocculation state, reducing operation and maintenance costs and improving sludge dewatering efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NORTHWEST A & F UNIV
- Filing Date
- 2026-04-22
- Publication Date
- 2026-07-07
AI Technical Summary
Existing technologies cannot achieve real-time, accurate detection and intelligent control of flocculation status in wastewater treatment, resulting in unstable process operation and high costs, making it difficult to adapt to the needs of rapid deployment in multiple scenarios.
A multi-source heterogeneous feature fusion method is adopted, which combines wavelet multi-scale decomposition, OpenCV image processing and LSTM-SVM hybrid prediction model to construct a comprehensive evaluation index of flocculation state, so as to realize dynamic detection of flocculation state and adaptive control across water quality scenarios.
It achieves comprehensive and accurate quantification and advanced prediction of flocculation state, reduces operation and maintenance costs, improves sludge dewatering efficiency, and adapts to the needs of rapid deployment in multiple scenarios.
Smart Images

Figure CN122079332B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent monitoring technology for wastewater treatment, and in particular to a method for dynamic detection of flocculation state in wastewater. Background Technology
[0002] Flocculation is a core step in solid-liquid separation in processes such as wastewater treatment, sludge dewatering, river and lake dredging, and aggregate washing. The flocculation state directly determines effluent quality, sludge dewatering efficiency, reagent consumption, and operating costs. Currently, the requirements for the stability, economy, and intelligence of solid-liquid separation processes are continuously increasing in areas such as urban wastewater treatment upgrading, industrial wastewater deep treatment, and river and lake ecological environment management. Precise detection and intelligent control of the flocculation state have become a core bottleneck restricting the efficient operation of these processes.
[0003] Existing flocculation status detection methods are mainly divided into the following four categories:
[0004] One method is offline laboratory testing, such as offline testing of flocs using sedimentation ratio (SV30), particle size analyzer, Zeta potential meter, etc. This method requires manual sampling and laboratory analysis, has extremely poor timeliness, cannot achieve real-time control of the process, and can only be used as a post-event verification method.
[0005] Second, there is the online single-index detection method, which uses a single index such as online turbidity meter, pH meter, or industrial camera to detect floc particle size to characterize the flocculation state. This method relies on only a single dimension feature and cannot fully reflect the core attributes of floc such as density, charge characteristics, and organic matter load. It is easily affected by water quality fluctuations and environmental interference, resulting in poor assessment accuracy and inability to support precise control.
[0006] Thirdly, traditional machine learning prediction methods, such as training SVM and neural network models based on single floc features to predict effluent turbidity, have extremely poor generalization ability and are only suitable for specific water quality scenarios. For new water quality / new operating conditions, thousands of labeled samples need to be collected to retrain the model, and the online cycle is as long as 15 to 30 days, which cannot meet the needs of rapid deployment across scenarios. Summary of the Invention
[0007] The purpose of this invention is to provide a method for dynamically detecting the flocculation state in wastewater, thereby solving the aforementioned technical problems.
[0008] To achieve the above objectives, the present invention provides a method for dynamic detection of flocculation state in wastewater, comprising the following steps:
[0009] S1. Simultaneously collect floc images, water quality physicochemical parameters, three-dimensional fluorescence spectra and electrodynamic signals in situ during the flocculation reaction transition zone, construct a time-series raw dataset and complete the calibration of homologous data;
[0010] S2. Based on the time-series raw dataset output by S1, wavelet multi-scale decomposition and OpenCV are used to perform image denoising, enhancement and standardization. Dynamic floc target segmentation and morphological optimization are achieved by three-frame difference and particle swarm optimization Otsu method, and the segmented floc image is output.
[0011] S3. Based on the segmented floc images output by S2, extract geometric features and combine Stokes' formula to extrapolate the floc settling velocity in real time. At the same time, integrate the water quality physicochemical features, three-dimensional fluorescence features and electrodynamic features extracted from the time-series original dataset output by S1 to form a multi-dimensional feature dataset.
[0012] S4. Based on the multi-dimensional feature dataset output by S3, a random forest is used to assign weights based on feature importance. A comprehensive evaluation index for flocculation state, which integrates geometry, water quality physicochemical properties, three-dimensional fluorescence, and electrodynamics, is constructed, and a time series sequence of the comprehensive evaluation index for flocculation state is output.
[0013] S5. Based on the time series of the comprehensive evaluation index of flocculation state output by S4, construct an LSTM-SVM hybrid prediction model, combine transfer learning to achieve cross-water quality scenario adaptation, and output the prediction results of the comprehensive evaluation index of flocculation state and sedimentation turbidity for future periods.
[0014] Therefore, the present invention employs the above-mentioned method for dynamic detection of flocculation state in wastewater, which has the following beneficial effects:
[0015] 1. Multi-source heterogeneous feature fusion and FFSI comprehensive assessment to achieve comprehensive and accurate quantification of flocculation state: By integrating floc geometric features, sedimentation features, water quality physicochemical features, three-dimensional fluorescence organic matter features, and electrodynamic features, a comprehensive flocculation state assessment index (FFSI) is constructed. This completely solves the shortcomings of traditional single image / single physicochemical index that cannot fully characterize core attributes such as floc density, charge characteristics, and organic matter load, and greatly improves the accuracy and reliability of flocculation state assessment.
[0016] 2. Hierarchical transfer learning strategy to achieve rapid adaptation of small samples across water quality scenarios: The hierarchical transfer learning strategy of "freezing the LSTM underlying temporal coding module and only fine-tuning the SVM regression layer / Lagrange multiplier" can complete the model adaptation with only 100 or less small samples of the target scenario. This solves the pain points of traditional machine learning models that require a large number of labeled samples and have a long deployment cycle for new water quality / new working conditions. It is suitable for multiple application scenarios such as municipal sewage, industrial wastewater, and river and lake dredging.
[0017] 3. LSTM-SVM hybrid prediction model to achieve accurate prediction of flocculation state and effluent turbidity: The hybrid prediction model is trained based on time-series multi-dimensional features and can predict the future flocculation state and post-settling turbidity 10-30 minutes in advance. Combined with closed-loop control rules, it can achieve early intervention, which completely solves the problem of lag in traditional methods based on post-effect control of effluent turbidity, effectively avoids fluctuations in effluent water quality, and ensures stable compliance of effluent standards.
[0018] 4. A closed-loop self-optimization mechanism throughout the entire process enables the method to operate adaptively in the long term: By continuously updating feature weights, model parameters and control rules through incremental learning, it can adapt to long-term fluctuations in water quality and changes in operating conditions without manual intervention. This solves the problem of traditional models drifting with operating conditions and requiring regular manual calibration, and significantly reduces operation and maintenance costs.
[0019] 5. Flocculation-electroosmosis coupled and coordinated control to achieve synergistic optimization of the entire process: based on real-time... The method dynamically matches the electroosmotic dewatering voltage to achieve synergistic optimization between the flocculation reaction and the subsequent electroosmotic dewatering process, effectively improving sludge dewatering efficiency, reducing power consumption, and expanding the application boundaries of the method in sludge dewatering, river and lake dredging, aggregate washing and other scenarios.
[0020] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0021] Figure 1 This is a flowchart of a method for dynamic detection of flocculation state in wastewater according to the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of the present invention and are not intended to limit the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of this application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout.
[0023] It should be noted that the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, such as a process, method, system, product, or server that includes a series of steps or units, not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or device.
[0024] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0025] like Figure 1 As shown, a method for dynamic detection of flocculation state in wastewater includes the following steps:
[0026] S1. Simultaneously collect floc images, water quality physicochemical parameters, three-dimensional fluorescence spectra, and electrodynamic signals in situ during the flocculation reaction transition section, construct a time-series raw dataset, and complete the calibration of homologous data; In this embodiment, the excitation wavelength of the three-dimensional fluorescence spectrometer is 245nm-500nm, and the emission wavelength is 244nm-826nm.
[0027] S2. Based on the time-series raw dataset output by S1, wavelet multi-scale decomposition and OpenCV are used to perform image denoising, enhancement and standardization. Dynamic floc target segmentation and morphological optimization are achieved by three-frame difference and particle swarm optimization Otsu method, and the segmented floc image is output.
[0028] S3. Based on the segmented floc images output by S2, extract geometric features and combine Stokes' formula to extrapolate the floc settling velocity in real time. At the same time, integrate the water quality physicochemical features, three-dimensional fluorescence features and electrodynamic features extracted from the time-series original dataset output by S1 to form a multi-dimensional feature dataset.
[0029] S4. Based on the multi-dimensional feature dataset output by S3, a random forest is used to assign weights based on feature importance. A comprehensive evaluation index for flocculation state, which integrates geometry, water quality physicochemical properties, three-dimensional fluorescence, and electrodynamics, is constructed, and a time series sequence of the comprehensive evaluation index for flocculation state is output.
[0030] S5. Based on the time series of the comprehensive evaluation index of flocculation state output by S4, construct an LSTM-SVM hybrid prediction model, combine transfer learning to achieve cross-water quality scenario adaptation, and output the prediction results of the comprehensive evaluation index of flocculation state and sedimentation turbidity for future periods.
[0031] The water physicochemical parameters mentioned in step S1 include electrical conductivity. pH Water temperature and the turbidity of the settled water ;
[0032] Electrodynamic signals include Zeta potentials and electroosmotic migration rate .
[0033] Step S2 specifically includes the following steps:
[0034] S21. Image size standardization and cropping: Using the OpenCV resampling algorithm, all floc images acquired in S1 are uniformly adjusted to 512×512 pixels, and invalid edge areas are removed, while the floc detection area is retained, and a standardized size image is output.
[0035] S22. Wavelet Multi-Scale Decomposition and Noise Reduction: Based on the Daubechiesdb4 wavelet basis, a three-level decomposition is performed on the normalized image, decomposing the normalized image into one approximate component. and 3 detail components , and Then and Set the coefficient to zero and retain. and The image is reconstructed to obtain the wavelet-denoised image;
[0036] S23. Perform weighted grayscale conversion and pixel normalization sequentially on the wavelet-denoised image to obtain a grayscale-normalized standard image.
[0037] S24. Perform global histogram equalization on the grayscale normalized image to stretch the image's grayscale dynamic range, enhance floc texture and boundary features, and output the noise-reduced and enhanced grayscale image.
[0038] S25. Read three consecutive frames of denoised and enhanced grayscale images, and calculate the difference image between the preceding and following frames to obtain the difference image of the dynamic flocculent target region; the calculation formula for the difference image between the preceding and following frames is as follows:
[0039] ;
[0040] in,
[0041] ;
[0042] ;
[0043] In the formula, This represents the fused difference image. Represents the horizontal and vertical coordinates of image pixels; This represents the difference image between the current frame and the previous frame; Represents pixel point operators; This represents the difference image between the current frame and the next frame; Indicates the pixel value of the current frame image; This represents the pixel value of the previous frame. Indicates the pixel value of the next frame of the image;
[0044] S26. Taking the maximum inter-class variance as the optimization objective, the optimal segmentation threshold is automatically found through the particle swarm optimization algorithm.
[0045] S261. Constructing the Otsu method's inter-class variance objective function:
[0046] ;
[0047] In the formula, Indicates the variance between foreground and background classes; Indicates the proportion of foreground pixels; Indicates the percentage of background pixels; This represents the average grayscale value of the foreground pixels; This represents the average grayscale value of the background pixels;
[0048] S262. Perform particle swarm optimization to find the optimal segmentation threshold, and the particle velocity and position update formulas are as follows:
[0049] ;
[0050] ;
[0051] In the formula, and They represent the first Individual particles Time and The speed of time; Indicates inertia weight; and All represent learning factors; and All numbers are random numbers between 0 and 1; Indicates the first The optimal threshold for each individual particle; Indicates the first Individual particles The position at that moment; Represents the globally optimal threshold; indicates; Indicates the first Individual particles The position at that moment;
[0052] S263. Perform image binarization segmentation based on the optimal segmentation threshold and output a preliminary segmented binary image;
[0053] S27. Using a 3×3 structuring element, perform morphological opening operations (smoothing floc boundaries, removing minor noise, and separating adherent flocs) and morphological closing operations (filling in internal pores of flocs and restoring the true contour) in sequence, remove false targets, repair the complete contour of flocs, and output the final segmented floc image.
[0054] Step S3 specifically includes the following steps:
[0055] S31. Perform connected component traversal on the segmented flocculent image output from S2 to extract geometric features. ;
[0056] S311, Number of flocs extracted Area of a single floc Perimeter of a single floc Maximum horizontal length of a single floc and the maximum vertical width of a single floc. :
[0057] ;
[0058] ;
[0059] ;
[0060] ;
[0061] ;
[0062] In the formula, Indicates the total number of connected components; This represents the total number of pixels within the connected component of the flocculent. This indicates the total number of pixels at the edge of the flocculent outline; Represents flocculent pixels The set of x-coordinates; Represents flocculent pixels The set of ordinates;
[0063] S312. Based on area, perimeter, aspect ratio, and hollowness, perform equivalent diameter correction on irregular flocs and output the equivalent diameter feature set. ;
[0064] in,
[0065] ;
[0066] ;
[0067] In the formula, Indicates the equivalent diameter of a single floc; , , These represent the perimeter correction factor, aspect ratio correction factor, and hollowness correction factor, respectively. ; This indicates the aspect ratio of the flocculent, and ; Indicates the area of the hollow interior of the floc; Indicates the average equivalent diameter of the flocs within the field of view; Indicates the first Number of flocculent bodies; Indicates the first equivalent diameter of flocculents;
[0068] S313, Based on floc area and the maximum horizontal length of a single floc The power-law relationship is used to calculate the fractal dimension, which characterizes the density and structural complexity of flocs. :
[0069] ;
[0070] S314. Based on the average equivalent diameter of the flocs within the field of view. and fractal dimension Calculate the effective density of flocs :
[0071] ;
[0072] In the formula, Indicates the density of the wastewater medium; Indicates the dynamic viscosity of wastewater; This represents the initial settlement velocity, and , Indicates the baseline settlement velocity. Indicates the baseline fractal dimension. Represents the empirical coefficient; Represents gravitational acceleration;
[0073] S315, Based on the effective density of flocs The steady-state settling velocity of flocs was calculated using Stokes' theorem. :
[0074] ;
[0075] S32. Extract water quality physicochemical features from the time-series raw dataset output by S1. Three-dimensional fluorescence characteristics and electrodynamic characteristics ;
[0076] in,
[0077] ;
[0078] ;
[0079] ;
[0080] In the formula, , and These represent the proportions of humic acid, fulvic acid, and protein, respectively. , , These represent the fluorescence intensity of humic acid, fulvic acid, and protein, respectively.
[0081] ;
[0082] ;
[0083] In the formula, Indicates the electrophoretic migration rate of flocs; Indicates the dielectric constant of water; Indicates the applied electric field strength; This indicates the amount of water exuded via electroosmosis per unit time. Indicates the effective area of the electrode used to detect electroosmotic migration rate; Indicates the detection time;
[0084] S33, Fusion Geometric Features Physicochemical characteristics of water quality Three-dimensional fluorescence characteristics and electrodynamic characteristics Construct a multi-dimensional feature dataset .
[0085] Step S4 specifically includes the following steps:
[0086] S41. The multi-dimensional feature dataset output in step S3 The 3σ criterion outlier detection and removal, and linear missing value completion are performed sequentially to obtain a standardized multi-dimensional feature set that passes the verification.
[0087] S42. Perform extreme value normalization on each feature in the standardized multi-dimensional feature set after verification, map all dimensional features to the 0-1 interval, and output the full-dimensional normalized feature set.
[0088] S43. Using the turbidity of the settled water as the output target, a random forest model is used to calculate the importance of each feature, and the original set of importance values for each feature is output. , Indicates the first The importance of each feature, and , This represents the total number of decision trees in the random forest. Indicates the first The first of the trees The amount by which the node impurity of a feature is reduced; This represents the total number of features participating in the fusion, and ;
[0089] S44. Normalize the feature importance so that the sum of all weights is 1, forming the weighted coefficient of the comprehensive evaluation index of flocculation state:
[0090] ;
[0091] In the formula, Indicates the first The final weight of each feature; This represents the sum of the importance of all features, and ;
[0092] S45. Sum the features with their corresponding weights to obtain the comprehensive evaluation index of flocculation state. :
[0093] ;
[0094] In the formula, Indicates the first The normalized value of the feature;
[0095] S46. Calculate the comprehensive evaluation index of flocculation state at each time step. The time series of the comprehensive evaluation index of flocculation state was obtained.
[0096] Step S46 is followed by S47, which involves comprehensively evaluating the flocculation state index. The flocculation state is divided into five levels:
[0097] .
[0098] Step S5 specifically includes the following steps:
[0099] S51. Based on the time series sequence of the comprehensive evaluation index of flocculation state output by S4 and the multi-dimensional features output by S3, construct a time series input sample with a fixed time window. and predicted label vector The training set, validation set, and test set are divided in a 7:2:1 ratio.
[0100] in,
[0101] ;
[0102] ;
[0103] In the formula, express Time-normalized characteristics and flocculation state comprehensive evaluation index A combined vector; Indicates the length of the time window; express Comprehensive evaluation index of flocculation state at any time; express Turbidity of water after settling;
[0104] S52. Using an LSTM network to process time-series input samples Contextual features are extracted, and a temporal encoded feature set containing temporal evolution patterns is output.
[0105] S53. Input the time-series encoded feature set output by the LSTM network into the SVM regression model to train and obtain the basic hybrid prediction model.
[0106] S54. Based on parameter migration and feature mapping strategies, the basic mixed prediction model is migrated to the new water quality scenario;
[0107] S541. Construct the feature mapping transformation from the source domain to the target domain:
[0108] ;
[0109] In the formula, This represents the features after mapping the target scenario (the new water quality scenario to be adapted); Represents the feature mapping transformation matrix; Represents the original characteristics of the source scenario (baseline water quality scenario); This represents the feature mapping bias term;
[0110] S542. Freeze all weights and biases of the LSTM bottom-level temporal coding module (after freezing, the LSTM is only used as a fixed feature extractor), keep the learned flocculation state comprehensive evaluation index temporal features unchanged; only adaptively adjust the SVM regression layer parameters;
[0111] When the number of samples in the target scene At that time, the gradient descent method of the original problem is used to adjust the weight vector and bias term;
[0112] At this point, with the goal of minimizing the mean square error between the measured and predicted values of the target scene, the SVM regression layer is adjusted as follows:
[0113] ;
[0114] In the formula, Indicates the adjustment of the loss function; Indicates the number of samples in the target scene; Indicates the first Predicted labels for each sample; This represents the weight vector to be adjusted in the SVM regression layer. transpose; This indicates that the LSTM has a fixed output feature, and , This represents the operation of freezing all weights and biases of the underlying timing coding module of the LSTM; This indicates the bias term to be adjusted in the SVM; Represents the regularization coefficient;
[0115] Mini-batch gradient descent is used to iteratively update the parameters of the SVM regression layer until the convergence threshold is met.
[0116] ;
[0117] ;
[0118] In the formula, and They represent the first The weights and biases are adjusted in the next iteration; and They represent the first The weights and biases are adjusted in the next iteration; This indicates an adjustment to the learning rate; This represents the gradient of the loss with respect to the weights; This represents the loss gradient with respect to the bias.
[0119] when At that time, based on the dual problem of ε-support vector regression, with the optimization objective of minimizing the deviation between the measured and predicted values of the target scene, a Lagrange dual optimization function is constructed, and model adaptation is achieved by adjusting only the Lagrange multipliers:
[0120] ;
[0121] Constraints:
[0122] ;
[0123] In the formula, Indicated by Lagrange multipliers , To optimize the objective by minimizing the variables; and They represent the first The Lagrange dual multipliers and the original multipliers of the SVM regression layer corresponding to each sample need to be adjusted; and They represent the first The Lagrange dual multipliers and the original multipliers of the SVM regression layer corresponding to each sample need to be adjusted; Denotes the polynomial kernel function, and , This represents the kernel function offset. Denotes the order of a polynomial. All are fixed output features of LSTM; Indicates the width of the ε-insensitive region; Indicates the penalty factor;
[0124] The Lagrange multipliers are iteratively updated using a sequential minimum optimization algorithm until the convergence threshold is met.
[0125] ;
[0126] ;
[0127] in,
[0128] ;
[0129] ;
[0130] In the formula, and They represent the first The updated Lagrange dual multipliers and original multipliers for each sample; and They represent the first Lagrange dual multipliers and original multipliers before each sample update; and They represent the first The update amounts of the Lagrange dual multipliers and the original multipliers in the SVM regression layer corresponding to each sample need to be adjusted. Indicates the first The number of Lagrange multipliers in each sample that has not been edited or updated, and , and They represent the first The first sample and the first The prediction error for each sample. Represents the second derivative of a multinomial kernel function;
[0131] After iterative convergence, the SVM regression layer weight vector and bias terms are updated based on the optimal Lagrange multipliers:
[0132] ;
[0133] ;
[0134] S543. Calculate the prediction loss of the hybrid prediction model after transfer learning:
[0135] ;
[0136] In the formula, This represents the loss value optimized by transfer learning; Indicates the model's predicted value;
[0137] S544, Output cross-scene adaptive hybrid prediction model;
[0138] S55. Input real-time time-series samples into the cross-scenario adaptive hybrid prediction model to infer the predicted value of the comprehensive evaluation index of flocculation state in future time periods. Predicted turbidity after sedimentation .
[0139] Step S55 is followed by step S56, which involves predicting the value of the comprehensive evaluation index based on the flocculation state. Predicted turbidity after settling Zeta potential and settling velocity Construct joint early warning rules to determine whether the flocculation state is abnormal:
[0140] ;
[0141] In the formula, This indicates a warning signal; 1 indicates an abnormality, and 0 indicates normal operation.
[0142] Step S5 is followed by S6, which is a comprehensive evaluation index of flocculation state based on the prediction results output by S5 and the output of S4. A flocculation control rule base is established, and the coagulant dosage, stirring speed and electroosmosis voltage are output to form a detection, prediction and control closed loop.
[0143] Specifically, it includes the following steps:
[0144] S61. Measured value of the comprehensive evaluation index based on flocculation state Predicted value of comprehensive evaluation index of flocculation state To address the deviation, an adaptive adjustment model for dosage is constructed:
[0145] ;
[0146] In the formula, This indicates the optimal dosage of coagulant; Indicates the baseline dosage; This represents the dosage adjustment coefficient;
[0147] S62. Based on the average equivalent diameter of the flocs within the field of view. Determine the stirring speed:
[0148] ;
[0149] In the formula, Indicates the optimal stirring speed; Indicates the reference stirring speed; Indicates the stirring adjustment coefficient; Indicates the target's equivalent diameter;
[0150] S63. Measured values of the comprehensive evaluation index based on flocculation status. Matching the electroosmotic voltage to achieve optimal operation of flocculation-electroosmosis coupling:
[0151] ;
[0152] In the formula, Indicates the optimal electroosmotic voltage; Indicates the reference electroosmotic voltage; Indicates the voltage regulation coefficient;
[0153] S64. Add the following upper and lower limit constraints:
[0154] ;
[0155] ;
[0156] ;
[0157] In the formula, and These represent the lower and upper limits of the coagulant dosage, respectively. and These represent the lower and upper limits of the stirring speed, respectively; and These represent the lower and upper limits of the electroosmotic voltage, respectively.
[0158] Step S6 is followed by S7, which includes the control parameters based on the output of S6 and the multi-dimensional feature dataset based on the output of S3, and steps S4 and S5 are continuously updated.
[0159] Experimental verification
[0160] Experimental scenarios: A municipal wastewater treatment plant (source scenario, stable water quality, 12,000 labeled samples) and an industrial wastewater treatment plant in a chemical industrial park (target scenario, high salinity, high organic matter load, only 50 labeled small samples) were selected as experimental subjects;
[0161] Three control groups were set up: Control group 1: Traditional single-image floc size detection method; Control group 2: Traditional SVM prediction model (no transfer learning, requires training with full samples).
[0162] Experimental indicators: accuracy of flocculation state assessment, accuracy of effluent turbidity prediction (coefficient of determination R) 2 The daily average dosage of PAC reagent, the daily average moisture content of sludge dewatering, the online cycle of the target scenario model, and the compliance rate of effluent turbidity.
[0163] Experimental Procedure: Step 1, Source Scene Model Training: Based on 12,000 labeled samples from a municipal wastewater treatment plant, the LSTM-SVM basic hybrid prediction model of this invention was trained, and a multi-dimensional feature dataset and FFSI comprehensive evaluation system were constructed. Step 2, Target Scene Transfer Adaptation: For 50 small samples from an industrial wastewater treatment plant, the hierarchical transfer learning strategy of this invention (freezing the LSTM bottom layer and only fine-tuning the Lagrange multipliers of the SVM regression layer) was adopted to complete the model's cross-scene adaptation. Step 3, Online Operation and Comparison: The invention was continuously operated in an industrial wastewater treatment plant for 30 days, performing real-time flocculation state detection, effluent turbidity prediction, and closed-loop control of chemical dosage and electroosmotic voltage. At the same time, two control group schemes were operated simultaneously, and various experimental indicators were recorded. Step 4, Data Statistics and Analysis: Statistical analysis was performed on the 30-day operation data to compare the performance differences of each scheme.
[0164] Table 1 Experimental Results
[0165]
[0166] As shown in Table 1, this invention constructs FFSI by floc fusion of multi-source heterogeneous features, which comprehensively covers five major categories of core properties of flocs: geometry, sedimentation, physicochemical properties, fluorescence, and electrodynamics. The evaluation accuracy reaches 97.2%, which is 35.4% higher than control group 1 and 20.1% higher than control group 2. This completely solves the problems of single features and inaccurate evaluation in traditional methods.
[0167] The LSTM-SVM hybrid prediction model of this invention, combined with hierarchical transfer learning, achieves high accuracy in predicting effluent turbidity R0 in a target scenario with only 50 sets of samples. 2 The turbidity level reached 0.96, which is much higher than that of control group 1 and control group 2. It can accurately predict the turbidity of the effluent 20 minutes in advance, realize advanced regulation, and avoid fluctuations in effluent water quality from the source.
[0168] By precisely controlling the dosage in advance, the dosage of PAC agent in this invention is reduced by more than 25% compared with the traditional method, which significantly reduces the agent cost; at the same time, through the coupled control of flocculation and electroosmosis, the sludge dewatering moisture content is reduced by more than 7.6%, which effectively reduces the sludge disposal cost.
[0169] Through hierarchical transfer learning, this invention can complete the model adaptation for new water quality scenarios in just one day, shortening the deployment cycle by more than 93% compared to traditional solutions, greatly improving engineering deployment efficiency, and adapting to the rapid deployment needs of multiple scenarios.
[0170] This invention operates continuously for 30 days, achieving a turbidity compliance rate of 99.8% in the effluent, far exceeding the 91.7%-94.3% of traditional solutions. Furthermore, through a full-process self-optimization mechanism, the model accuracy shows no significant drift, eliminating the need for manual calibration and significantly reducing operation and maintenance costs.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for dynamic detection of flocculation state in wastewater, characterized in that: Includes the following steps: S1. Simultaneously collect floc images, water quality physicochemical parameters, three-dimensional fluorescence spectra and electrodynamic signals in situ during the flocculation reaction transition zone, construct a time-series raw dataset and complete the calibration of homologous data; Electrodynamic signals include Zeta potentials and electroosmotic migration rate ; S2. Based on the time-series raw dataset output by S1, wavelet multi-scale decomposition and OpenCV are used to perform image denoising, enhancement and standardization. Dynamic floc target segmentation and morphological optimization are achieved by three-frame difference and particle swarm optimization Otsu method, and the segmented floc image is output. S3. Based on the segmented floc images output by S2, extract geometric features and combine Stokes' formula to extrapolate the floc settling velocity in real time. At the same time, integrate the water quality physicochemical features, three-dimensional fluorescence features and electrodynamic features extracted from the time-series raw dataset output by S1 to form a multi-dimensional feature dataset. S4. Based on the multi-dimensional feature dataset output by S3, a random forest is used to assign weights based on feature importance. A comprehensive evaluation index for flocculation state, which integrates geometry, water quality physicochemical properties, three-dimensional fluorescence, and electrodynamics, is constructed, and a time series sequence of the comprehensive evaluation index for flocculation state is output. S5. Based on the time series of the comprehensive evaluation index of flocculation state output by S4, an LSTM-SVM hybrid prediction model is constructed. Combined with transfer learning, it achieves adaptation across water quality scenarios and outputs the prediction results of the comprehensive evaluation index of flocculation state and the turbidity after settling in future periods.
2. The method for dynamic detection of flocculation state in wastewater according to claim 1, characterized in that: The water physicochemical parameters mentioned in step S1 include electrical conductivity. pH Water temperature and the turbidity of the settled water .
3. The method for dynamic detection of flocculation state in wastewater according to claim 2, characterized in that: Step S2 specifically includes the following steps: S21. Image size standardization and cropping: Using the OpenCV resampling algorithm, all floc images acquired in S1 are uniformly adjusted to 512×512 pixels, and invalid edge areas are removed, while the floc detection area is retained, and a standardized size image is output. S22. Wavelet Multi-Scale Decomposition and Noise Reduction: Based on the Daubechiesdb4 wavelet basis, a three-level decomposition is performed on the normalized image, decomposing the normalized image into one approximate component. and 3 detail components , and Then and Set coefficients to zero and retain. and The image is reconstructed to obtain the wavelet-denoised image; S23. Perform weighted grayscale conversion and pixel normalization sequentially on the wavelet-denoised image to obtain a grayscale-normalized standard image. S24. Perform global histogram equalization on the grayscale normalized image to stretch the image's grayscale dynamic range and output the noise-reduced and enhanced grayscale image. S25. Read three consecutive frames of denoised and enhanced grayscale images, and calculate the difference image between the preceding and following frames to obtain the difference image of the dynamic flocculent target region; the calculation formula for the difference image between the preceding and following frames is as follows: ; in, ; ; In the formula, This represents the fused difference image. Represents the horizontal and vertical coordinates of image pixels; This represents the difference image between the current frame and the previous frame; Represents pixel point operators; This represents the difference image between the current frame and the next frame; Indicates the pixel value of the current frame image; This represents the pixel value of the previous frame. Indicates the pixel value of the next frame of the image; S26. Taking the maximum inter-class variance as the optimization objective, the optimal segmentation threshold is automatically found through the particle swarm optimization algorithm. S261. Constructing the Otsu method's inter-class variance objective function: ; In the formula, Indicates the variance between foreground and background classes; Indicates the proportion of foreground pixels; Indicates the percentage of background pixels; This represents the average grayscale value of the foreground pixels; This represents the average grayscale value of the background pixels; S262. Perform particle swarm optimization to find the optimal segmentation threshold, and the particle velocity and position update formulas are as follows: ; ; In the formula, and They represent the first Individual particles Time and The speed of time; Indicates inertia weight; and All represent learning factors; and All numbers are random numbers between 0 and 1; Indicates the first The optimal threshold for each individual particle; Indicates the first Individual particles The position at that moment; Represents the globally optimal threshold; indicates; Indicates the first Individual particles The position at that moment; S263. Perform image binarization segmentation based on the optimal segmentation threshold and output a preliminary segmented binary image; S27. Using a 3×3 structuring element, perform morphological opening and closing operations sequentially, remove false targets, repair the complete outline of the flocs, and output the final segmented floc image.
4. The method for dynamic detection of flocculation state in wastewater according to claim 3, characterized in that: Step S3 specifically includes the following steps: S31. Perform connected component traversal on the segmented flocculent image output from S2 to extract geometric features. ; S311, Number of flocs extracted Area of a single floc Perimeter of a single floc Maximum horizontal length of a single floc and the maximum vertical width of a single floc. : ; ; ; ; ; In the formula, Indicates the total number of connected components; This represents the total number of pixels within the connected component of the flocculent. This indicates the total number of pixels at the edge of the flocculent outline; Represents flocculent pixels The set of x-coordinates; Represents flocculent pixels The set of ordinates; S312. Based on area, perimeter, aspect ratio, and hollowness, perform equivalent diameter correction on irregular flocs and output the equivalent diameter feature set. ; in, ; ; In the formula, Indicates the equivalent diameter of a single floc; , , These represent the perimeter correction factor, aspect ratio correction factor, and hollowness correction factor, respectively. ; This indicates the aspect ratio of the flocculent, and ; Indicates the area of the hollow interior of the floc; Indicates the average equivalent diameter of the flocs within the field of view; Indicates the first Number of flocculent bodies; Indicates the first equivalent diameter of flocculents; S313, Based on floc area and the maximum horizontal length of a single floc The power-law relationship is used to calculate the fractal dimension, which characterizes the density and structural complexity of flocs. : ; S314. Based on the average equivalent diameter of the flocs within the field of view. and fractal dimension Calculate the effective density of flocs : ; In the formula, Indicates the density of the wastewater medium; Indicates the dynamic viscosity of wastewater; This represents the initial settlement velocity, and , Indicates the baseline settlement velocity. Indicates the baseline fractal dimension. Represents the empirical coefficient; Represents gravitational acceleration; S315, Based on the effective density of flocs The steady-state settling velocity of flocs was calculated using Stokes' theorem. : ; S32. Extract water quality physicochemical features from the time-series raw dataset output by S1. Three-dimensional fluorescence characteristics and electrodynamic characteristics ; in, ; ; ; In the formula, , and These represent the proportions of humic acid, fulvic acid, and protein, respectively. , , These represent the fluorescence intensity of humic acid, fulvic acid, and protein, respectively. ; ; In the formula, Indicates the electrophoretic migration rate of flocs; Indicates the dielectric constant of water; Indicates the applied electric field strength; This indicates the amount of water exuded via electroosmosis per unit time. Indicates the effective area of the electrode used to detect electroosmotic migration rate; Indicates the detection time; S33, Fusion Geometric Features Physicochemical characteristics of water quality Three-dimensional fluorescence characteristics and electrodynamic characteristics Construct a multi-dimensional feature dataset .
5. The method for dynamic detection of flocculation state in wastewater according to claim 4, characterized in that: Step S4 Specifically, the following steps are included: S41. The multi-dimensional feature dataset output in step S3 The 3σ criterion outlier detection and removal, and linear missing value completion are performed sequentially to obtain a standardized multi-dimensional feature set that passes the verification. S42. Perform extreme value normalization on each feature in the standardized multi-dimensional feature set after verification, map all dimensional features to the 0-1 interval, and output the full-dimensional normalized feature set. S43. Using the turbidity of the settled water as the output target, a random forest model is used to calculate the importance of each feature, and the original set of importance values for each feature is output. , Indicates the first The importance of each feature, and , This represents the total number of decision trees in the random forest. Indicates the first The first of the trees The amount by which the node impurity of a feature is reduced; This represents the total number of features participating in the fusion, and ; S44. Normalize the feature importance so that the sum of all weights is 1, forming the weighted coefficient of the comprehensive evaluation index of flocculation state: ; In the formula, Indicates the first The final weight of each feature; This represents the sum of the importance of all features, and ; S45. Sum the features with their corresponding weights to obtain the comprehensive evaluation index of flocculation state. : ; In the formula, Indicates the first The normalized value of the feature; S46. Calculate the comprehensive evaluation index of flocculation state at each time step. The time series of the comprehensive evaluation index of flocculation state was obtained.
6. The method for dynamic detection of flocculation state in wastewater according to claim 5, characterized in that: Step S46 is followed by S47, which involves evaluating the comprehensive index based on the flocculation state. The flocculation state is divided into five levels: 。 7. The method for dynamic detection of flocculation state in wastewater according to claim 5, characterized in that: Step S5 specifically includes the following steps: S51. Based on the time series sequence of the comprehensive evaluation index of flocculation state output by S4 and the multi-dimensional features output by S3, construct a time series input sample with a fixed time window. and predicted label vector The training set, validation set, and test set are divided in a 7:2:1 ratio. in, ; ; In the formula, express Time-normalized characteristics and flocculation state comprehensive evaluation index A combined vector; Indicates the length of the time window; express Comprehensive evaluation index of flocculation state at any time; express Turbidity of water after settling; S52. Using an LSTM network to process time-series input samples Contextual features are extracted, and a temporal encoded feature set containing temporal evolution patterns is output. S53. Input the time-series encoded feature set output by the LSTM network into the SVM regression model to train and obtain the basic hybrid prediction model. S54. Based on parameter migration and feature mapping strategies, the basic hybrid prediction model is migrated to the new water quality scenario; S541. Construct the feature mapping transformation from the source domain to the target domain: ; In the formula, Represents the features after mapping the target scene; Represents the feature mapping transformation matrix; Represents the original features of the source scene; This represents the feature mapping bias term; S542. Freeze all weights and biases of the LSTM underlying temporal coding module, keeping the learned flocculation state comprehensive evaluation index temporal features unchanged; only adaptively adjust the SVM regression layer parameters; When the number of samples in the target scene At that time, the gradient descent method of the original problem is used to adjust the weight vector and bias term; At this point, with the goal of minimizing the mean square error between the measured and predicted values of the target scene, the SVM regression layer is adjusted as follows: ; In the formula, Indicates the adjustment of the loss function; Indicates the number of samples in the target scene; Indicates the first Predicted labels for each sample; This represents the weight vector to be adjusted in the SVM regression layer. Transpose of; This indicates that the LSTM has a fixed output feature, and , This represents the operation of freezing all weights and biases of the underlying timing coding module of the LSTM; This indicates the bias term to be adjusted in the SVM; Represents the regularization coefficient; Mini-batch gradient descent is used to iteratively update the parameters of the SVM regression layer until the convergence threshold is met. ; ; In the formula, and They represent the first The weights and biases are adjusted in the next iteration; and They represent the first The weights and biases are adjusted in the next iteration; This indicates an adjustment to the learning rate; This represents the gradient of the loss with respect to the weights; This represents the loss gradient with respect to the bias. when At that time, based on the dual problem of ε-support vector regression, with the optimization objective of minimizing the deviation between the measured and predicted values of the target scene, a Lagrange dual optimization function is constructed, and model adaptation is achieved by adjusting only the Lagrange multipliers: ; Constraints: ; In the formula, Indicated by Lagrange multipliers , To optimize the objective by minimizing the variables; and They represent the first The Lagrange dual multipliers and the original multipliers of the SVM regression layer corresponding to each sample need to be adjusted; and They represent the first The Lagrange dual multipliers and the original multipliers of the SVM regression layer corresponding to each sample need to be adjusted; Denotes the polynomial kernel function, and , This represents the kernel function offset. Denotes the order of a polynomial. All are fixed output features of LSTM; Indicates the width of the ε-insensitive region; Indicates the penalty factor; The Lagrange multipliers are iteratively updated using a sequential minimum optimization algorithm until the convergence threshold is met. ; ; in, ; ; In the formula, and They represent the first The updated Lagrange dual multipliers and original multipliers for each sample; and They represent the first Lagrange dual multipliers and original multipliers before each sample update; and They represent the first The update amounts of the Lagrange dual multipliers and the original multipliers in the SVM regression layer corresponding to each sample need to be adjusted. Indicates the first The number of Lagrange multipliers in each sample that has not been edited or updated, and , and They represent the first The first sample and the first The prediction error for each sample. Represents the second derivative of a multinomial kernel function; After iterative convergence, the SVM regression layer weight vector and bias terms are updated based on the optimal Lagrange multipliers: ; ; S543. Calculate the prediction loss of the hybrid prediction model after transfer learning: ; In the formula, This represents the loss value optimized by transfer learning; Indicates the model's predicted value; S544, Output cross-scene adaptive hybrid prediction model; S55. Input real-time time-series samples into the cross-scenario adaptive hybrid prediction model to infer the predicted value of the comprehensive evaluation index of flocculation state in future time periods. Predicted turbidity after sedimentation .
8. The method for dynamic detection of flocculation state in wastewater according to claim 7, characterized in that: Step S55 is followed by step S56, which involves predicting the value of the comprehensive evaluation index based on the flocculation state. Predicted turbidity after settling Zeta potential and settling velocity Construct joint early warning rules to determine whether the flocculation state is abnormal: ; In the formula, This indicates a warning signal; 1 indicates an abnormality, and 0 indicates normal operation.
9. The method for dynamic detection of flocculation state in wastewater according to claim 7, characterized in that: Step S5 is followed by S6, which is a comprehensive evaluation index of flocculation state based on the prediction results output by S5 and the output of S4. A flocculation control rule base is established, and the coagulant dosage, stirring speed and electroosmosis voltage are output to form a detection, prediction and control closed loop. Specifically, it includes the following steps: S61. Measured value of the comprehensive evaluation index based on flocculation state Predicted value of comprehensive evaluation index of flocculation state To address the deviation, an adaptive adjustment model for dosage is constructed: ; In the formula, This indicates the optimal dosage of coagulant; Indicates the baseline dosage; This represents the dosage adjustment coefficient; S62. Based on the average equivalent diameter of the flocs within the field of view. Determine the stirring speed: ; In the formula, Indicates the optimal stirring speed; Indicates the reference stirring speed; Indicates the stirring adjustment coefficient; Indicates the target's equivalent diameter; S63. Measured values of the comprehensive evaluation index based on flocculation status. Matching the electroosmotic voltage to achieve optimal operation of flocculation-electroosmosis coupling: ; In the formula, Indicates the optimal electroosmotic voltage; Indicates the reference electroosmotic voltage; Indicates the voltage regulation coefficient; S64. Add the following upper and lower limit constraints: ; ; ; In the formula, and These represent the lower and upper limits of the coagulant dosage, respectively. and These represent the lower and upper limits of the stirring speed, respectively; and These represent the lower and upper limits of the electroosmotic voltage, respectively.
10. The method for dynamic detection of flocculation state in wastewater according to claim 9, characterized in that: Step S6 is followed by S7, which includes the control parameters based on the output of S6 and the multi-dimensional feature dataset based on the output of S3, and steps S4 and S5 are continuously updated.