Water coagulation effect prediction method based on ResNet-LSTM

Through the hybrid deep learning model based on ResNet-LSTM, floc images are used to predict flocculation effects, which solves the problems of water quality mutation and difficulty in treating low-temperature and low-turbid water, and accurately controls the amount of flocculant injection, reduces water treatment costs and carbon emissions, and improves water quality stability and safety.

CN120298976APending Publication Date: 2025-07-11SHAANXI CHENGHUA INTELLIGENT ENVIRONMENTAL TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510619877.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The prior art cannot effectively deal with the problems of sudden water quality, difficulty in treating low-temperature and low-turbid water, and excessive flocculant injection, resulting in increased water treatment costs and carbon emissions, and the real-time automatic adjustment of flocculant injection is not possible.

Method used

Using a hybrid deep learning model based on ResNet-LSTM, the floc image at multiple moments is obtained, combined with image feature extraction of the ResNet model and timing analysis of the LSTM model, the flocculation effect level and parameters are predicted, and the flocculant addition amount is achieved.

Benefits of technology

It improves the accuracy and flexibility of flocculation effect prediction, reduces labor costs, optimizes the use of flocculant, reduces water treatment costs and carbon emissions, and ensures the stability and safety of effluent water quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120298976A_ABST
    Figure CN120298976A_ABST
Patent Text Reader

Abstract

The invention discloses a ResNet-LSTM-based water quality coagulation effect prediction method, which comprises the following steps: acquiring a group of to-be-detected floc images of target water quality collected at multiple moments, and inputting a pre-trained mixed deep learning model to obtain a coagulation effect prediction result of the target water quality; wherein the mixed deep learning model comprises a ResNet model and an LSTM (Long Short Term Memory) model which are connected in sequence; the mixed deep learning model is obtained based on training of a water quality floc image data set; the coagulation effect prediction result comprises a flocculation effect grade and / or a flocculation effect parameter; the flocculation effect grades are used for representing flocculation effects of different grades, and the flocculation effect parameters comprise water quality parameters representing the flocculation effects. According to the invention, the ResNet-LSTM model is utilized to predict the water coagulation effect, and intelligent optimization of the adding amount of the flocculant can be realized, so that the water treatment efficiency and the effluent quality are improved, the water supply safety is ensured, the labor cost is reduced, and the automation level is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of water treatment, and particularly relates to a method for predicting the coagulation effect of water quality based on ResNet-LSTM. Background Art

[0002] Water quality coagulation is a key step in the water treatment process, and its effect directly affects the efficiency of subsequent treatment processes and the quality of the effluent. In the coagulation stage, coagulants are added to remove suspended solids and colloidal substances in water. Predicting the effect of this process is of great significance for optimizing the water treatment process, reducing costs, and improving water quality. However, the coagulation effect is affected by various factors, including the type and dosage of coagulants, water quality parameters, hydraulic conditions, etc. The dynamic changes of these factors make the prediction of coagulation effect a complex problem.

[0003] In order to quickly determine the appropriate dosage of flocculant under the limitations of non-linearity and large time delay, currently, the common practice of water service enterprises is to conduct a six-beaker experiment in the laboratory once a day (please refer to the existing six-beaker experiment equipment in water plants shown in Figure 1 ), that is, add different dosages of flocculants to six groups of the same raw water. After completing the beaker flocculation, measure the turbidity of the supernatant in the beaker, that is, the turbidity after sedimentation, to obtain the corresponding relationship between different flocculant dosages and turbidity, and then determine the flocculant dosage according to the experience of technicians.

[0004] The method of determining the flocculant dosage through the six-beaker experiment can basically cope with the daily water treatment of water service enterprises, but there are still the following disadvantages: 1. It cannot cope with sudden changes in water quality. In water treatment, sudden changes in water quality are inevitable. For example, the flood discharge of a reservoir caused by heavy rain in summer, or the turning over of a reservoir due to water shortage, will cause a sharp increase in turbidity. The turbidity of the raw water will rapidly rise from several NTU (Nephelometric Turbidity Units, the unit of turbidity in English) to several hundred or even several thousand NTU within a few hours. In addition, when the production or process of a polluting enterprise changes, it will cause sudden changes in the quality of industrial wastewater. When the raw water changes suddenly, the dosage of the flocculant must be adjusted quickly to achieve the standard of the effluent quality. At this time, it is no longer appropriate to add the dosage determined according to the previous six-beaker experiment. In actual treatment, it can only completely rely on manual experience to determine the dosage. 2. It is difficult to treat low-temperature and low-turbidity water in winter. The flocculant is not fully dissolved at low temperatures, and the low turbidity makes the flocs not grow fully. In this state, the amount of flocculant added is too little, the turbidity removal after flocculation is insufficient, and the effluent turbidity does not meet the standard. When the amount of flocculant added is excessive, the flocculant itself that is not fully dissolved will become a turbidity component, making the effluent turbidity not meet the standard. Therefore, it is usually necessary to repeatedly perform six-beaker experiments and actual dosage adjustments to determine the amount of flocculant added that meets the effluent turbidity requirements; 3. Excessive addition of flocculants. Because it is impossible to automatically adjust the amount of flocculants added in real time according to the changes in the incoming water, in order to ensure that the effluent quality meets the standards, water companies will choose to add excessive flocculants. This excessive addition will increase the cost of water treatment for the company. The increased cost consists of two parts: one is the flocculant cost, and the other is the subsequent treatment cost of other units. For example, excessive flocculants bring more sludge, which increases the sludge treatment fee; excessive flocculants PAC (polyaluminum chloride, also known as basic aluminum chloride or hydroxyaluminum chloride) bring excessive residual aluminum, which requires additional cost to handle.

[0005] 4. Increase carbon emissions. In addition to increased costs, excessive addition of flocculants will also cause more carbon emissions. Water treatment companies are not major direct carbon emitters, but they are major indirect carbon emitters. Among indirect carbon emissions, electricity consumption accounts for the largest proportion, and chemicals rank second. Summary of the invention

[0006] In order to solve the above problems existing in the prior art, the present invention provides a water quality coagulation effect prediction method based on ResNet-LSTM. The technical problem to be solved by the present invention is achieved through the following technical solutions: A water quality coagulation effect prediction method based on ResNet-LSTM, comprising: Obtain a group of floc images to be tested of target water quality collected at multiple moments; The group of floc images to be tested is input into a pre-trained hybrid deep learning model to obtain the coagulation effect prediction result of the target water quality; wherein the hybrid deep learning model includes a ResNet model and an LSTM model connected in sequence; the hybrid deep learning model is trained based on a water quality floc image data set; the coagulation effect prediction result includes a flocculation effect grade and / or a flocculation effect parameter; the flocculation effect grade is used to characterize different levels of flocculation effects, and the flocculation effect parameter includes a water quality parameter characterizing the flocculation effect.

