A raw water treatment flocculant dosage optimization method and device
By acquiring images of the flocculation process and using a flocculation characteristic category prediction model, the nonlinear relationship between flocculant dosage and water quality characteristics was resolved, enabling intelligent optimization and accurate prediction of flocculant dosage, and improving the prediction and control capabilities of flocculation effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA NAT PETROLEUM CORP
- Filing Date
- 2025-01-08
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies make it difficult to establish a clear relationship between flocculant dosage and water quality characteristics such as raw water turbidity, chemical oxygen demand, pH value, and temperature. This makes it difficult to predict the flocculation effect. Furthermore, the relationship between flocculant dosage and turbidity reduction rate is non-linear, making it difficult to optimize flocculant dosage.
By acquiring multiple frames of flocculation process images, and utilizing a pre-trained flocculation characteristic category prediction model, the flocculant dosage is optimized based on the mapping relationship between flocculation characteristic categories and the optimal dosage of flocculant. Furthermore, an ensemble learning model of multiple deep learning network models is employed to establish a flocculation characteristic category prediction model.
It enables intelligent optimization of flocculant dosage, improves the accuracy and practicality of flocculation effect prediction, alleviates the problems of training resource waste and hyperparameter design difficulties, and enhances the intelligent control capability of flocculant dosage.
Smart Images