[0007] Beneficial effects of the present invention: The present invention combines the ResNet and LSTM models for predicting the water quality coagulation effect. The advantage of the ResNet-LSTM model lies in its ability to sensitively capture the dynamic changes in the water quality coagulation process. Through the deep structure and residual learning mechanism of the ResNet model, it can effectively extract key features from continuously captured floc images, which are crucial for understanding the subtle changes in the coagulation process. The introduction of the LSTM model enables the capture of temporal dynamics. It can learn the temporal patterns in the image sequence, thereby better understanding the evolution of the coagulation process. From the sequence of floc image data extracted by the ResNet model, the LSTM can identify potential key factors affecting the coagulation effect and predict how these factors affect the coagulation effect over time. Thanks to the image feature extraction ability of ResNet and the temporal analysis ability of LSTM, the prediction accuracy of this hybrid model of the present invention has been significantly improved. In addition, the model can adapt to new data and changing conditions, with good generalization ability and flexibility, which is particularly important for coping with the uncertainties and changes in the actual water treatment process. The experimental results show that compared with the classical LSTM model and other machine learning models, the ResNet-LSTM model can better handle the non-linearity and non-stationarity of water quality data and provide more accurate prediction results of the coagulation effect.

[0008] Furthermore, according to the prediction result of the water quality coagulation effect, the dosage of the coagulant can be determined, thereby achieving precise dosing. It helps to promote the progress of water treatment technology, improve the efficiency and stability of the operation of the water purification process, enhance the operation management and control level of the water purification process, reduce labor costs, and ensure the safety of drinking water quality. Description of the Drawings

[0009] Figure 1 It is a physical diagram of the existing six-beaker experiment equipment; Figure 2 It is a schematic flowchart of a method for predicting the water quality coagulation effect based on ResNet-LSTM provided by an embodiment of the present invention; Figure 3 It is a schematic diagram of the overall process of the method for predicting the water quality coagulation effect based on ResNet-LSTM in an embodiment of the present invention; Figure 4 It is a schematic diagram of the process of one iteration training of the hybrid deep learning model in an embodiment of the present invention; Figure 5 It is a schematic diagram of the residual mapping structure; Figure 6 It is a schematic diagram of the structure of the ResNet model obtained from the 34-layer convolutional neural network structure based on residual connections in an embodiment of the present invention; Figure 7 It is a schematic diagram of the overall calculation framework of the LSTM model in an embodiment of the present invention; Figure 8 It is a schematic diagram of the internal structure of the ResNet18 model; Figure 9 It is a schematic diagram of the internal structure of basic block 1 in the ResNet18 model; Figure 10 It is a schematic diagram of the internal structure of basic block 2 in the ResNet18 model; Figure 11 It is a schematic diagram of the internal structure of basic block 3 in the ResNet18 model; Figure 12 It is a schematic diagram of the internal structure of the ResNet50 model; Figure 13 It is a schematic diagram of the internal structure of bottleneck block 1 in the ResNet50 model; Figure 14 It is a schematic diagram of the internal structure of bottleneck block 2 in the ResNet50 model; Figure 15 It is a schematic diagram of the internal structure of bottleneck block 3 in the ResNet50 model; Figure 16 It is a schematic diagram of the internal structure of bottleneck block 4 in the ResNet50 model. Specific implementation manners

[0010] The present invention will be further described in detail below with reference to specific embodiments, but the implementation manners of the present invention are not limited thereto.

[0011] At present, there are already some existing technologies for predicting flocculation effects based on artificial intelligence algorithms, mainly including two categories. One is to predict turbidity through the flocs generated during the coagulation process, and then determine the dosage of the flocculant. In the paper "Dosage optimization of polyaluminum chloride by the application of convolutional neural network to the floc images captured in jar tests" by Yamamura et al., jar tests for flocculation were photographed, and the CNN neural network algorithm was used to train a model based on the floc images to achieve rapid prediction of the turbidity of the supernatant after sedimentation. In the patent "A method for establishing an intelligent monitoring and linkage system for coagulation" publicly disclosed by the State Intellectual Property Office on November 22, 2022, a camera was used to capture the images of the flocs in the coagulation tank, which were combined with the influent parameters to jointly predict the dosage of the flocculant and the turbidity of the supernatant after sedimentation at the tail of the horizontal flow sedimentation tank. The other is to use the historical operation data of the water plant to predict the flocculation effect. In the paper "Coagulant dosage determination using deep learning-based graph attention multivariate time series forecasting model" by Lin et al., the graph attention neural network algorithm was used to train based on the historical data of the water plant to achieve the prediction of the dosage of the incoming water flocculant. In the patent "Coagulation sedimentation control method, device, equipment and storage medium" publicly disclosed by the State Intellectual Property Office on March 14, 2023, the influent parameters at the inlet end of the sedimentation container in a preset water purification plant and the preset dosage of a preset coagulant were obtained; according to the influent parameters and the dosage, a pre-trained turbidity time series prediction model was used for processing to obtain the predicted value of the effluent turbidity at the outlet end of the sedimentation container; according to the predicted value of the effluent turbidity, the preset dosage was adjusted to obtain the target dosage; according to the target dosage, the dosing device was controlled to dose the preset coagulant with the target dosage into the sedimentation container.

[0012] However, in the cup flocculation process, a group of continuously taken floc images have a clear time sequence between the photos, while the CNN network predicts the samples as isolated individuals. Therefore, simply using the CNN neural network for turbidity prediction cannot effectively utilize the time sequence information of the floc images. At the same time, simply predicting the turbidity cannot achieve the regulation and optimization of the dosage. Using an underwater camera to photograph the alum flowers at the water inlet of the sedimentation tank, the quality of the alum flowers is difficult to guarantee due to the dim underwater light. In addition, the humid environment in the water will also cause great damage to the service life of equipment such as cameras, resulting in frequent equipment replacement and high cost of use. The model trained using the historical operation data of the water plant can only determine the historical dosage corresponding to the current water quality based on the inlet parameters, but cannot fit a better flocculant dosage relationship, that is, it is impossible to optimize the dosage.

[0013] In order to solve the above problems, the embodiment of the present invention provides a water quality coagulation effect prediction method based on ResNet-LSTM, such as Figure 2 As shown, the method may include the following steps: S1, obtaining a group of floc images of target water quality collected at multiple moments; The embodiment of the present invention can utilize image acquisition equipment to sample target water quality, such as reservoirs and rivers, at multiple consecutive moments and capture floc images corresponding to the water samples, thereby obtaining multiple floc images of the target water quality arranged at the acquisition moments.

[0014] After data preprocessing, multiple floc images of target water quality are obtained to obtain a group of floc images to be tested of target water quality. The group of floc images to be tested of target water quality will be used as a sample to be tested and sent to the pre-trained hybrid deep learning model. For the data preprocessing process, please refer to the relevant description of the hybrid deep learning model training process.

[0015] The number of floc images in the group of floc images to be tested is the same as the number of floc images contained in each sample during the training process of the hybrid deep learning model.

[0016] S2, inputting the set of floc images to be tested into a pre-trained hybrid deep learning model to obtain a prediction result of the coagulation effect of the target water quality; Among them, the hybrid deep learning model includes a ResNet model and an LSTM model connected sequentially; the hybrid deep learning model is trained based on a water quality floc image data set; the coagulation effect prediction result includes a flocculation effect grade and / or a flocculation effect parameter; the flocculation effect grade is used to characterize different levels of flocculation effects, and the flocculation effect parameter includes a water quality parameter that characterizes the flocculation effect.

[0017] In an optional embodiment, the flocculation effect level includes perfect flocculation, very good flocculation, good flocculation, better flocculation, appropriate flocculation, general flocculation, slightly poor flocculation, significantly poor flocculation, very poor flocculation, and no flocculation, a total of 10 levels, indicating that the flocculation effect becomes worse in sequence, which can be represented by 1 to 10 respectively. Of course, these numbers are only an example of an identification method for a flocculation effect level and do not constitute a limitation to the embodiments of the present invention.

[0018] The flocculation effect parameters include pH value, temperature, nephelometric turbidity unit (NTU), chemical oxygen demand (COD), absorbance at A275 and absorbance at A220.

[0019] Among them, when determining the total nitrogen in water quality by ultraviolet spectrophotometry, the absorbance A220 mainly reflects the content of nitrate nitrogen in the water, while the absorbance A275 reflects the interference of organic matter in the water. By measuring the absorbance at these two wavelengths, the formula can be used to correct the interference of organic matter, so as to more accurately determine the total nitrogen content in the water sample.

[0020] Of course, in the embodiments of the present invention, the water quality parameters characterizing the flocculation effect are not limited to the above parameters.

[0021] In an embodiment of the present invention, the coagulation effect prediction result output by the pre-trained hybrid deep learning model can be the flocculation effect level, the flocculation effect parameter, or both, which corresponds to the type of label data used in the training process of the hybrid deep learning model.

[0022] The embodiment of the present invention combines the ResNet model and the LSTM model to construct a hybrid deep learning model, and inputs a set of floc images of the target water quality to be tested into the trained hybrid deep learning model. The coagulation effect prediction result of the target water quality can be obtained through the image feature extraction of the ResNet model and the time series feature extraction of the LSTM model. Since the coagulation effect prediction result includes the flocculation effect grade and / or flocculation effect parameters, it can be used to evaluate the coagulation effect of the target water quality, thereby determining whether the coagulant dosage is appropriate, and can be used to guide the change of the coagulant dosage.

[0023] Furthermore, after obtaining the prediction result of the coagulation effect of the target water quality, the method further includes: The coagulant dosage of the target water quality is determined according to the coagulation effect prediction result of the target water quality and the pre-established correspondence between the water quality coagulation effect prediction result and the coagulant dosage.

[0024] In the embodiments of the present invention, a corresponding relationship between the predicted results of water quality coagulation effect and the dosage of coagulant can be determined in advance by using a large amount of experimental data. This corresponding relationship can be a data table, in which the dosage of coagulant corresponding to different flocculation effect levels and / or the values of flocculation effect parameters are listed. After obtaining the predicted results of the coagulation effect of the target water quality, for example, the predicted results of the coagulation effect of the target water quality include a flocculation effect level of 1 and the values of various flocculation effect parameters, then the dosage of coagulant corresponding to the predicted results of the coagulation effect of the above target water quality can be found in this data table, so as to guide the dosing of the coagulant.

[0025] In the embodiments of the present invention, by the pre-established corresponding relationship between the predicted results of water quality coagulation effect and the dosage of coagulant, and determining the dosage of coagulant for the target water quality according to the predicted results of the coagulation effect of the target water quality, the required dosage of coagulant can be accurately quantified, thus realizing precise dosing.

[0026] To facilitate the understanding of the embodiments of the present invention, the training process of the hybrid deep learning model is described below.

[0027] The training process of the hybrid deep learning model includes: Step A1, obtaining a water quality floc image dataset by collecting floc images during the water quality flocculation experiment for a variety of water quality samples; Among them, each sample in the water quality floc image dataset corresponds to a single water quality flocculation experiment, and contains floc images at multiple moments during the water quality flocculation experiment with the same water quality sample; that is to say, each sample in the water quality floc image dataset includes floc images at multiple moments during a single water quality flocculation experiment.

[0028] Specifically, to obtain a water quality floc image dataset, data collection should be carried out first.

[0029] In the simulation of water quality floc experiments, water quality samples with different water quality conditions can be selected as the sampling objects. For each water quality condition, the same water quality flocculation experiment is repeatedly performed multiple times to fully consider the consistency and repeatability of the water quality flocculation experiment in the actual production process. During the image collection process, image acquisition devices such as high-resolution industrial cameras can be used to collect image samples of the water quality flocculation experiment. The flocculation time of the water quality is usually within 30 to 40 minutes, so the single sampling time of the flocculation experiment images is controlled within 50 minutes. At the same time, by using the sampling interval of adjacent floc images, the collection of repeated floc characteristics is fully reduced to capture the water quality floc characteristics at different stages of the flocculation experiment. In addition, after the sample collection of the floc images, the specific information of each sampling, including time, location, operator, environmental conditions, etc., is properly recorded, and finally a water quality floc image dataset is formed. The water quality floc image dataset contains multiple folders, each folder represents a sample corresponding to a single water quality flocculation experiment. A folder contains a set of floc images arranged in the order of the image acquisition time.

[0030] Step A2, perform label data annotation on the water quality floc image dataset; Label data annotation is a key step after the image collection of the water quality flocculation experiment, which involves the classification, recognition, and marking of floc images, so that the deep learning model can learn from these data and make accurate predictions.

[0031] In the water quality floc image dataset, each folder contains multiple floc images, which can record a complete process of the water quality flocculation experiment, but its final experimental result is not accurately and completely recorded. To address this issue, first, the present invention formulates a detailed annotation guide, including different classification criteria for flocs, feature descriptions, and how to recognize and mark these features. This helps ensure that all annotators can perform annotations in a consistent manner; second, according to the detailed annotation guide, label data annotation is performed on the final result of each water quality flocculation experiment to form an accurate and complete label file for accurate prediction by the deep learning model.

[0032] Among them, the label data annotated for each sample includes the flocculation effect level and / or flocculation effect parameters; For each sample, the final water quality flocculation experiment result of the flocculation experiment can be annotated as different flocculation effect levels, that is, the label data of the sample is annotated. For example, using 1 to 10 respectively represents perfect flocculation, very good flocculation, good flocculation, better flocculation, appropriate flocculation, general flocculation, slightly poor flocculation, significantly poor flocculation, very poor flocculation, and complete non-flocculation.