Figure CN122369684A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and water treatment application technology, and in particular to a method and apparatus for optimizing the dosage of flocculant in raw water treatment. Background Technology
[0002] Flocculation technology is a widely used treatment process in water treatment, and it can be used for the treatment of urban drinking water, domestic sewage, and industrial wastewater.
[0003] In simple terms, the mechanism of flocculation technology is to add flocculants to destabilize colloids in water, thereby forming flocs, and then let the flocs settle completely to form a supernatant.
[0004] When flocculation technology is applied to different water quality scenarios, the desired water quality characteristics also vary. In urban drinking water, the goal of flocculation technology is to reduce the turbidity of the natural water (also known as "raw water") entering the water treatment plant to below 0.8 NTU. In other words, regardless of the turbidity of the raw water, the turbidity of the effluent needs to be reduced to below 0.8 NTU after flocculation treatment. Therefore, the amount of flocculant required during flocculation varies depending on the turbidity of the raw water. Summary of the Invention
[0005] The inventors discovered three challenges in selecting different dosages of flocculant based on the varying turbidity of the raw water to be treated:
[0006] 1. It is difficult to establish a specific relationship between the flocculant dosage and the raw water turbidity.
[0007] The quantity, size, and density of flocs produced after adding flocculants to raw water are related not only to the turbidity of the raw water but also to various other factors such as chemical oxygen demand (COD), pH value, and temperature. Turbidity, COD value, pH value, and temperature are generally referred to collectively as water quality characteristics.
[0008] In other words, for raw water with the same turbidity but different other water quality characteristics, the minimum amount of flocculant required to reduce the turbidity to below 0.8 NTU through flocculation is different.
[0009] In addition, due to the characteristics of water quality, it is common for raw water from the same water source to require a lower amount of flocculant when the turbidity is higher than that when the turbidity is lower. For example, the amount of flocculant required when the turbidity is 30 NTU is lower than that required when the turbidity is 20 NTU.
[0010] 2. The relationship between the flocculant dosage and the turbidity of the supernatant is non-linear.
[0011] The function of flocculants is to destabilize colloids in water. However, the number of colloids that can be destabilized in water is limited under certain water quality characteristics. Therefore, some of the flocculants in excessive amounts will not react and will become impurities in the water, increasing the turbidity. Thus, for the same raw water, more flocculant does not necessarily mean lower turbidity after flocculation. In fact, this is a non-linear relationship.
[0012] 3. The relationship between the flocculant dosage and the rate of turbidity decrease is non-linear.
[0013] The complex multi-factor reaction makes it difficult to establish a definite relationship between the flocculant dosage and the rate of turbidity decrease for the same raw water.
[0014] The above three difficulties are due to the fact that the reaction mechanism between water quality characteristics and flocculants is very complex and difficult to study clearly. It is also difficult to establish a clear correspondence between water quality characteristics and flocculant dosage, which makes it very difficult to predict the flocculation effect.
[0015] In recent years, several flocculation effect prediction models based on machine learning algorithms have been proposed. In 2019, Hiroshi Yamamura used the AlexNet network to classify the flocculation effect of different water qualities in his paper "Dosage optimization of polyaluminum chloride by the application of convolutional neural network to the floc images captured in jar tests". In 2022, Arya G. Krishnan used an artificial neural network to predict the turbidity removal efficiency of PACl and Moringa Oleifera in water treatment plants in his paper "Artificial neural network modelling approach for the prediction of turbidity removal efficiency of PACl and Moringa Oleifera in water treatment plants". Also in 2022, Guocheng Zhu used tensor graphs to identify the pollution levels of different water samples in his paper "A flocculation tensor to monitor water quality using a deep learning model". While these techniques have all classified and predicted the flocculation effect of different water samples, they have not addressed how the prediction results guide the control of dosage.
[0016] In order to at least partially solve the technical problems existing in the prior art, the inventors made this invention, which provides a method and device for optimizing the dosage of flocculant in raw water treatment through specific embodiments. Based on the mapping relationship between flocculation characteristic categories and the optimal dosage of flocculant, the invention utilizes a pre-trained flocculation characteristic category prediction model to achieve intelligent optimization of the dosage of flocculant in raw water treatment.
[0017] In a first aspect, embodiments of the present invention provide a method for optimizing the dosage of flocculant in raw water treatment, comprising:
[0018] Multiple frames of images of the raw water sample during the flocculation process are input into the flocculation characteristic category prediction model. Based on the flocculation characteristic category prediction results output by the model and the pre-determined mapping relationship between the flocculation characteristic category and the optimal flocculant dosage, the optimal flocculant dosage for the raw water to be treated is determined.
[0019] Optionally, the mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant is predetermined in the following manner:
[0020] Several groups of water samples were collected, and each group of water samples was divided into several parts. For each part of water sample, the flocculant dosage and the turbidity after flocculation were obtained through flocculation cup test. The flocculant dosage was different for each part of water sample in the same group.
[0021] For each group of water samples, the optimal amount of flocculant for each water sample is determined using the arithmetic sequence method based on the target turbidity, the amount of flocculant used for each water sample, and the turbidity after flocculation.
[0022] Based on the optimal dosage of flocculant, each group of water samples was classified into flocculation characteristic categories, and the optimal dosage of flocculant corresponding to each flocculation characteristic category was determined, thus obtaining the mapping relationship between flocculation characteristic categories and optimal flocculant dosage.
[0023] Optionally, the flocculation characteristic category prediction model is pre-established in the following manner:
[0024] Several water samples were collected, and for each water sample, multiple frames of images of the flocculation process were obtained through flocculation cup experiments;
[0025] Each frame of image and the corresponding flocculation characteristic category are treated as a sample to obtain a sample set;
[0026] The specified learning model is trained using the sample set to obtain a prediction model for flocculation characteristic categories.
[0027] Optionally, the flocculation cup test includes a first stirring stage, a second stirring stage, and a settling stage in sequence, wherein the stirring speed in the first stirring stage is greater than the stirring speed in the second stirring stage.
[0028] The multi-frame images during the flocculation process include multi-frame images of the first stirring stage, multi-frame images of the second stirring stage, and multi-frame images of the settling stage.
[0029] Optionally, training a specified learning model using the sample set to obtain a flocculation characteristic category prediction model includes:
[0030] The fusion learning model is trained using the sample set to obtain a flocculation characteristic category prediction model. The fusion learning model includes multiple deep learning network models and ensemble algorithms.
[0031] Optionally, the fusion learning model includes the AlexNet network model, the LeNet network model, and the VGG16 network model.
[0032] Optionally, the AlexNet network model includes an 11-layer neural network, comprising 5 convolutional layers, 3 max-pooling layers, and 3 fully connected layers.
[0033] The LeNet network model consists of a 7-layer neural network, including 2 convolutional layers, 2 pooling layers, and 3 fully connected layers;
[0034] The VGG16 network model includes 20 sub-layers, including two conv3-64 sub-layers in the first convolutional layer, two conv3-128 sub-layers in the second convolutional layer, three conv3-256 sub-layers in the third convolutional layer, three conv3-512 sub-layers in the fourth convolutional layer, three conv3-512 sub-layers in the fifth convolutional layer, two FC4096 sub-layers, one FC1024 sub-layer, and four max-pooling sub-layers.
[0035] Optionally, training the fusion learning model using the sample set to obtain the flocculation characteristic category prediction model includes:
[0036] Using the aforementioned sample set, a fusion learning model is trained through cross-sampling to obtain a flocculation characteristic category prediction model.
[0037] Optionally, the step of training a fusion learning model using the sample set through cross-sampling to obtain a flocculation characteristic category prediction model includes:
[0038] The samples in the sample set are divided into different subsets according to their different flocculation characteristics.
[0039] Training samples are extracted from each subset according to a set ratio to obtain a training set and a validation set.
[0040] Set the number of rounds, batch size, and learning rate for model training. Each round of model training includes: for each deep learning network model, inputting the training set into the model for forward propagation to obtain a prediction output, determining the update gradient based on the loss value of the output, updating the model weights based on the update gradient, and determining the model prediction performance using the validation set.
[0041] Return to the previous step and extract training samples from each subset according to the set ratio to obtain the training set and the validation set, until the preset training termination condition is reached.
[0042] Optionally, setting the number of epochs, batch size, and learning rate for model training includes:
[0043] The model training rounds are set to 20-50, the batch size to 32, and the learning rate to 0.0001.
[0044] Secondly, embodiments of the present invention provide a raw water treatment flocculant dosage optimization device, the device comprising a mapping relationship determination module, a prediction model establishment module, and a flocculant dosage optimization module;
[0045] The flocculant dosage optimization module is used to input multiple frames of images of the raw water sample during the flocculation process into the flocculation characteristic category prediction model pre-established by the prediction model building module. Based on the flocculation characteristic category prediction results output by the model and the mapping relationship between the flocculation characteristic category and the optimal flocculant dosage pre-determined by the mapping relationship determination module, the optimal flocculant dosage for the raw water to be treated is determined.
[0046] Thirdly, embodiments of the present invention provide a computer storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-mentioned method for optimizing the dosage of flocculant in raw water treatment.
[0047] Fourthly, this disclosure provides a server, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method for optimizing the dosage of flocculant in raw water treatment.
[0048] The beneficial effects of the above-described technical solutions provided in the embodiments of the present invention include at least the following:
[0049] (1) The raw water treatment flocculant dosage optimization method provided in this embodiment of the invention creatively proposes a classification scheme of flocculation characteristics that can reflect the optimal dosage of flocculant. The flocculation characteristic category is determined in advance based on the optimal dosage of flocculant, and a mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant is established. Based on the mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant, a pre-trained flocculation characteristic category prediction model is used to realize the intelligent optimization of the raw water treatment flocculant dosage.
[0050] (2) The method for optimizing the dosage of flocculant for raw water treatment provided in this embodiment of the invention can effectively alleviate the dependence of deep learning models on training parameters and improve the practicality of the algorithm in real-world scenarios through the integrated learning of multiple deep learning network models; at the same time, it can effectively alleviate the problems of wasted training resources, poor training effect, and difficulty in hyperparameter design.
[0051] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0052] 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
[0053] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0054] Figure 1 This is a flowchart illustrating the determination of the mapping relationship between flocculation characteristic categories and the optimal dosage of flocculant in Embodiment 2 of the present invention.
[0055] Figure 2 Flowchart for establishing the flocculation characteristic category prediction model in Embodiment 3 of the present invention;
[0056] Figure 3 This is a diagram illustrating the multi-model structure and integration method in Embodiment 3 of the present invention;
[0057] Figure 4 This is a flowchart illustrating the training of the fusion learning model using cross-sampling in Embodiment 3 of the present invention;
[0058] Figure 5 This is a flowchart illustrating the technical process of training and predicting the flocculation characteristic category prediction model in Embodiment 3 of the present invention.
[0059] Figure 6 This is a schematic diagram of the raw water treatment flocculant dosage optimization device in an embodiment of the present invention. Detailed Implementation
[0060] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0061] It should be understood that the terminology used in this invention is merely for describing particular embodiments and is not intended to limit the invention. Furthermore, with respect to numerical ranges in this invention, it should be understood that each intermediate value between the upper and lower limits of the range is also specifically disclosed. Every smaller range between any stated value or intermediate value within a stated range, and any other stated value or intermediate value within said range, is also included in this invention. The upper and lower limits of these smaller ranges may be independently included or excluded from the range.
[0062] Unless otherwise stated, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. While only preferred methods and materials have been described herein, any methods and materials similar or equivalent to those described herein may be used in the implementation or testing of this invention. All references to this specification are incorporated by way of citation to disclose and describe methods and / or materials associated with those references. In the event of any conflict with any incorporated reference, the content of this specification shall prevail.
[0063] The inventors discovered in their work that although it is difficult to establish a direct correlation between water quality characteristics and flocculant dosage, the various differences in water quality characteristics will ultimately be reflected in the formed flocs. Therefore, studying the flocculation effect from the perspective of flocs is a feasible approach.
[0064] 1. If raw water is classified using various water quality parameters, then any raw water with different parameters is considered completely different. However, during flocculation, some raw waters, despite having different water quality parameters, exhibit the same flocculation characteristics. This means that adding the same dosage of flocculant will produce the same flocculation effect (i.e., the same turbidity in the supernatant). Such waters are referred to as raw water with identical flocculation characteristics. Therefore, based on the flocculation characteristics during flocculation, raw water can be classified according to the dosage to determine the optimal flocculant dosage.
[0065] 2. Although the relationship between flocculant dosage and flocculation effect is generally non-linear, that is:
[0066] a. The flocculation effect does not continuously improve with increasing dosage, but may worsen;
[0067] b. The relationship between dosage and raw water turbidity is not necessarily true that the higher the raw water turbidity, the more flocculant is needed. In fact, the opposite may be true. For example, when the raw water turbidity is 30 NTU, the amount of flocculant added when the turbidity of the settled water is 1 NTU is less than when the raw water turbidity is 20 NTU.
[0068] However, the inventors also discovered that the above nonlinearity is a qualitative description from a broad perspective. When limited to a smaller range of variation, the relationship between the flocculant dosage and the flocculation effect still largely conforms to a linear relationship.
[0069] Based on the above findings, the inventors conducted further research and development, resulting in this invention. This invention provides a method and apparatus for optimizing the dosage of flocculant in raw water treatment, achieving intelligent optimization of the flocculant dosage.
[0070] Example 1
[0071] Embodiment 1 of the present invention provides a method for optimizing the dosage of flocculant in raw water treatment, comprising: inputting multiple frames of images of a sample of raw water to be treated during the flocculation process into a flocculation characteristic category prediction model; determining the optimal dosage of flocculant for the raw water to be treated based on the flocculation characteristic category prediction results output by the model and the pre-determined mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant.
[0072] Furthermore, the flocculation process includes a first stirring stage, a second stirring stage, and a settling stage, arranged in order of time. The stirring speed in the first stirring stage is greater than that in the second stirring stage. The multi-frame images in the flocculation process include multi-frame images of the first stirring stage, the second stirring stage, and the settling stage.
[0073] For an understanding of flocculation characteristics, please refer to the above introduction. Different flocculation characteristics of raw water will lead to different optimal flocculant dosages. Conversely, raw water with the same flocculation characteristics will have similar turbidity after treatment with the same flocculant dosage. That is, raw water with the same flocculation characteristics will have the same optimal flocculant dosage.
[0074] The determination of the mapping relationship between the above-mentioned flocculation characteristic categories and the optimal dosage of flocculant is described in Example 2, and the establishment of the flocculation characteristic category prediction model is described in Example 3.
[0075] The raw water treatment flocculant dosage optimization method provided in Embodiment 1 of this invention creatively proposes a flocculation characteristic classification scheme that can reflect the optimal dosage of flocculant. The flocculation characteristic category is determined in advance based on the optimal dosage of flocculant, and a mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant is established. Based on the mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant, a pre-trained flocculation characteristic category prediction model is used to realize intelligent optimization of the raw water treatment flocculant dosage.
[0076] Example 2
[0077] Embodiment 2 of the present invention provides a method for determining the mapping relationship between flocculation characteristic categories and the optimal dosage of flocculant, see [link to documentation]. Figure 1 As shown, it includes the following steps:
[0078] Step S11: Collect several groups of water samples, divide each group of water samples into several parts, and for each part of water sample, obtain the flocculant dosage and turbidity after flocculation through flocculation cup test. The flocculant dosage is different for each part of water sample in the same group.
[0079] Based on experience, the optimal dosage of flocculant is predicted according to the flocculation characteristics. Several groups of water samples are selected, and water samples with different flocculation characteristics, i.e., the required optimal dosage of flocculant, are selected as much as possible.
[0080] Step S12: For each group of water samples, based on the target turbidity, the amount of flocculant used for each water sample, and the turbidity after flocculation, determine the optimal amount of flocculant used for the water sample using the arithmetic progression method.
[0081] As previously discussed, although the relationship between flocculant dosage and flocculation effect is generally non-linear, within a small range of variation, the relationship between flocculant dosage and flocculation effect, i.e., between flocculant dosage and turbidity, still largely conforms to a linear relationship. Therefore, the optimal flocculant dosage for a water sample can be determined using the arithmetic progression method.
[0082] Step S13: Divide each group of water samples into flocculation characteristic categories according to the optimal dosage of flocculant, determine the optimal dosage of flocculant corresponding to each flocculation characteristic category, and obtain the mapping relationship between flocculation characteristic category and optimal dosage of flocculant.
[0083] Specifically, the optimal flocculant dosage for water samples can be divided into multiple intervals, and water samples with optimal flocculant dosages within the same interval can be grouped into a category with the same flocculation characteristics. Based on multiple optimal flocculant dosages for the same category of water samples, the optimal flocculant dosage corresponding to that flocculation characteristic category can be determined by taking the maximum or average value of multiple optimal flocculant dosages.
[0084] Example 3
[0085] Embodiment 3 of the present invention provides a method for establishing a prediction model for flocculation characteristic categories, see [link to documentation]. Figure 2 As shown, it includes the following steps:
[0086] Step S21: Collect several water samples, and for each water sample, obtain multiple frames of images of the flocculation process through a flocculation cup test.
[0087] The water samples here need to include water samples of various flocculation characteristics, and ideally, the proportion of each flocculation characteristic category should be similar.
[0088] Therefore, based on the water samples collected in Example 2, further water samples can be collected to establish the flocculation characteristic category prediction model. For example, each set of water samples used in determining the mapping relationship between flocculation characteristic categories and the optimal dosage of flocculant can be divided into two sets. One set is used to determine the mapping relationship between flocculation characteristic categories and the optimal dosage of flocculant, and the other set is used to establish the sample set for training the flocculation characteristic category prediction model. In this way, each water sample in this example has parallel samples, and its flocculation characteristic category can be obtained.
[0089] Optionally, multiple frames of images of each water sample required in this embodiment during the flocculation process can also be obtained directly during the flocculation cup test in Example 2.
[0090] Step S22: Take each frame of image and the flocculation characteristic category corresponding to that image as a sample to obtain a sample set.
[0091] Step S23: Train the specified learning model using the sample set to obtain the flocculation characteristic category prediction model.
[0092] A fusion learning model can be trained using a sample set to obtain a prediction model for flocculation property categories.
[0093] Fusion learning models include multiple deep learning network models and ensemble algorithms.
[0094] Specifically, a fusion learning model can include AlexNet, LeNet, and VGG16 network models, along with ensemble algorithms. Taking the ensemble of three models as an example, the multi-model structure and ensemble method are as follows: Figure 3 As shown.
[0095] Furthermore, after multiple experiments and optimizations, the structure of each deep learning network model can be set as follows:
[0096] (1) AlexNet network model
[0097] The AlexNet network model consists of 11 neural network layers, including 5 convolutional layers, 3 max-pooling layers, and 3 fully connected layers. The specific parameters of each layer are shown in Table 1.
[0098] Table 1 AlexNet Network Model Structure
[0099] Layer_Name Kernel_Size Kernel_Num Padding Stride Input_shape Output_shape Conv1 11 48 [1,2] 4 [3,120,120] [48,55,55] Maxpool1 3 None 0 2 [48,55,55] [48,27,27] Conv2 5 128 [2,2] 1 [48,27,27] [128,27,27] Maxpool2 3 None 0 2 [128,27,27] [192,13,13] Conv3 3 192 [1,1] 1 [192,13,13] [192,13,13] Conv4 3 192 [1,1] 1 [192,13,13]] [192,13,13] Conv5 3 128 [1,1] 1 [192,13,13] [128,6,6] Maxpool3 3 None 0 2 [13,13,384] [6,6,384] FC1 2048 None None None 2048*1 vector FC2 2048 None None None 2048*1 vector FC3 1024 None None None 1024*1 vector
[0100] (2) LeNet network model
[0101] The LeNet network model consists of 7 layers: 2 convolutional layers, 2 pooling layers, and 3 fully connected layers. The specific parameters of each layer are shown in Table 2.
[0102] Table 2 LeNet Network Model Structure Table
[0103] Layer_Name Kernel_Size Kernel_Num Padding Stride Input_shape Output_shape Conv1 5 16 [1,2] 1 [3,120,120] [48,55,55] Maxpool1 2 None 0 2 [48,55,55] [48,27,27] Conv2 5 32 [2,2] 1 [48,27,27] [128,27,27] Maxpool2 2 None 0 2 [128,27,27] [128,13,13] FC1 2048 None None None 2048*1 vector FC2 2048 None None None 2048*1 vector FC3 2048 None None None 2048*1 vector
[0104] (3) VGG16 network model
[0105] The VGG16 network model consists of 20 sub-layers, including two conv3-64 sub-layers in the first convolutional layer, two conv3-128 sub-layers in the second convolutional layer, three conv3-256 sub-layers in the third convolutional layer, three conv3-512 sub-layers in the fourth convolutional layer, three conv3-512 sub-layers in the fifth convolutional layer, two FC4096 sub-layers, one FC1024 sub-layer, and four max-pooling sub-layers. The specific parameters of each layer are shown in Table 3.
[0106] Table 3 VGG16 Network Model Structure
[0107]
[0108]
[0109] Ensemble algorithms for fusion learning models can employ majority voting:
[0110] The label categories of the input data are {c1, c2, ..., c...} k In the prediction results of multiple CNN networks for the predicted sample x, the most numerous category c is... i As the final classification category, i.e., H(x) = c i .
[0111] In some embodiments, a fusion learning model is trained using a sample set through cross-sampling to obtain a flocculation characteristic category prediction model. See [link to details]. Figure 4 As shown, it includes:
[0112] Step S41: Divide the samples in the sample set into different subsets according to their different flocculation characteristics.
[0113] Step S42: Extract training samples from each subset according to a set ratio to obtain the training set and the validation set.
[0114] Step S43: Set the number of rounds, batch size, and learning rate for model training. Each round of model training includes: for each deep learning network model, input the training set into the model for forward propagation to obtain a prediction output, determine the update gradient based on the loss value of the output, update the model weights based on the update gradient, and determine the model prediction performance using the validation set.
[0115] The number of training epochs for the model can be set to 20-50, the batch size to 32, and the learning rate to 0.0001.
[0116] Step S44: Determine whether the preset training termination condition has been met.
[0117] The training termination condition can be either reaching a preset number of training iterations or achieving a set accuracy requirement for prediction accuracy.
[0118] Furthermore, the prediction accuracy can be determined by using an ensemble algorithm to obtain the integrated output result based on the output results of each deep learning network model on the input validation set, and then using the integrated output result and the label data of the samples in the validation set to determine the prediction accuracy of the model.
[0119] If step S44 is determined to be yes, proceed to step S45; if step S44 is determined to be no, return to proceed to step S42.
[0120] Step S45: Terminate training and obtain the flocculation characteristic category prediction model.
[0121] Specifically, the establishment of the prediction model and the prediction process can be found in [link to relevant documentation]. Figure 5 As shown, the labeled dataset is divided into a training set and a sample set. After the model training is completed, new data is input into the final model to obtain the prediction results.
[0122] The method for establishing a flocculation characteristic category prediction model provided in Embodiment 3 of this invention can effectively alleviate the dependence of deep models on training parameters and improve the practicality of the algorithm in real-world scenarios through the integrated learning of multiple deep learning network models. At the same time, it can effectively alleviate the problems of wasted training resources, poor training effect, and difficulty in hyperparameter design.
[0123] Example 4
[0124] Embodiment 4 of the present invention provides a specific application of a method for optimizing the dosage of flocculant in raw water treatment, comprising the following steps:
[0125] 1. Five groups of water samples were collected, and each group of water samples was divided into five parts. The first four parts were about 2L each, denoted as the j-th part of the i-th group, i = 1, 2, 3, 4, 5, j = 1, 2, 3, 4; the fifth part of the water sample was about 10L.
[0126] Steps 2-10 are performed using the first four water samples from each group.
[0127] 2. A flocculation data acquisition system consisting of a reaction vessel, water quality probe, camera, stirrer, and light box is used to collect flocculation data.
[0128] Preferably, the reaction vessel is made of acrylic material with a volume of 2L. The water quality probes include a turbidity probe, a COD probe, a pH probe, and a temperature probe. The camera is a CCD industrial camera. The stirrer is a manual knob speed-adjustable type. The light box is a three-sided enclosed type, lined with silver reflective paper and equipped with light strips to form a stable light source.
[0129] 3. Pour the first sample of water from group 1 into the reaction vessel and add flocculant at a dosage of M.
[0130] Preferably, the flocculant is PAC, and the dosage is 20 ml / L.
[0131] 4. Conduct the reaction experiment, which consists of three parts: rapid stirring, slow stirring, and standing.
[0132] Preferably, the fast stirring speed is 200 rpm and the stirring time is 120 s; the slow stirring speed is 30 rpm and the stirring time is 600 s; the static stirring speed is 0 rpm and the static time is 1200 s.
[0133] 5. From the start of the rapid stirring stage to the end of the settling stage, the camera captures images of the flocs in the reaction vessel.
[0134] The preferred acquisition frequency is 1fps, and the shooting area is 2cm*2cm.
[0135] 6. After settling, collect water quality parameter data.
[0136] Preferred parameters include turbidity, COD, pH value, and water temperature.
[0137] 7. Store the image data from steps 3-5 of the experiment, labeling them as 1-1.
[0138] 8. Select 2 to 4 water samples from Group 1 respectively, repeat steps 3 to 5, store the corresponding image data, and label them to obtain data labeled as 1-2, 1-3, and 1-4.
[0139] 9. Select water samples from groups 2 to 5 respectively, repeat steps 3-6, store the corresponding image data, and label them to obtain data labeled as 2-1, 2-2, 2-3, 2-4, 3-1, 3-2, 3-3, 3-4, 4-1, 4-2, 4-3, 4-4, 5-1, 5-2, 5-3, 5-4.
[0140] 10. Divide the 20 labeled data sets into 5 categories based on turbidity.
[0141] 11. The fifth portion of the first group of water samples was further divided into five portions to obtain the turbidity corresponding to different flocculant dosages. The minimum dosage b1…b(T) for the target turbidity X after sedimentation in the first group of water samples was obtained by using the difference series method.
[0142] Preferably, X is 40 NTU, and within the same group, the largest b(max) is selected as the optimal dosage b1_best for that group.
[0143] 12. Select groups 2 to 5 and repeat step 11 to obtain the above b(max2) to b(max5), which are the corresponding optimal dosages b2_best to b(5)_best.
[0144] 13. Form an optimal dosage mapping table.
[0145] Table 4. Mapping relationship between flocculation characteristic categories and optimal flocculant dosage.
[0146] Raw water classification 1 2 … 5 Optimal dosage b1_best b2_best … b(5)_best
[0147] 14. Store the five types of image data in five folders according to the projection mapping table, and name the folders 1, 2, 3, 4 and 5 respectively.
[0148] 15. Perform a 3-fold cross partitioning on the 5 classes of data to obtain a training set and a validation set, with a ratio of 4:1 between the training set and the validation set.
[0149] 16. Data Training: Input the training and validation sets into the fusion learning model integrating multiple neural network models. Set the number of epochs, batch size, and learning rate for computation. Optimal epochs are 20-50, batch size is 32, and learning rate is 0.0001. Each training epoch includes the following steps:
[0150] 1) Data loading and preprocessing: Load a batch of data from the training dataset and preprocess the data, which may include data denoising, augmentation, inversion and other operations to ensure data quality and consistency.
[0151] 2) Forward Propagation: The current batch of input data (such as images, text, etc.) is passed to the neural network model. The data is propagated forward through various layers of the model (such as convolutional layers, pooling layers, fully connected layers, etc.). A predicted output is typically generated in the last layer of the model.
[0152] 3) Calculate the loss: Use the cross-entropy loss function to calculate the error (loss) between the model's predicted output and the actual label.
[0153] 4) Backpropagation: Based on the calculated loss value, the gradient is calculated using a backpropagation algorithm (such as the chain rule). The gradient represents the contribution of each weight in the model to the loss value, that is, how much changing a certain weight can affect the loss value.
[0154] 5) Update weights: Use the Adam optimizer to update the model weights based on the calculated gradients.
[0155] 6) Evaluation and Validation: After each epoch, the model's performance can be evaluated using the validation set and the accuracy.
[0156] 7) Voting Integration: The three networks proceed sequentially according to steps 1)-6) above, voting on their accuracy to obtain the accuracy of the integrated model.
[0157] The label categories of the input data are {c1, c2, ..., c...} k In the prediction results of the three CNN networks for the predicted sample x, the category c with the largest number of occurrences is... i As the final classification category, i.e., H(x) = c i
[0158] 8) Iteration and Adjustment: Repeat the above steps (data loading, forward propagation, loss calculation, back propagation, weight update, evaluation and verification, voting ensemble) until the preset number of epochs is reached or other stopping conditions are met.
[0159] 17. Repeat steps 15 and 16 until the preset number of training sessions is reached.
[0160] 18. After training, save the parameters of the three models as a pth format file.
[0161] 19. For new image data, load the pth format file for classification prediction to obtain the raw water classification corresponding to the image data.
[0162] 20. Find the optimal dosage corresponding to the raw water category in the dosage mapping table.
[0163] 21. Input the optimal dosage into the input terminal of the dosing pump control system.
[0164] Based on the inventive concept of this invention, embodiments of this invention also provide a device for optimizing the dosage of flocculant in raw water treatment, see [link to relevant documentation]. Figure 6 As shown, it includes a mapping relationship determination module 61, a prediction model establishment module 62, and a flocculant dosage optimization module 63.
[0165] The flocculant dosage optimization module 63 is used to input multiple frames of images of the raw water sample during the flocculation process into the prediction model building module 62, which is pre-established as a flocculation characteristic category prediction model. Based on the flocculation characteristic category prediction results output by the model and the mapping relationship between the flocculation characteristic category and the optimal flocculant dosage pre-determined by the mapping relationship determination module 61, the optimal flocculant dosage for the raw water to be treated is determined.
[0166] In some embodiments, the mapping relationship determination module 61 is used to collect several groups of water samples, divide each group of water samples into several parts, and for each part of water sample, obtain the flocculant dosage and the turbidity after flocculation through flocculation cup test. The flocculant dosage of each part of water sample in the same group is different. For each group of water samples, based on the target turbidity, the flocculant dosage of each part of water sample and the turbidity after flocculation, the optimal dosage of flocculant for the water sample is determined by the arithmetic sequence method. According to the optimal dosage of flocculant, each group of water samples is divided into flocculation characteristic categories, and the optimal dosage of flocculant corresponding to each flocculation characteristic category is determined to obtain the mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant.
[0167] In some embodiments, the prediction model building module 62 is used to pre-build a flocculation characteristic category prediction model in the following manner: collect several water samples, and for each water sample, obtain multiple frames of images during the flocculation process through a flocculation cup test; take each frame of image and the flocculation characteristic category corresponding to the image as a sample to obtain a sample set; use the sample set to train a specified learning model to obtain a flocculation characteristic category prediction model.
[0168] In some embodiments, the prediction model building module 62, which trains a specified learning model using the sample set to obtain a flocculation characteristic category prediction model, is used for:
[0169] The fusion learning model is trained using the sample set to obtain a flocculation characteristic category prediction model. The fusion learning model includes multiple deep learning network models and ensemble algorithms.
[0170] In some embodiments, the prediction model building module 62, which uses the sample set to train a fusion learning model to obtain a flocculation characteristic category prediction model, is used for:
[0171] Using the aforementioned sample set, a fusion learning model is trained through cross-sampling to obtain a flocculation characteristic category prediction model.
[0172] In some embodiments, the prediction model building module 62, which uses the sample set to train a fusion learning model through cross-sampling to obtain a flocculation characteristic category prediction model, is used for:
[0173] The samples in the sample set are divided into different subsets according to different flocculation characteristic categories; training samples are extracted from each subset according to a set ratio to obtain a training set and a validation set; the number of rounds, batch size, and learning rate of model training are set, and each round of model training includes: for each deep learning network model, the training set is input into the model for forward propagation to obtain a predicted output, the update gradient is determined based on the loss value of the output, the model weights are updated based on the update gradient, and the model prediction performance is determined using the validation set; the process of extracting training samples from each subset according to a set ratio to obtain a training set and a validation set is repeated until a preset training termination condition is reached.
[0174] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0175] Based on the inventive concept of the present invention, the embodiments of the present invention also provide a computer storage medium, wherein the computer storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the above-mentioned method for optimizing the dosage of flocculant in raw water treatment is implemented.
[0176] Based on the inventive concept of the present invention, an embodiment of the present invention also provides a server, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-mentioned method for optimizing the dosage of flocculant in raw water treatment.
[0177] Unless otherwise specifically stated, terms such as processing, calculation, operation, determination, display, etc., may refer to the actions and / or processes of one or more processing or computing systems or similar devices that represent the manipulation and conversion of data representing physical (e.g., electronic) quantities within the registers or memory of the processing system into other data similarly representing physical quantities within the memory, registers, or other such information storage, transmission, or display devices of the processing system. Information and signals can be represented using any of a variety of different techniques and methods. For example, data, instructions, commands, information, signals, bits, symbols, and chips mentioned throughout the above description can be represented by voltage, current, electromagnetic waves, magnetic fields or particles, light fields or particles, or any combination thereof.
[0178] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process may be rearranged without departing from the scope of this disclosure. The appended method claims provide elements of various steps in an exemplary order and are not intended to limit the scope to the specific order or hierarchy described.
[0179] In the detailed description above, various features are combined together in a single embodiment to simplify this disclosure. This approach to disclosure should not be construed as reflecting an intention that embodiments of the claimed subject matter require more features than those stated in each claim. Rather, as reflected in the appended claims, the invention is presented with fewer features than all of the features in a single disclosed embodiment. Therefore, the appended claims are hereby clearly incorporated into the detailed description, wherein each claim stands alone as a preferred embodiment of the invention.
[0180] Those skilled in the art will also understand that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments herein can be implemented as electronic hardware, computer software, or a combination thereof. To clearly illustrate the interchangeability between hardware and software, the various illustrative components, blocks, modules, circuits, and steps described above are generally described in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. Those skilled in the art can implement the described functionality in alternative ways for each specific application; however, such implementation decisions should not be construed as departing from the scope of this disclosure.
[0181] The steps of the methods or algorithms described in conjunction with the embodiments herein can be directly embodied in hardware, software modules executed by a processor, or a combination thereof. The software modules can reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium well known in the art. An exemplary storage medium is connected to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. The ASIC can reside in a user terminal. Alternatively, the processor and storage medium can exist as discrete components in the user terminal.
[0182] For software implementation, the techniques described in this application can be implemented using modules (e.g., procedures, functions, etc.) that perform the functions described in this application. This software code can be stored in memory units and executed by a processor. The memory units can be implemented within the processor or outside the processor; in the latter case, they are communicatively coupled to the processor via various means, as is well known in the art.
[0183] The foregoing description includes examples of one or more embodiments. It is certainly impossible to describe all possible combinations of components or methods in order to describe the above embodiments, but those skilled in the art will recognize that further combinations and arrangements of the various embodiments are possible. Therefore, the embodiments described herein are intended to cover all such changes, modifications, and variations that fall within the scope of the appended claims. Furthermore, the term "comprising" as used in the specification or claims is interpreted in a manner similar to the term "including," as interpreted when used as a conjunction in the claims. Additionally, the use of any term "or" in the specification of the claims is intended to mean "non-exclusive or."
Claims
1. A method for optimizing the dosage of flocculant in raw water treatment, characterized in that, include: Multiple frames of images of the raw water sample during the flocculation process are input into the flocculation characteristic category prediction model. Based on the flocculation characteristic category prediction results output by the model and the pre-determined mapping relationship between the flocculation characteristic category and the optimal flocculant dosage, the optimal flocculant dosage for the raw water to be treated is determined.
2. The method as described in claim 1, characterized in that, The mapping relationship between the flocculation characteristic category and the optimal dosage of flocculant is determined in advance in the following manner: Several groups of water samples were collected, and each group of water samples was divided into several parts. For each part of water sample, the flocculant dosage and the turbidity after flocculation were obtained through flocculation cup test. The flocculant dosage was different for each part of water sample in the same group. For each group of water samples, the optimal amount of flocculant for each water sample is determined using the arithmetic sequence method based on the target turbidity, the amount of flocculant used for each water sample, and the turbidity after flocculation. Based on the optimal dosage of flocculant, each group of water samples was classified into flocculation characteristic categories, and the optimal dosage of flocculant corresponding to each flocculation characteristic category was determined, thus obtaining the mapping relationship between flocculation characteristic categories and optimal flocculant dosage.
3. The method as described in claim 1, characterized in that, The flocculation characteristic category prediction model is pre-established in the following manner: Several water samples were collected, and for each water sample, multiple frames of images of the flocculation process were obtained through flocculation cup experiments; Each frame of image and the corresponding flocculation characteristic category are treated as a sample to obtain a sample set; The specified learning model is trained using the sample set to obtain a prediction model for flocculation characteristic categories.
4. The method as described in claim 3, characterized in that, The flocculation cup test includes a first stirring stage, a second stirring stage, and a settling stage, arranged in order of time. The stirring speed in the first stirring stage is greater than the stirring speed in the second stirring stage. The multi-frame images during the flocculation process include multi-frame images of the first stirring stage, multi-frame images of the second stirring stage, and multi-frame images of the settling stage.
5. The method as described in claim 3, characterized in that, The step of training a specified learning model using the sample set to obtain a flocculation characteristic category prediction model includes: The fusion learning model is trained using the sample set to obtain a flocculation characteristic category prediction model. The fusion learning model includes multiple deep learning network models and ensemble algorithms.
6. The method as described in claim 5, characterized in that, The fusion learning model includes the AlexNet network model, the LeNet network model, and the VGG16 network model.
7. The method as described in claim 6, characterized in that, The AlexNet network model consists of 11 neural network layers, including 5 convolutional layers, 3 max pooling layers, and 3 fully connected layers. The LeNet network model consists of a 7-layer neural network, including 2 convolutional layers, 2 pooling layers, and 3 fully connected layers; The VGG16 network model includes 20 sub-layers, including two conv3-64 sub-layers in the first convolutional layer, two conv3-128 sub-layers in the second convolutional layer, three conv3-256 sub-layers in the third convolutional layer, three conv3-512 sub-layers in the fourth convolutional layer, three conv3-512 sub-layers in the fifth convolutional layer, two FC4096 sub-layers, one FC1024 sub-layer, and four max-pooling sub-layers.
8. The method as described in claim 5, characterized in that, The step of training a fusion learning model using the sample set to obtain a flocculation characteristic category prediction model includes: Using the aforementioned sample set, a fusion learning model is trained through cross-sampling to obtain a flocculation characteristic category prediction model.
9. The method as described in claim 8, characterized in that, The step of training a fusion learning model using the sample set through cross-sampling to obtain a flocculation characteristic category prediction model includes: The samples in the sample set are divided into different subsets according to their different flocculation characteristics. Training samples are extracted from each subset according to a set ratio to obtain a training set and a validation set. Set the number of rounds, batch size, and learning rate for model training. Each round of model training includes: for each deep learning network model, inputting the training set into the model for forward propagation to obtain a prediction output, determining the update gradient based on the loss value of the output, updating the model weights based on the update gradient, and determining the model prediction performance using the validation set. Return to the previous step and extract training samples from each subset according to the set ratio to obtain the training set and the validation set, until the preset training termination condition is reached.
10. The method as described in claim 9, characterized in that, The settings for the number of training epochs, batch size, and learning rate of the model include: The model training rounds are set to 20-50, the batch size to 32, and the learning rate to 0.0001.
11. A device for optimizing the dosage of flocculant in raw water treatment, characterized in that, It includes a mapping relationship determination module, a prediction model establishment module, and a flocculant dosage optimization module; The flocculant dosage optimization module is used to input multiple frames of images of the raw water sample during the flocculation process into the flocculation characteristic category prediction model pre-established by the prediction model building module. Based on the flocculation characteristic category prediction results output by the model and the mapping relationship between the flocculation characteristic category and the optimal flocculant dosage pre-determined by the mapping relationship determination module, the optimal flocculant dosage for the raw water to be treated is determined.
12. A computer storage medium, characterized in that, The computer storage medium stores computer-executable instructions, which, when executed by a processor, implement the method for optimizing the dosage of flocculant in raw water treatment as described in any one of claims 1 to 11.
13. A server, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method for optimizing the dosage of flocculant for raw water treatment as described in any one of claims 1 to 11.