[0033] In addition, during the water quality flocculation experiment, a Hach sensor or the like can be used to measure the parameters of the final water quality flocculation experiment result, that is, the flocculation effect parameters, including pH value, temperature, turbidity NTU, chemical oxygen demand COD, absorbance at A275, absorbance at A220, etc. These flocculation effect parameters can be converted into tensor data and used as the label data of the sample.

[0034] The label data can be set as the flocculation effect level, or the flocculation effect parameters, or both according to the needs.

[0035] Step A3: Perform data preprocessing on the water quality floc image dataset after label data annotation, and divide a training set from the water quality floc image dataset after data preprocessing. In an optional implementation manner, the data preprocessing includes: Image elimination, image cropping, image enhancement, and normalization processing.

[0036] Specifically, the data preprocessing process is crucial for improving the performance of the hybrid deep learning model.

[0037] First, perform image elimination. Specifically, select multiple floc images in each folder of the current water quality floc image dataset, delete the floc images with low acquisition quality, and uniformly reduce the number of images in the folder to the same number of floc images, so as to ensure that the number of images in each folder is the same. Second, perform image cropping. Specifically, crop all the floc images in the current water quality floc image dataset to a unified image pixel size to meet the input requirements of the hybrid deep learning model. Third, perform image enhancement. To enhance the image features, a series of image enhancement operations can be performed, including adjusting brightness and contrast, applying histogram equalization and CLAHE (contrast limited adaptive histogram equalization) technology, and using non-linear methods such as gamma transformation to improve the visual effect of the image.

[0038] The above-mentioned processes together improve the image quality, strengthen the floc features, provide more accurate and rich information for the model, and thus enable effective learning and prediction.

[0039] In the hybrid deep learning model (i.e., the ResNet-LSTM model), the normalization process of the water quality floc image is a key step to ensure that the model can effectively learn. The normalization process can speed up the training speed, improve the generalization ability of the model, and reduce the numerical instability during the training process.

[0040] In the embodiment of the present invention, the normalization process includes: Pixel value scaling and preset normalization operations.

[0041] The preset normalization operation may adopt any existing normalization means, including: Linear normalization (minimum-maximum normalization and mean-standard deviation normalization), nonlinear normalization (logarithmic normalization and power-law normalization (Gamma correction)), local normalization (local contrast normalization and local histogram normalization) and global normalization (global histogram normalization and global contrast limited adaptive histogram equalization), etc.

[0042] First, pixel value scaling is performed, specifically scaling the pixel values of the image from the range of 0 to 255 to between 0 and 1, which is achieved by dividing each pixel value by 255. , the image scaling value is ; Next, perform a preset normalization operation, taking Z-score normalization as an example. Specifically, Z-score normalization is achieved by subtracting the mean and dividing by the standard deviation. Represents the mean value of the pixels in an image. Represents the standard deviation, then the normalized pixel value .

[0043] For the specific processing process of pixel value scaling and preset normalization operations, please refer to the relevant technical understanding, which will not be explained in detail here.

[0044] Through these normalization steps, the ResNet-LSTM model is able to process water quality floc image data more effectively, improving the performance and accuracy of the model.

[0045] Furthermore, for step A3, a training set is divided from the water quality flocculent image data set after data preprocessing, and a validation set is divided at the same time, and the validation set is used to evaluate the model performance after the training is completed.

[0046] The ratio of the training set to the validation set can be 4:1, which can be set as needed.

[0047] In the embodiment of the present invention, as an experimental simulation, a group of floc images of the target water quality to be tested in step S1 can be obtained from the verification set. Figure 3 Understand the overall process of the water quality coagulation effect prediction method based on ResNet-LSTM in an embodiment of the present invention.

[0048] Step A4: In each iteration of training, input the samples of the training set into the hybrid deep learning model to output the corresponding prediction results of the coagulation effect; use the prediction results of the coagulation effect of the input samples and the corresponding label data to calculate the value of the loss function, and perform backpropagation to adjust the model parameters. Among them, in each iteration of training, inputting the samples of the training set into the hybrid deep learning model to output the corresponding prediction results of the coagulation effect includes steps A41 to A42: Step A41: In each iteration of training, input the samples of the training set into the hybrid deep learning model, and use the ResNet model to extract the image features of each floc image in the samples to obtain the image features of each floc image in the samples. Step A42: Arrange the image features of each floc image in the samples in the time sequence order of the floc images to form an image feature time sequence, input it into the LSTM model for time sequence feature extraction, and output the prediction results of the coagulation effect corresponding to the samples.

[0049] Step A5: Repeat the iterative training multiple times until the trained hybrid deep learning model is obtained.

[0050] Specifically, for any group of floc images as samples in the training set, according to the acquisition order of the floc images, use the ResNet model to extract the image features of the floc images at different times, and obtain a time-sequential image sequence that corresponds one-to-one with each floc image and has the same length, that is, the image feature time sequence. Use the LSTM model to realize the learning of the time-sequential law of these image feature time sequences, and at the same time, according to the learned complex patterns and laws, continuously reduce the distance between its prediction results and the label data, so as to complete the parameter adjustment of the LSTM model. Please refer to Figure 4 Understand the process of one iteration of training of the hybrid deep learning model. The loss function in the training process can be implemented using existing loss functions, and the training process can be understood by referring to the conventional neural network training process.

[0051] Specifically, after completing the above data preprocessing steps, each folder in the water quality floc image dataset contains multiple floc images with the same data format. The construction of this dataset in the present invention is the basis for model training, ensuring that the model can learn the time-sequential features of the coagulation process.

[0052] For the image folder of a single water quality flocculation experiment, all its images need to be input into the ResNet model to extract the characteristics of water quality flocs. Currently, using the PyTorch library or the TensorFlow library, a ResNet model with the ability to extract local image features can be selected according to the number of floc image features as the model for floc image feature extraction. For example, the ResNet model can include the ResNet18 network or the ResNet50 network. Using the ResNet model to extract features from floc images, these image features contain the key visual information in the images and are crucial for understanding the microscopic changes in the coagulation process.

[0053] ResNet, short for Residual Network, is an excellent Convolutional Neural Network (CNN), consisting of multiple consecutive residual modules, which are the basic components of the ResNet architecture. It aims to solve the degradation problem in the training of deep neural networks. This degradation problem refers to the situation where as the number of network layers increases, the training error increases instead, resulting in a decline in model performance.

[0054] By introducing the "residual learning" framework, ResNet can fully solve the training degradation problem of traditional neural networks. The core idea of the residual module is to introduce the "identity mapping", allowing the input to directly skip some layers and be added to the output, thus solving the problems of vanishing gradients and exploding gradients in the training of deep networks. The main advantage of ResNet is that it can use hundreds or even thousands of residual layers to create a network and then train it, which is different from the usual sequential networks. In this case, as the number of layers increases, the performance shows a trend of first increasing rapidly and then increasing slowly. Based on this advantage, ResNet has a powerful ability to extract image spatial features and is a very classic network structure in convolutional neural networks, commonly used in research fields such as image recognition, object detection, image segmentation, and face recognition.

[0055] Generally, the purpose of traditional neural networks is to use one or more layers of networks to learn a mapping function , which can map the input to the desired output. However, as the number of network layers increases, the learning process of the mapping function becomes very difficult. To address this issue, the ResNet model proposes that instead of having the network learn , it is better to have the network learn the residual or difference between the input and the output, that is . In this way, the original mapping can be expressed as , where is the residual mapping, and this network structure is as Figure 5 shown.

[0056] By using multiple convolutional layers and 1 residual connection, the ResNet model can construct a basic residual unit, i.e., a residual block. At this time, let the input and output of the residual block be and respectively, and the function represents the residual mapping that needs to be learned. represents the weight of the th convolutional layer. For example, for the residual mapping with two layers in Figure 5 , without considering the bias term, the function is expressed as , where represents the ReLU function, and represent the weights of two convolutional layers. In addition, during the specific calculation process, the output of the function must have the same dimension as the input in order to output the final residual learning result. At this time, a linear projection operation also needs to be added at the input to match the dimensions of the function and the input . To sum up, the calculation formula for the residual mapping structure similar to that in Figure 5 is: (1); According to the principle of the above residual mapping structure, the traditional neural network can be deeply transformed to form a convolutional neural network with strong feature extraction ability, such as a 34-layer convolutional neural network structure based on residual connections, as the ResNet model, as Figure 6 shown.

[0057] Figure 6 In conv,64, / 2 means that the convolutional kernel size is , the number of channels is 64, and / 2 means that this convolutional layer uses a convolutional operation with a stride of 2; conv,64 means that the convolutional kernel size is , and the number of channels is 64. The parameters of the remaining layers will not be explained one by one.

[0058] For a sample of the water quality floc feature image dataset, after the image features are extracted by the ResNet model, the image features of each floc image in the sample can be obtained. The ResNet-LSTM model needs to input these image features into the LSTM model in chronological order to extract the temporal features of the flocs during the flocculation process and capture the dynamic changes during the coagulation process. Among them, the LSTM model can be implemented using the existing LSTM network. The gating mechanism of LSTM allows the model to learn long-term dependencies, which is of great significance for predicting the coagulation effect.

[0059] Long Short-Term Memory (LSTM) is a special type of Recurrent Neural Network (RNN), specifically designed to address the problem of long-term dependencies. LSTM controls the flow of information by introducing three gates and a memory cell, enabling it to retain information over long time series. This structure allows LSTM to capture complex dependencies and long-term dependencies in the sequence, thus performing well in fields such as natural language processing, speech recognition, and time series prediction.

[0060] The overall computational framework of the LSTM network is as Figure 7 shown. The LSTM network consists of components such as the forget gate, input gate, and output gate. Through the collaborative work of these three gating components, the LSTM model determines the flow and update of the floc image feature information in the network. The core of LSTM is the cell state, which is a continuous value carrying temporal sequence information throughout the LSTM network. The hidden state, as a snapshot of the current state, is passed to the next moment. The design of LSTM allows gradients to flow effectively over time, alleviating the problem of gradient vanishing or explosion, enabling the network to learn long-term dependencies in the sequence data. The specific introduction of these three gating mechanisms is as follows: First, the forget gate is responsible for selectively discarding old information. Let represent the long-term state information of the previous moment, be the hidden state information of the previous moment, be the input information of the current moment, represent concatenation calculation, be the bias matrix of the forget gate, be the weight matrix of the forget gate, be the sigmoid function, that is, , then the calculation formula of the forget gate is as follows: (2); Among them, is the output of the forget gate.

[0061] It should be noted that, first, the output of the forget gate is a real number vector between 0 and 1, and each element of this vector represents the degree of retention corresponding to the elements in the cell state. If the output is 0, it means that the corresponding information is completely forgotten; if the output is 1, it means that the corresponding information is completely retained. Second, the main function of the forget gate is to control the degree to which historical state information flows to the current state, determining the cell state at the previous moment How much participates in the cell state at the current moment. If the forget gate is fully closed (taking the value 0), then the history has no influence on the current state; if the forget gate is fully open (taking the value 1), then the historical information is passed to the current moment intact without any information loss. Third, when updating the cell state, the forget gate will be multiplied by the cell state to determine how much historical information to retain. Specifically, the cell state at the previous moment will be element-wise multiplied by the output of the forget gate to obtain a result that will be combined with the new information to form a new cell state.

[0062] Second, the input gate is responsible for determining the storage of new information. Let represent the long-term state information at the current moment, be the output of the input gate, be the sigmoid function, and be the weight matrix and bias matrix of the input gate respectively, be the hidden state information at the previous moment, be the input information at the current moment, be the candidate memory unit at the current moment, and be the weight matrix and bias matrix of the candidate memory unit respectively, and tanh represents the hyperbolic tangent function, that is , then the specific calculation process of the input gate is shown in the following formula: (3); (4); (5); It should be noted that the input gate determines which parts of the memory unit should be updated at the current moment. The output of the input gate is a real number vector between 0 and 1, and each element of this vector represents the degree of update corresponding to the elements in the candidate memory unit. If the output of the input gate is 0, it means that the corresponding information should not be added to the memory unit; if the output is 1, it means that the corresponding information should be completely added to the memory unit. In addition, in the input gate, the update of the memory unit depends not only on the input gate but also on the forget gate. The final state of the memory unit It is calculated by combining the output of the forget gate and the output of the input gate.

[0063] Third, the output gate determines the final output state. is the output of the output gate, is the sigmoid function, and are the weight matrix and bias matrix of the output gate respectively, is the hidden state information at the previous moment, is the input information at the current moment, is the final state of the memory cell, and the calculation process of the output gate is shown in the following formula: (6); (7); where, represents the multiplication operation.

[0064] It should be noted that the output of the output gate is also a real number vector between 0 and 1, and each element of this vector represents the output degree corresponding to the element in the cell state. If the output is 0, it means that the corresponding information should not be output; if the output is 1, it means that the corresponding information should be completely output. In addition, the output gate allows the LSTM model to selectively output information at each moment, which helps the model capture and remember the long-term dependencies in the sequence data while ignoring the unimportant information. In this way, LSTM can process time series data more effectively, especially in scenarios where long-distance dependency information needs to be remembered.

[0065] Through the above training process, a trained hybrid deep learning model can be obtained, and the model performance can be evaluated using the validation set.

[0066] Specifically, for each group of floc images in the validation set, first use the trained ResNet model to extract image features from all floc images to obtain an image feature time series sequence, and then use the trained LSTM model to predict the image feature time series sequence and fully compare and verify it with the labeled label data, so as to statistically calculate measurement indicators such as its accuracy, MSE (Mean Squared Error), and MAE (Mean Absolute Error). When the performance index requirements are met, a hybrid deep learning model that meets the usage conditions is obtained. If the performance index requirements are not met, training can be adjusted again to ensure the reliability of the model in predicting the coagulation effect.

[0067] Given that ResNet has powerful capabilities in extracting spatial features of images, and LSTM has strong advantages in processing time series data, the embodiments of the present invention combine the two to construct a hybrid deep learning model. This hybrid deep learning model can not only extract key temporal information from floc images at consecutive moments, but also predict the water quality coagulation effect with high accuracy, providing strong technical support for water quality management and the optimization of the coagulation process. Through the method of the present invention, researchers and engineers can more effectively monitor and control the coagulation stage in the water treatment process, thereby improving water quality and ensuring public health and environmental safety.

[0068] Specifically, the method of the present invention has the following beneficial effects: 1. Improve prediction accuracy: By using deep learning algorithms to establish a hybrid deep learning model, this model can simultaneously process the spatial features of images and time series data, achieving more efficient and accurate prediction of the coagulation effect.

[0069] 2. Consider the influence of multiple factors: The model input variables include not only the direct influencing factors of the coagulant dosage, such as the influent turbidity, water temperature, etc., but also the factors that affect the formation time of flocs, the size of flocs, etc. and affect turbidity removal, such as the influent pH, etc., to more realistically reflect the influence of the coagulant dosage on the floc precipitation effect and the turbidity of the effluent after sedimentation.

[0070] 3. Consideration of time series values: The value of a single influencing factor uses the sequence values within a period of time as the input variables of the model, which can more realistically reflect the entire influence process of the coagulant dosage on the formation of flocs, the change of floc particle size, and the removal of flocs, such as the complete processes of coagulation, flocculation, agglomeration, and precipitation.

[0071] 4. Optimize the coagulant dosage: By obtaining accurate prediction results of the coagulation effect, it is further possible to accurately predict the coagulant dosage, which is of great significance for optimizing the coagulant dosage, stabilizing the turbidity of the effluent after sedimentation treatment, and ensuring the safety of the water supply quality.

[0072] 5. Improve the degree of intelligence and automation: This technology collects and analyzes key water quality indicators and treatment process parameters in real time, and uses deep learning technology to intelligently optimize and manage the treatment process, significantly improving the efficiency and stability of the water treatment process, and at the same time reducing the dependence on manual operations.

[0073] 6. Adapt to environmental changes: Through the implementation of the method of the present invention, it is possible to ensure the optimal operation of water treatment facilities under various environmental conditions, and ensure the continuity, quality, and safety of the water supply.

[0074] To facilitate the understanding of the solution of the embodiments of the present invention, the following gives two specific embodiments.

[0075] (1) Embodiment 1 Data preparation: A water quality floc image dataset containing multiple sets of consecutive floc images is constructed. After label data annotation and data preprocessing, it is divided into a training set and a validation set according to a ratio of 4:1. For both the training set and the validation set, each sample includes 125 consecutively captured images (image size is 3 224 224), and the label data of the sample (the prediction result of the coagulation effect is consistent with it) is the flocculation effect level, including perfect flocculation (labeled as 1), very good flocculation (labeled as 2), good flocculation (labeled as 3), better flocculation (labeled as 4), appropriate flocculation (labeled as 5), general flocculation (labeled as 6), slightly poor flocculation (labeled as 7), significantly poor flocculation (labeled as 8), very poor flocculation (labeled as 9), and completely no flocculation (labeled as 10); Among them, the data preprocessing is as follows: Using the transforms module of PyTorch, the images are converted into tensors and normalized. The normalization parameters (mean and standard deviation) are set according to the parameters of the pre-trained model; In the model architecture, the ResNet model uses the ResNet18 network. ResNet18 is a relatively shallow network in the ResNet series, with a total of 18 layers of depth. It is mainly composed of multiple residual blocks, and this kind of block is suitable for networks with fewer layers. The structure of ResNet18 starts with a convolutional layer, followed by a max pooling layer, then four residual block layers, and finally a global average pooling layer and a fully connected layer. In ResNet18, the first to fourth layers each contain 2 different residual blocks. The internal structure of the ResNet18 network is as Figure 8 shown.

[0076] In the ResNet18 model, the input layer consists of a convolutional layer and a normalization layer. First, the convolutional layer uses a convolutional kernel with a stride of 2 to perform convolution on the input image. The number of output channels of this convolutional layer is 64, which means it will generate 64 feature maps. The convolution operation can capture local features of the input data, such as edges, textures, etc., and identify these features by learning different convolutional kernels. Let represent the input image, is 's convolutional kernel, is the bias term, represent the convolution operation, is the output feature map, then the calculation formula for this layer is: (8); Second, the normalization layer, also known as the Batch Normalization (BN) layer, is used to normalize the output of the convolutional layer. Batch normalization calculates the mean and variance of each mini-batch of data and normalizes the data to make the output distribution more stable, with the mean of each mini-batch of data being 0 and the variance being 1, thus accelerating the training process and improving the generalization ability of the model. Let represent the output of the convolutional layer, be the mean of the mini-batch of data, be the variance of the mini-batch of data, be a very small number used to prevent division by zero, be the normalized output, then the calculation formula of this layer is: (9); The feature map after passing through the input layer needs to enter the first layer of calculation, which mainly consists of a max pooling layer and two basic blocks 1. Among them, the role of the max pooling layer is mainly to perform downsampling, reduce the size of the feature map, thereby reducing the number of parameters and the amount of calculation, while maintaining the main features of the feature map. The max pooling operation does not involve weight learning. It divides the feature map and then selects the maximum value in each divided area as the representative of that area, thereby realizing feature dimensionality reduction and abstraction. Specifically, the window size of the max pooling layer is , the stride is 2, let represent the value of the output feature map at position , be the input feature map (with size ), and are the indices within the pooling window, is the stride, then its corresponding formula is: (10); After passing through the max pooling layer, the size of the output feature map becomes , and then the output feature map is added to the structure of two basic blocks 1. It should be noted that the structures of the two basic blocks 1 are the same, and its specific structure is as shown in Figure 9 .

[0077] In basic block 1, let the input feature map be , first pass through a convolutional operation with a convolutional kernel size of and being 1, and its calculation formula is the same as formula (1); secondly, enter the batch normalization layer and perform the same calculation as formula (2); thirdly, enter the Relu layer to introduce non-linear calculation. Let is an input element of the Relu layer, and the calculation formula of this layer is: (11); Again, repeat the convolution with a kernel size of and perform convolution and batch normalization layers with a kernel size of 1 to obtain the output feature map extracted by Basic Block 1. Then, superimpose it on the original input feature map of Basic Block 1 to achieve the residual connection of the feature map, thereby alleviating the vanishing gradient, promoting information flow, and further improving the training efficiency. Finally, perform the calculation of the Relu layer and output the corresponding feature map.

[0078] In the ResNet18 model, the 2nd - 4th layers perform the same calculation process, each consisting of a Basic Block 2 and a Basic Block 3. The specific introduction is as follows. First, the structure of Basic Block 2 is very similar to that of Basic Block 1. The difference between them is that the number of output channels of the first convolution in Basic Block 2 is 128, and the number of input and output channels of the second convolution is 128. In addition, a convolutional layer with a stride of 2, an input channel of 64, and an output channel of 128 is added to the residual connection part of Basic Block 2. Its specific structure is as shown; Second, the structure of Basic Block 3 is also very similar to that of Basic Block 1. The difference between them is that the number of input and output channels of the first convolution in Basic Block 3 is 128, and the number of input and output channels of the second convolution is 128. Its specific structure is as Figure 10 shown; Figure 11 shown.

[0079] Model training: For 80% of the training set images, through the convolutional layer, batch normalization layer, activation function, pooling layer, max - pooling layer, etc. of ResNet18 in the training mode, extract features from the image tensor data, flatten the final result into a one - dimensional vector data, and then input all the one - dimensional vector data into the LSTM model. Use the forget gate, input gate, output gate, etc. to extract the temporal features of consecutive floc images. During this process, the ResNet - LSTM model uses the Adam optimizer and the mean squared error loss function to update the parameters in the model until the ResNet - LSTM model reaches the predetermined number of iterations or the value of the loss function is lower than the threshold .

[0080] Model evaluation: For 20% of the validation set images, features are extracted from the image tensor data through the convolutional layers, batch normalization layers, activation functions, pooling layers, max pooling layers, etc. of ResNet18 in validation mode, and the final results are flattened into one-dimensional vector data. Then, all the one-dimensional vector data are input into the LSTM model in validation mode. Using forget gates, input gates, output gates, etc., the temporal features of consecutive floc images are extracted. Then, by using the differences between the model prediction results and the dataset labels, accuracy, mean square error (MSE), and mean absolute error (MAE) are calculated to comprehensively evaluate the accuracy and reliability of the model.

[0081] (II) Example 2 Data preparation: After constructing a water quality floc image dataset containing multiple groups of consecutive floc images, performing label data annotation and data preprocessing, it is divided into a training set and a validation set according to a ratio of 4:1. Whether it is the training set or the validation set, each sample includes 125 continuously captured images (image size is 3 224 224), and the label data of the sample (the predicted result of the coagulation effect is consistent with it) is the flocculation effect parameter, which is vector data in the form of pH value, temperature, NTU, COD, absorbance A275, and absorbance A220.

[0082] Among them, the data preprocessing is as follows: Using the transforms module of PyTorch, the images are converted into tensors and normalized. The normalization parameters (mean and standard deviation) are set according to the parameters of the pre-trained model; In the model architecture, the ResNet model uses the ResNet50 network. ResNet50 is a deeper network with 50 layers. It starts using multiple bottleneck blocks, which are suitable for networks with more layers and can reduce the amount of calculation. The structure of ResNet50 includes an initial convolutional layer, followed by a max pooling layer, then four residual block layers, and finally a global average pooling layer and a fully connected layer. The layer configuration of ResNet50 is as follows: The first layer has 3 bottleneck blocks, the second layer has 4 bottleneck blocks, the third layer has 6 bottleneck blocks, and the fourth layer has 3 bottleneck blocks. Its specific structure is as Figure 12 shown.

[0083] In the ResNet50 model, the input layer is the same as that of the ResNet18 model, so it will not be elaborated here. The first layer of the ResNet50 model consists of a max pooling layer, bottleneck block 1, and two bottleneck blocks 2. The specific introduction is as follows: First, the structure of its max pooling layer is the same as that of the ResNet18 model, so it will not be elaborated here; Second, bottleneck block 1 mainly includes Convolution calculation and operation structures such as convolution calculation, and its specific calculation process is as Figure 13 shown.

[0084] It should be noted that except for the different parameters of the convolution kernel size, stride, input channels, and output channels, the convolution operations, batch normalization layers, and Relu layers in bottleneck block 1 are the same as those in basic block 1 of the ResNet18 model in terms of calculation method, so they will not be described repeatedly here; third, bottleneck block 2 has a very similar structure to bottleneck block 1, and its specific description can be found in Figure 14 .

[0085] In the ResNet50 model, the second layer is mainly composed of 1 bottleneck block 3 and 3 bottleneck blocks 4, the third layer is composed of 1 bottleneck block 3 and 5 bottleneck blocks 4, and the fourth layer is composed of 1 bottleneck block 3 and 2 bottleneck blocks 4. Among them, the internal structures of bottleneck block 3 and bottleneck block 4 are respectively as Figure 15 and Figure 16 shown.

[0086] As can be seen from the above figures, the internal structure of bottleneck block 3 is very similar to that of bottleneck block 1, and the difference between the two only lies in the settings of parameters such as the stride, input channels, and output channels of the convolution operation, and the operation processes in other aspects are the same. The internal structure of bottleneck block 4 is very similar to that of bottleneck block 2, and the difference between the two only lies in the settings of parameters such as the stride, input channels, and output channels of the convolution operation.

[0087] Model training: For 80% of the training set images, through the convolution layer, batch normalization layer, activation function, pooling layer, max pooling layer, etc. of the ResNet50 model in the training mode, features are extracted from the image tensor data, and the final result is flattened into a one-dimensional vector data. Then, all the one-dimensional vector data is input into the LSTM model, and the sequential features of continuous floc images are extracted using forget gates, input gates, output gates, etc. During this process, the ResNet-LSTM model uses the Adam optimizer and the mean square error loss function to update the various parameters in the model until the ResNet-LSTM model reaches the predetermined number of iterations or the value of the loss function is lower than the threshold .

[0088] Model evaluation: For 20% of the validation set images, features are extracted from the image tensor data through the convolutional layers, batch normalization layers, activation functions, pooling layers, max pooling layers, etc. of the ResNet50 model in validation mode, and the final results are flattened into one-dimensional vector data. Then, all the one-dimensional vector data are input into the LSTM model in validation mode. By using forget gates, input gates, output gates, etc., the temporal features of consecutive floc images are extracted. Then, using the differences between the model prediction results and the dataset labels, accuracy, mean squared error (MSE), and mean absolute error (MAE) are calculated to comprehensively evaluate the accuracy and reliability of the model.

[0089] In the specific experimental simulation process, the cup jar coagulation experiment prediction method is adopted to quickly and accurately predict the turbidity after cup jar flocculation.

[0090] The present invention combines ResNet and LSTM models for predicting the water quality coagulation effect. The advantage of the ResNet-LSTM model lies in its ability to sensitively capture the dynamic changes in the water quality coagulation process. Through the deep structure and residual learning mechanism of the ResNet model, key features can be effectively extracted from continuously captured floc images, and these features are crucial for understanding the subtle changes in the coagulation process. The introduction of the LSTM model enables the capture of temporal dynamics. It can learn the temporal patterns in the image sequence, thereby better understanding the evolution of the coagulation process. From the sequence of floc image data extracted by the ResNet model, LSTM can identify potential key factors affecting the coagulation effect and predict how these factors affect the coagulation effect over time. Thanks to the image feature extraction ability of ResNet and the temporal analysis ability of LSTM, the prediction accuracy of this hybrid model of the present invention has been significantly improved. In addition, the model can adapt to new data and changing conditions, with good generalization ability and flexibility, which is particularly important for dealing with the uncertainties and changes in the actual water treatment process. The experimental results show that compared with the classical LSTM model and other machine learning models, the ResNet-LSTM model can better handle the non-linearity and non-stationarity of water quality data and provide more accurate prediction results of the coagulation effect.

[0091] By dividing the dataset into a training set and a validation set in a ratio of 4:1, the generalization ability of the model is enhanced, enabling it to make accurate predictions on unseen data. In addition, this technology can be integrated into the water quality monitoring system to achieve real-time monitoring of the coagulation process and provide decision support for water treatment operations, timely adjusting the dosage of the coagulant.

[0092] The improvement of the automation level reduces the dependence on manual monitoring and evaluation and lowers the labor cost. Meanwhile, by optimizing the coagulation process, the use of coagulants can be reduced to achieve a more environmentally friendly water treatment method. The data-driven optimization method allows the model to continuously improve by collecting new data, realizing the continuous optimization of the coagulation process. The flexibility of the model also enables it to adjust parameters according to specific application scenarios to adapt to different prediction tasks.

[0093] In terms of scientific research and industrial applications, this technology not only has important value but also has broad application prospects in the field of industrial water treatment. It helps to promote the progress of water treatment technology, improve the efficiency and stability of the operation of the water purification process, enhance the operation control level of the water purification process, reduce the labor cost, and ensure the safety of drinking water quality. In summary, the water quality coagulation effect prediction technology based on ResNet-LSTM provides an efficient, accurate, and automated solution for water quality management, with important practical value and promotion potential.

[0094] It should be noted that in the description of the present invention, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present invention, "a plurality" means two or more, unless otherwise specifically defined.

[0095] The above are only the preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A method for predicting the water quality coagulation effect based on ResNet-LSTM, characterized in that, Including: Obtaining a group of to-be-tested floc images of the target water quality collected at multiple moments; Inputting the group of to-be-tested floc images into a pre-trained hybrid deep learning model to obtain a prediction result of the coagulation effect of the target water quality; wherein, the hybrid deep learning model includes a ResNet model and an LSTM model connected in sequence; the hybrid deep learning model is trained based on a water quality floc image dataset; the prediction result of the coagulation effect includes a flocculation effect level and / or a flocculation effect parameter; the flocculation effect level is used to characterize different levels of flocculation effects, and the flocculation effect parameter includes a water quality parameter characterizing the flocculation effect.

2. The method for predicting the water quality coagulation effect based on ResNet-LSTM according to claim 1, wherein The flocculation effect level includes a total of 10 levels: perfect flocculation, very good flocculation, good flocculation, better flocculation, appropriate flocculation, general flocculation, slightly poor flocculation, significantly poor flocculation, very poor flocculation, and complete non-flocculation, indicating that the flocculation effect deteriorates in sequence; The flocculation effect parameters include pH value, temperature, turbidity NTU, chemical oxygen demand COD, absorbance at A275, and absorbance at A220.

3. The water quality coagulation effect prediction method based on ResNet-LSTM according to claim 1, characterized in that After obtaining the prediction result of the coagulation effect of the target water quality, the method further includes: Determining the coagulant dosage of the target water quality according to the prediction result of the coagulation effect of the target water quality and the corresponding relationship between the prediction result of the water quality coagulation effect and the coagulant dosage established in advance.

4. The water quality coagulation effect prediction method based on ResNet-LSTM according to any one of claims 1 to 3, characterized in that The training process of the hybrid deep learning model includes: Obtaining a water quality floc image dataset by collecting floc images during the water quality flocculation experiment for multiple water quality samples; wherein, each sample in the water quality floc image dataset corresponds to a single water quality flocculation experiment and contains floc images at multiple moments during the water quality flocculation experiment for the same water quality sample; Performing label data annotation on the water quality floc image dataset; wherein, the label data annotated for each sample includes a flocculation effect level and / or a flocculation effect parameter; Performing data preprocessing on the water quality floc image dataset after label data annotation, and dividing a training set from the water quality floc image dataset after data preprocessing; In each iterative training, inputting the samples of the training set into the hybrid deep learning model, outputting the corresponding prediction result of the coagulation effect; using the prediction result of the coagulation effect of the input sample and the corresponding label data, calculating the value of the loss function, and performing backpropagation to adjust the model parameters; Repeating the iterative training multiple times until a trained hybrid deep learning model is obtained.

5. The water quality coagulation effect prediction method based on ResNet-LSTM according to claim 4, characterized in that, In each iterative training, inputting the samples of the training set into the hybrid deep learning model and outputting the corresponding prediction result of the coagulation effect, including: In each iterative training, inputting the samples of the training set into the hybrid deep learning model, using the ResNet model to extract image features, and obtaining the image features of each floc image in the sample; Arrange the image features of each floc image in the sample in chronological order of the floc images to form an image feature time series sequence, input it into the LSTM model for time series feature extraction, and output the prediction result of the coagulation effect corresponding to the sample.

6. The water quality coagulation effect prediction method based on ResNet-LSTM according to claim 4, wherein, The data preprocessing includes: Image elimination, image cropping, image enhancement, and normalization processing.

7. The method for predicting the water quality coagulation effect based on ResNet-LSTM according to claim 6, characterized in that, The normalization processing includes: Pixel value scaling and preset normalization operations.

8. The method for predicting the water quality coagulation effect based on ResNet-LSTM according to claim 1, characterized in that The ResNet model includes a ResNet18 network or a ResNet50 network.

9. The method for predicting the water quality coagulation effect based on ResNet-LSTM according to claim 4, wherein The method further includes: While dividing the training set from the water quality floc image dataset after data preprocessing, divide the validation set, and the validation set is used for model performance evaluation after training is completed.

Citation Information

Cited By

  • Intelligent coagulant adding control method and system based on image recognition and multi-parameter modeling

    CN120535101A

  • Method for dynamically detecting flocculation state in sewage

    CN122079332A