A method and system for constructing a water plant alum flower image calibration database based on a clustering semi-supervised learning model
By combining a clustering semi-supervised learning model with a convolutional neural network, high-quality alum floc image segmentation without manual annotation was achieved, solving the problems of high subjectivity and low efficiency in alum floc recognition in water plants, and improving water quality stability and response speed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LUOJIA HAOJING DIGITAL TECH (HUBEI) CO LTD
- Filing Date
- 2025-08-22
- Publication Date
- 2026-06-05
AI Technical Summary
Current technologies for identifying floc in water plants rely on manual observation, which is highly subjective, inefficient, and has a slow response time. This makes it difficult to meet the real-time, accuracy, and consistency requirements of modern smart water plants, and the predictive ability of traditional models decreases on new datasets.
A semi-supervised learning model based on clustering is adopted. By constructing an image clustering model of convolutional neural network, high-quality pixel-level image segmentation without manual annotation is achieved. Combined with process operation monitoring parameters, a parameter-driven weakly supervised calibration mechanism is constructed to establish a high-quality mapping between image segmentation results and actual working conditions.
It has achieved efficient and accurate detection and calibration of alum floc areas, reduced water treatment costs, broken through the technical bottleneck of relying on manual experience, and improved water quality stability and response speed.
Smart Images

Figure CN121074547B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of database construction, specifically relating to a method and system for constructing a database for water plant floc image labeling based on a clustering semi-supervised learning model. Background Technology
[0002] Coagulation dosing is a crucial step in water treatment, and its control precision directly affects flocculation efficiency and the stable operation of subsequent processes such as sedimentation and filtration. Floc formation is the most representative visual indicator of the coagulation process, and its state is highly correlated with the coagulant dosing effect and water quality changes. Therefore, accurately identifying and judging the floc state becomes the direct basis for adjusting the coagulant dosage. Currently, water plants generally use manual visual monitoring and evaluation of floc, which suffers from low efficiency, high subjectivity, and delayed response, making it difficult to meet the real-time, accuracy, and consistency requirements of modern intelligent water plants.
[0003] In recent years, alum floc image recognition technology based on machine learning and deep learning has been gradually applied in flocculation optimization control. This technology can extract alum floc image features, perform classification and target detection, thereby helping operators identify anomalies, optimize reagent dosage, and improve flocculation effect and water quality stability. However, traditional alum floc detection algorithms based on machine learning and image processing require a large amount of input image data and are at risk of model overfitting. While overfitted models may have high prediction accuracy on specific datasets, their predictive ability on new datasets decreases due to learning noise unrelated to image features, making them difficult to generalize and apply. Although some computer vision-based alum floc recognition technologies exist, the lack of high-quality labeled datasets limits model training effectiveness, hindering the promotion and application of these technologies. Therefore, there is an urgent need for an automated and efficient alum floc image annotation technique to establish high-quality labeled datasets, thereby improving the performance and practical application value of recognition models. Summary of the Invention
[0004] The purpose of this invention is to address the problems of high subjectivity, low efficiency, and delayed response caused by the reliance on manual observation of floc during coagulant dosing. It provides a method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model. By constructing an image clustering model based on a convolutional neural network, high-quality pixel-level image segmentation without manual annotation is achieved. Furthermore, by combining process operation monitoring parameters (including source water turbidity, coagulant dosage, retention time, and effluent water quality) corresponding to the floc image acquisition time, a parameter-driven weakly supervised labeling mechanism is constructed to semantically enhance the initial cluster label map, establishing a high-quality mapping between image segmentation results and actual operating conditions.
[0005] According to one aspect of the present invention, a method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model is provided, comprising:
[0006] S1. Collect images of alum flocs and the corresponding process operation monitoring parameters, and preprocess the alum floc images and process operation monitoring parameters;
[0007] S2. Input the preprocessed alum flower image into the trained clustering semi-supervised learning model to obtain a cluster label map; wherein, the training of the clustering semi-supervised learning model includes:
[0008] Construct a dataset of alum flower images;
[0009] A semi-supervised learning model for clustering is constructed, including: a feature encoding module, used to extract and encode features from the input alum flower image; a response mapping module, used to map the encoded features to the clustering space and calculate the response vector of each pixel; and a pixel classification module, which uses the Argmax function to classify the response vector of each pixel and obtain a cluster label map.
[0010] A clustering semi-supervised learning model was trained on the constructed alum flower image dataset. The network parameters and cluster label map were iteratively optimized using a differentiable mechanism to obtain the trained clustering semi-supervised learning model.
[0011] S3. Timestamp matching is performed between the alum flower images and process operation monitoring parameters, and a sample calibration unit is formed by combining the cluster label map. The sample calibration unit is tested using a consistency verification mechanism. The sample calibration unit that passes the test is used to construct the alum flower image calibration database.
[0012] Furthermore, the training of the clustering semi-supervised learning model includes:
[0013] Construct a dataset of alum flower images;
[0014] A joint loss function is constructed, comprising: feature similarity loss and spatial continuity loss; wherein, the feature similarity loss is the cross-entropy loss between the response vector set of each pixel and the corresponding cluster label; the spatial continuity loss utilizes the spatial relationship constraints between pixels to minimize the difference between the response vectors of adjacent pixels;
[0015] A clustering semi-supervised learning model was trained on the constructed alum flower image dataset. A differentiable mechanism was used to iteratively optimize the network parameters and cluster label map. Combined with the constructed joint loss function, the trained clustering semi-supervised learning model was obtained.
[0016] Furthermore, a differentiable method is used to iteratively optimize the network parameters and cluster labels, including:
[0017] S3.1 When the network parameters are fixed, the clustering label is predicted by feature response mapping, and the clustering label is used as a pseudo-target to calculate and optimize the joint loss;
[0018] S3.2 When the clustering labels are fixed, the network parameters are optimized by the stochastic gradient descent algorithm. The network parameters include convolutional filter parameters and classifier parameters.
[0019] S3.3. Alternately execute S3.1 and S3.2 until the joint loss function converges.
[0020] Further, S3 includes:
[0021] By using a timestamp mechanism, each frame of alum floc image is matched one-to-one with the corresponding process operation monitoring parameters to establish an image-parameter pairing relationship;
[0022] The image-parameter pairing relationship and the cluster label map are combined to form the sample calibration unit;
[0023] A consistency verification mechanism is used to test the sample calibration units. After the test is passed, the samples are stored in the alum flower image calibration database.
[0024] Furthermore, a consistency verification mechanism is employed to verify the sample calibration units, including:
[0025] Verify that the timestamps of the floc images and the process operation monitoring parameters match correctly.
[0026] Verify whether the sample calibration unit contains complete field names and valid values;
[0027] Verify that the path to the alum flower image exists and points to a valid image file with a valid format and complete structure;
[0028] Sample calibration units that pass all three tests are stored in the alum flower image calibration database.
[0029] Furthermore, the floc images and process operation monitoring parameters are preprocessed, including:
[0030] Standardization processing of alum flower images includes image resizing, color normalization, conversion to a unified format, noise reduction, and edge restoration;
[0031] Normalize and clean the structure of process operation monitoring parameters, including missing value filling, unit unification, time alignment and interpolation expansion.
[0032] Furthermore, the feature similarity loss and the spatial continuity loss are specifically as follows:
[0033] The feature similarity loss is the cross-entropy loss between the response vector set of each pixel and the corresponding cluster label; the spatial continuity loss utilizes the spatial relationship constraints between pixels to minimize the difference between the response vectors of adjacent pixels.
[0034] According to one aspect of the present invention, a system for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model is provided, comprising:
[0035] The data acquisition module is used to collect images of alum floc and corresponding process operation monitoring parameters, and to preprocess the alum floc images and the process operation monitoring data.
[0036] The cluster label image acquisition module is used to input the preprocessed alum flower image into the trained clustering semi-supervised learning model to obtain the cluster label image;
[0037] The calibration database construction module is used to match the timestamps of alum flower images and process operation monitoring parameters, and combine them with cluster label maps to form sample calibration units. A consistency verification mechanism is used to verify the sample calibration units. The sample calibration units that pass the verification are used to construct the alum flower image calibration database.
[0038] According to one aspect of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, characterized in that the processor executes the computer program to implement the steps of the method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model.
[0039] According to one aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the method for constructing a water plant floc image calibration database based on a clustering semi-supervised learning model.
[0040] Compared with the prior art, the beneficial effects of the present invention are:
[0041] 1. This invention utilizes a combination of CNN encoding and clustering optimization, which not only efficiently extracts features from alum flower images but also achieves accurate segmentation through response mapping and joint loss, providing reliable technical support for the construction of alum flower region detection and calibration database.
[0042] 2. This invention effectively reduces the overall water treatment cost by constructing a high-quality data calibration set, breaks through the technical bottleneck of traditionally relying on manual experience to observe the floc state for coagulant addition adjustment, and realizes image-driven and parameter calibration.
[0043] 3. This invention transfers the water treatment testing and monitoring process, which traditionally relies on high-precision sensors and data acquisition equipment, to a computer simulation environment, thus avoiding the purchase of large equipment and complex post-maintenance work. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a flowchart illustrating the construction process of a water plant floc image labeling database based on a clustering semi-supervised learning model, as provided in an embodiment of the present invention.
[0046] Figure 2 This is a schematic diagram of the clustering semi-supervised learning model structure provided in an embodiment of the present invention. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] like Figure 1As shown, this embodiment of the invention provides a method for constructing a water plant alum floc image labeling database based on a clustering semi-supervised learning model, including: S1, collecting alum floc images and corresponding process operation monitoring parameters, and preprocessing the alum floc images and the process operation monitoring data; S2, inputting the preprocessed alum floc images into a trained clustering semi-supervised learning model to obtain cluster label maps; wherein, the training of the clustering semi-supervised learning model includes: constructing an alum floc image dataset; building a clustering semi-supervised learning model, including: a feature encoding module, used for feature extraction and feature encoding of the input alum floc images; and a response mapping module, used for mapping the feature encoding... The features are then mapped to the clustering space, and the response vector of each pixel is calculated. In the pixel classification module, the Argmax function is used to classify the response vector of each pixel, resulting in a cluster label map. A semi-supervised learning model for clustering is trained on the constructed alum flower image dataset. A differentiable mechanism is used to iteratively optimize the network parameters and the cluster label map, resulting in a well-trained semi-supervised learning model. In S3, the alum flower images and process operation monitoring parameters are time-stamped and combined with the cluster label map to form sample calibration units. A consistency verification mechanism is used to verify the sample calibration units. Sample calibration units that pass the verification are used to construct the alum flower image calibration database.
[0049] Specifically, embodiments of the present invention also provide data collection and preprocessing steps, the specific steps of which are as follows:
[0050] 1. Multi-source data collection. A video image acquisition system is used during the actual operation of the water plant to capture images of floc in the coagulation tank underwater or through transparent media. Simultaneously, corresponding process operation monitoring parameters are collected in real time, serving as the foundation for subsequent modeling and calibration. The collected monitoring data includes, but is not limited to: raw water influent turbidity, type and actual dosage of coagulant, hydraulic retention time, key effluent water quality indicators (such as suspended solids concentration, effluent turbidity, color, chemical oxygen demand (COD), total phosphorus (TP), and total nitrogen (TN),) and influent and effluent flow rates. All collected data is precisely synchronized using timestamps and batch numbers to ensure consistency between images and process operation monitoring parameters. The final multimodal raw sample dataset consists of two parts: image data and process operation monitoring parameters, all with unified timestamps, serving as input for subsequent modeling.
[0051] 2. Image Data Preprocessing. Median filtering, erosion, and dilation techniques were used to enhance and denoise the acquired alum floc images, standardizing their size, format, and pixels to improve image quality and model adaptability. For non-image monitoring data such as water quality, water quantity, and pesticide dosage collected concurrently with image acquisition, time alignment, interpolation augmentation, and outlier filtering were employed for data preprocessing to ensure structural integrity and temporal consistency. Finally, a multimodal raw sample dataset was constructed, integrating alum floc image data and process operation monitoring parameters. Image data served as input to the image clustering model for pixel-level semantic segmentation and category recognition; process operation monitoring parameters were used for subsequent sample calibration, and a calibration database was constructed by associating them with the cluster label map. This sample dataset serves as a unified data foundation, providing comprehensive and reliable input support for image clustering modeling, sample calibration, and intelligent control model construction.
[0052] Specifically, for non-image-based process operation monitoring data, parameters such as turbidity, dosage, and effluent quality are normalized to allow different data types to be processed within the same model. Non-image monitoring data undergoes normalization and structural cleaning, including missing value imputation, unit unification, time alignment, and interpolation expansion. All processed data is organized into a unified structural format (such as JSON or database records) to construct a highly consistent, multimodal original sample dataset.
[0053] Specifically, in terms of image processing, RGB images of alum flocs from different process stages are collected from the water plant. Image preprocessing includes median filtering (removing fragmented pixel noise), erosion (removing some noise blocks), and dilation (filling back previously eroded areas), converting the images to a uniform size and PNG format to support subsequent model processing. Standardization processing of the alum floc images includes image resizing, color normalization, format unification (e.g., conversion to PNG), denoising (e.g., median filtering), and edge restoration (e.g., erosion and dilation operations) to improve image input quality. After image preprocessing, corresponding process operation monitoring data are extracted from the water plant's operational database according to the image acquisition time point. This process includes statistical integration of historical water quality and quantity data, and preliminary time alignment. Considering that some wastewater treatment plants are not yet equipped with online water quality instruments in the primary treatment stage, in actual operation, the water quality indicators after primary treatment are often estimated based on empirical removal rates. Therefore, key parameters such as influent and effluent flow rate, influent and effluent COD, influent and effluent TN, influent and effluent TP, and COD of high-density sedimentation tank effluent can be further extracted during the collection period, and time alignment, interpolation expansion and condition filtering can be performed on them to ensure data integrity and model usability.
[0054] Specifically, a semi-supervised learning model for image sample clustering is constructed to perform pixel-level segmentation of alum flower images, generating semantically structured cluster label maps to provide high-quality cluster label map input for subsequent sample labeling and database construction. This model is based on a convolutional neural network (CNN) architecture, using preprocessed alum flower images as input, and sequentially performs feature extraction, response mapping, clustering classification, and joint optimization. First, by stacking convolutional layers, ReLU activation layers, and batch normalization layers, a high-dimensional feature representation of each pixel in the image is extracted, forming a feature tensor of size H×W×p, where H and W are the height and width of the image, respectively, and p is the number of feature channels. Subsequently, a one-dimensional 1×1 convolution operation maps this feature tensor to a q-dimensional clustering space (q is the number of predefined categories, such as alum flower, background, impurities, etc.), obtaining a standard response map of size H×W×q, where each pixel corresponds to a q-dimensional response vector. The channel dimensions of this response map are normalized to ensure standardized response distribution. Finally, the argmax operation selects the category number with the largest response value in the clustering channel of each pixel as its clustering category, realizing the standardized transformation process from the response map to the pixel-level cluster label map. The output cluster label map with size H×W is the initial cluster label, which will be used as the semantic representation of the image in the subsequent sample labeling process.
[0055] Specifically, to improve the semantic coherence and boundary representation of the clustering results, the model design follows three core clustering criteria: (1) pixels with similar features should be classified into the same category; (2) spatially adjacent pixels should have segmentation continuity; and (3) the total number of cluster categories should have sufficient expressive power to fully reflect the image structure. To achieve the above criteria, the model introduces a joint optimization mechanism, constructs a joint loss function consisting of "feature similarity loss" and "spatial continuity loss", and builds an end-to-end differentiable clustering optimization framework. During training, the clustering labels and network parameters are iteratively optimized alternately using a differentiable approach: on the one hand, the CNN parameters are fixed, and pseudo-labels are generated using the current network output to update the clustering map; on the other hand, the clustering label map is fixed, and the CNN parameters are updated through backpropagation, and momentum SGD optimization strategy is used for iterative training. The above process is carried out alternately until the joint loss function converges, reflecting the differentiability mechanism of the model. Thus, an end-to-end image clustering model with structural representation and boundary awareness is constructed. The final output cluster label map, also known as the initial cluster label map, will be matched with the process monitoring data in step 3 by timestamp matching and parameter binding to form an integrated image-parameter sample calibration unit. This unit will be written into the alum flower calibration image database. The generated initial cluster label map will serve as the basic label for sample calibration and will be used to pair with process parameters to build the database.
[0056] Specifically, this invention provides content on constructing an image clustering model, utilizing a convolutional neural network (CNN) to achieve feature extraction and pixel-level clustering segmentation of alum flower images. For example... Figure 2 As shown, it comprises a feature encoding part, a response mapping part, and a pixel classification part. Its core lies in using convolutional layers to extract high-dimensional features and then performing pixel clustering through batch normalization and Argmax classification. The encoding part is used to extract features from the input image and map low-dimensional image data to a high-dimensional feature space. The input is a normalized RGB image with dimensions H×W×q and pixel values ranging from [0,1]. The encoding part includes convolutional modules and pooling layers. Each convolutional module consists of two 2D 3×3 convolutional layers, a ReLU activation function, and a batch normalization layer (BatchNorm). The convolutional stride is 1, and the padding is 1 to ensure the output size matches the input. A 2D max-pooling layer is appended after each convolutional module, with a kernel size of 2×2 and a stride of 2, used to achieve spatial downsampling and reduce the number of parameters. Specifically, the encoding part contains 𝐿 convolutional modules, the output of which serves as the input feature map for the subsequent response mapping part. The response mapping part maps the encoded features to the clustering space, calculating the response of each pixel in different cluster categories. One-dimensional convolutional layers compress high-dimensional features into a q-dimensional clustering space using 1×1 convolutions (e.g., q=3 represents three categories: alum flowers, background, and debris). Batch normalization of the response vectors ensures a mean of 0 and a variance of 1 across all dimensions, eliminating uneven data distribution. The classification part uses the Argmax function to classify the normalized response vectors, assigning each pixel a cluster category. Argmax classification calculates the response value of each pixel in the q-dimensional clustering space and assigns a cluster label based on the maximum response value. The classification result for each pixel is labeled as alum flower region, background, or debris, forming a pixel-level cluster label map. To optimize model performance, a joint loss function is designed, and differentiable methods are used to optimize the model parameters. To ensure stability and convergence efficiency in the initial training phase, all convolutional layer parameters are initialized using Xavier or Kaiming strategies, maintaining a balanced variance in the output of each layer and avoiding gradient explosion or vanishing.
[0057] Specifically, embodiments of the present invention provide steps for constructing an image clustering model and segmentation annotation, including:
[0058] 1. Feature Extraction and Response Mapping. A Convolutional Neural Network (CNN) is used to extract features from the input image of *Agrostis stenoptera*. The input image is a normalized RGB image, with each pixel value ranging from [0,1]. High-dimensional feature vectors are generated through multiple convolutional components, each including a 2D convolution, a ReLU activation function, and a batch normalization operation. The extracted feature map is a set of feature vectors in a high-dimensional space, with each pixel corresponding to a high-dimensional feature vector.
[0059] 2. Clustering Function Design. The extracted pixel feature vectors are input into a 1×1 convolutional layer. Each pixel is projected from the high-dimensional feature space to a predefined q-dimensional clustering space (where q is the number of clusters, such as freckles, background, and debris). This q-dimensional response vector is then batch-normalized to ensure its mean is zero and variance is one across all axes, thus eliminating uneven data distribution. After normalization, the argmax function is used to classify the response vector of each pixel, selecting the dimension with the largest response value among the q categories as the cluster category for that pixel. Finally, a clustering label map with the same size as the input image is output: each pixel is assigned a category label, achieving pixel-level segmentation of regions such as freckles, background, and debris in the image.
[0060] 3. Clustering Optimization Objective and Loss Function Design. By jointly optimizing feature similarity loss and spatial continuity loss, the segmentation quality of the clustering results is improved. Feature similarity loss is defined as the cross-entropy loss between the feature response vector and its assigned cluster label. The objective is to make feature vectors within the same cluster similar, while ensuring significant differences in feature vectors between different clusters. Feature similarity loss function: To enhance the similarity of similar features, the normalized response mapping is optimized. Use the argmax function to obtain cluster labels Furthermore, by utilizing cluster labels as pseudo-targets, calculations are performed. and The following cross-entropy loss is used as a constraint on feature similarity. Clustering is performed based on the features of image pixels. Feature vectors within the same cluster should be similar to each other, while feature vectors from different clusters should be different. By minimizing this loss function, the network weights are updated, facilitating the extraction of more effective feature clusters. Loss function formula:
[0061] (1)
[0062] in, Represents pixels exist Normalized response vector in dimensional cluster space, Represents pixels Clustering labels, Represents pixels Clustering categories The response probability, The expression is transformed as follows:
[0063] (2)
[0064] Spatial continuity loss utilizes the spatial relationships between pixels to minimize the differences in response values between adjacent pixels. The goal is to ensure the spatial continuity of the segmentation result and reduce boundary irregularities. The loss function expression is:
[0065] (3)
[0066] Where 𝑊 and 𝐻 are the width and height of the image, respectively; Indicates pixel coordinates The response vector at that point, Let L1 norm represent the absolute difference in response between adjacent pixels. The joint loss function combines feature similarity and spatial continuity losses, and the final loss function is:
[0067] (4)
[0068] Wherein, 𝜇 is the balance coefficient, used to adjust the contribution of the two losses to the final optimization objective.
[0069] 4. Iterative Optimization Process. To achieve collaborative optimization of image clustering labels and network parameters, an end-to-end joint optimization strategy with a differentiable mechanism is adopted. This process iterates alternately between clustering pseudo-labels and network parameters to minimize the aforementioned joint loss function, gradually improving the model's image segmentation and clustering capabilities. The specific iterative process includes the following three stages: ① Clustering optimization with fixed network parameters: With fixed network parameters, clustering labels are predicted through feature response mapping. The current clustering label is used as the pseudo-target, and the loss is calculated and optimized. ② Network training with fixed clustering labels: With fixed clustering labels, network parameters are optimized using gradient descent to make feature extraction more consistent with the clustering target. The momentum stochastic gradient descent algorithm is used to update the convolutional filter parameters and classifier parameters. ③ Joint update: The first two steps are executed alternately, iteratively optimizing network parameters and clustering labels until the joint loss function converges.
[0070] Specifically, the core of the iterative optimization process provided by this invention lies in its differentiability mechanism, which is reflected in the following two aspects: Differentiability of the network structure: All operations in the model structure (including convolution, normalization, activation functions, 1×1 mappings, etc.) are continuously differentiable functions, supporting gradient chain propagation and ensuring that error information during training can be completely traced back to the parameters of each layer. Differentiability of the loss function: The feature similarity loss and spatial continuity loss functions have explicit derivative expressions with respect to the network output, which can efficiently transmit error signals through the chain rule in each backpropagation, providing the model with a clear optimization direction. In addition, to improve training stability and initial convergence speed, the network parameters adopt the standard Xavier or Kaiming method in the initialization stage to ensure a balanced distribution of the variance of the output of each layer and avoid problems such as gradient explosion or vanishing. This initialization strategy, combined with the iterative optimization framework, effectively promotes the model's clustering performance on multiple image structures, supporting subsequent sample labeling and database construction.
[0071] 5. Clustering Results Output. After the joint loss function converges, the model finally outputs a clustering label map, which represents the category assignment of each pixel. The output clustering label map serves as the semantic representation of the image. Subsequently, it will be used for parameter-level linkage calibration with the process monitoring data (such as dosage, retention time, source water turbidity, effluent water quality indicators, etc.) corresponding to the image capture time point, serving as the core input for constructing the calibration image database.
[0072] Specifically, based on the time-aligned data samples, a timestamp binding relationship is established between each floc image and the corresponding process operation monitoring parameters at the time of acquisition. Monitoring parameters include, but are not limited to: source water turbidity, coagulant dosage, retention time, and effluent water quality indicators (such as suspended solids concentration, effluent turbidity, color, COD, TP, TN, etc.), ensuring a one-to-one correspondence between images and structured data. Combined with the generated pixel-level clustering label map (i.e., initial clustering labels), semantic segmentation results are assigned to each image and jointly organized with the corresponding process data to form sample calibration units. Sample data uses a standardized JSON structure file to store image paths, clustering label map paths, and their corresponding parameters. Process operation monitoring parameters are encoded as key-value pairs with explicit field names (such as turbidity, coagulant_dosage, residence_time, etc.), while image data is managed using a path index. A consistency verification mechanism is used to verify whether each sample conforms to the specifications in terms of time matching, field completeness, and path validity. Only sample units that pass verification are included in the final floc image calibration database. The final calibration database consists of three parts: image files, pixel-level clustering label maps, and structured process operation monitoring parameters. This database not only serves as an organic collection of image-parameter pairs but also as a training sample library for subsequent operating condition inference and dosing strategy optimization algorithms based on the association between images and monitoring data, establishing the mapping relationship between image features and process states. During system operation, it can acquire floc images in real time via cameras and retrieve similar historical samples from the database. Combined with the trained recommendation model, it infers the optimal coagulant dosing strategy for the current state, achieving closed-loop control from image input to decision output, thus improving system response speed, control accuracy, and effluent water quality stability.
[0073] This invention also provides steps for the labeling of alum flower image samples and the construction of a database, specifically:
[0074] 1. Data Association and Integration. Building upon the initial time alignment of images and process operation monitoring parameters, this step further standardizes the images, label images, and process operation monitoring parameters into a final standardized sample calibration unit. Process operation monitoring parameters consistent with the capture time of the flocculent image are extracted from the multi-source monitoring system, including source water turbidity, dosage, retention time, and effluent water quality data. Using a unified timestamp mechanism, each flocculent image is matched one-to-one with the corresponding monitoring data, establishing an accurate image-parameter pairing relationship. To ensure the accuracy and consistency of data synchronization, a high-precision time synchronization mechanism is used to collaboratively calibrate the image acquisition system and the monitoring system.
[0075] 2. Data Format Standardization. To improve data readability and schedulability, the extracted alum floc images and the corresponding process operation monitoring parameters at the image acquisition time are standardized according to a predefined JSON file format. The paths of the alum floc images are stored using relative or absolute paths, while the process operation monitoring parameters are embedded in the sample calibration units as key-value pairs. Each key-value pair uses a clearly defined field name to ensure a clear data structure. The processed data is saved to a designated storage directory in JSON file format, with each sample calibration unit corresponding to one alum floc image. The resulting standardized sample calibration unit, including the path of each alum floc image and its associated process operation monitoring parameter entries, serves as the core component of the alum floc calibration image database. These standardized annotation files, as the core components of the database records, provide a standard interface for the structured storage and retrieval of image-parameter data.
[0076] Table 1 Data Format Standards
[0077] index field name Source water turbidity turbidity Dosage coagulant_dosage Duration of stay residence_time effluent water quality effluent_quality
[0078] 3. Consistency Verification. Consistency verification is performed on the generated sample calibration units to ensure the consistency between the *Hemiberlesia lataniae* images and their monitoring data. Verification includes: ① whether the timestamps of the images and monitoring parameters match accurately; ② whether the sample calibration units contain complete field names and valid values; ③ whether the image path exists and points to a valid image. Only after passing the above verification can the sample be included in the *Hemiberlesia lataniae* image calibration database. The verification program uses an automated script. If any formatting errors, invalid paths, or time synchronization issues are found, the sample will be removed to prevent invalid data from affecting subsequent model training. After successful verification, the file is stored in the *Hemiberlesia lataniae* calibration image database.
[0079] 4. Database Construction. All samples that passed the consistency verification were stored uniformly in the *Hemiberlesia lataniae* image calibration database. The database structure was designed to facilitate subsequent retrieval and use. Each entry contains image data and its corresponding process operation monitoring parameters, forming a calibration image dataset with high practical value, providing support for subsequent research and algorithm optimization. The database content includes structured data such as image files, *Hemiberlesia lataniae* area label maps and their corresponding dosing parameters, and water quality information.
[0080] Specifically, the embodiments of the present invention, through automatic segmentation of alum flower images, weakly supervised calibration, and structured database construction, can be applied to fields such as water treatment, ecological environment protection, smart water management, and disaster emergency response, providing support for management decisions of environmental protection departments, resource departments, emergency prevention and control departments, and water treatment departments.
[0081] The implementation of the various embodiments of the present invention is based on programmed processing through a device with processor functionality. Therefore, in practical engineering, the technical solutions and functions of the various embodiments of the present invention are encapsulated into various modules. Based on this reality, and building upon the above embodiments, the embodiments of the present invention provide a water plant floc image labeling database construction system based on a clustering semi-supervised learning model. This system is used to execute a water plant floc image labeling database construction method based on a clustering semi-supervised learning model from the above method embodiments.
[0082] The system includes: a data acquisition module for collecting images of alum floc and corresponding process operation monitoring parameters, and preprocessing the alum floc images and process operation monitoring data; a clustering label image acquisition module for inputting the preprocessed alum floc images into a trained semi-supervised clustering learning model to obtain clustering label images; and a calibration database construction module for matching the timestamps of the alum floc images and process operation monitoring parameters, and combining them with the clustering label images to form sample calibration units. A consistency verification mechanism is used to verify the sample calibration units, and the sample calibration units that pass the verification are used to construct an alum floc image calibration database.
[0083] The water plant floc image labeling database construction system based on a clustering semi-supervised learning model provided in this invention addresses the problems of subjectivity, low efficiency, and delayed response caused by relying on manual observation of flocs during coagulant dosing in existing technologies. This system employs several modules to construct an image clustering model based on a convolutional neural network, achieving high-quality pixel-level image segmentation without manual annotation. Furthermore, it combines process operation monitoring parameters (including source water turbidity, coagulant dosage, retention time, and effluent water quality) corresponding to the floc image acquisition time to construct a parameter-driven weakly supervised labeling mechanism. This mechanism semantically enhances the initial cluster label map, establishing a high-quality mapping between the image segmentation results and the actual operating conditions.
[0084] Based on the same inventive concept as the foregoing embodiments, this embodiment of the invention also provides an electronic device, including a memory and a processor. The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to realize the method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model as proposed in the above embodiments.
[0085] This invention also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, this program improves the performance and practical application value of the recognition model, effectively reduces the overall water treatment cost, breaks through the technical bottleneck of traditional methods that rely on manual experience to observe the floc state for coagulant dosing adjustment, and achieves image-driven and parameter calibration.
[0086] The storage medium can be any non-volatile storage device such as a hard disk, solid-state drive, flash drive, or optical disk, used to store computer program code and necessary data files. The stored computer program includes: a data acquisition module, a cluster label graph acquisition module, and a calibration database construction module.
[0087] In summary, the present invention provides an intelligent solution combining image clustering modeling with process operation monitoring parameter calibration. Using a differentiable clustering network as its core, it generates initial floc segmentation labels through feature clustering and spatial continuity modeling of unlabeled images. The model achieves high-precision clustering of floc regions, background, and debris by jointly optimizing feature similarity loss and spatial continuity loss. Furthermore, it incorporates process operation monitoring parameters corresponding to the image acquisition time (including coagulant dosage, hydraulic retention time, source water turbidity, and effluent water quality) to perform weakly supervised correction on the initial clustering labels. This establishes a mapping relationship between image semantic labels and actual water treatment conditions, constructing a structured floc image calibration database. This database not only contains pixel-level segmentation labels for the images but also systematically associates key process operation parameters, forming a unified format dataset with semantic support.
[0088] The floc calibration image database constructed in this invention not only includes images and their pixel-level label maps, but also integrates key process operation monitoring parameter information precisely aligned with them, forming a structured sample dataset in a unified format. This method can effectively improve the response speed and adjustment accuracy of water treatment systems to changes in influent, optimize reagent dosage, and improve the stability and reliability of effluent water quality, demonstrating significant engineering application value and promising prospects for widespread application.
[0089] Finally, it should be noted that the above specific embodiments are merely representative examples of the present invention. Obviously, the present invention is not limited to the above specific embodiments and many variations are possible. Any simple modifications, equivalent changes, and alterations made to the above specific embodiments based on the technical essence of the present invention should be considered within the protection scope of the present invention.
Claims
1. A method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model, characterized in that, include: S1. Collect images of alum flocs and the corresponding process operation monitoring parameters, and preprocess the alum floc images and process operation monitoring parameters; S2. Input the preprocessed alum flower image into the trained clustering semi-supervised learning model to obtain a cluster label map; wherein, the clustering semi-supervised learning model includes: a feature encoding module, used to extract and encode features from the input alum flower image; a response mapping module, used to map the feature-encoded features to the clustering space and calculate the response vector of each pixel; a pixel classification module, which uses the Argmax function to classify the response vector of each pixel to obtain a cluster label map; wherein, calculating the response vector of each pixel specifically involves: extracting the high-dimensional feature representation of each pixel in the alum flower image to form a feature tensor of size H×W×p, where H and W are the height and width of the image, respectively, and p is the number of feature channels; mapping the high-dimensional feature representation output by the feature encoding module to the q-dimensional clustering space through a one-dimensional 1×1 convolution operation to obtain a standard response map of size H×W×q, where each pixel corresponds to a q-dimensional response vector; q is the predefined number of categories; S3. Timestamp matching is performed between the alum flower images and process operation monitoring parameters, and a sample calibration unit is formed by combining the cluster label map. The sample calibration unit is tested using a consistency verification mechanism. The sample calibration unit that passes the test is used to construct the alum flower image calibration database.
2. The method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model according to claim 1, characterized in that, The training of the clustering semi-supervised learning model includes: Construct a dataset of alum flower images; Construct a joint loss function, including feature similarity loss and spatial continuity loss; A clustering semi-supervised learning model was trained on the constructed alum flower image dataset. A differentiable mechanism was used to iteratively optimize the network parameters and cluster label map. Combined with the constructed joint loss function, the trained clustering semi-supervised learning model was obtained.
3. The method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model according to claim 2, characterized in that, Differentiable methods are used to iteratively optimize network parameters and cluster labels, including: S3.1 When the network parameters are fixed, the clustering label is predicted by feature response mapping, and the clustering label is used as a pseudo-target to calculate and optimize the joint loss; S3.2 When the clustering labels are fixed, the network parameters are optimized by the stochastic gradient descent algorithm. The network parameters include convolutional filter parameters and classifier parameters. S3.
3. Alternately execute S3.1 and S3.2 until the joint loss function converges.
4. The method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model according to claim 1, characterized in that, The S3 includes: By using a timestamp mechanism, each frame of alum floc image is matched one-to-one with the corresponding process operation monitoring parameters to establish an image-parameter pairing relationship; The image-parameter pairing relationship and the cluster label map are combined to form the sample calibration unit; A consistency verification mechanism is used to test the sample calibration units. After the test is passed, the samples are stored in the alum flower image calibration database.
5. The method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model according to claim 4, characterized in that, A consistency verification mechanism is used to test the sample calibration units, including: Verify that the timestamps of the floc images and the process operation monitoring parameters match correctly. Verify whether the sample calibration unit contains complete field names and valid values; Verify that the path to the alum flower image exists and points to a valid image file with a valid format and complete structure; Sample calibration units that pass all three tests are stored in the alum flower image calibration database.
6. The method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model according to claim 1, characterized in that, Preprocessing of floc images and process operation monitoring parameters includes: Standardization processing of alum flower images includes image resizing, color normalization, conversion to a unified format, noise reduction, and edge restoration; Normalize and clean the structure of process operation monitoring parameters, including missing value filling, unit unification, time alignment and interpolation expansion.
7. The method for constructing a water plant floc image labeling database based on a clustering semi-supervised learning model according to claim 2, characterized in that, The feature similarity loss and the spatial continuity loss are specifically as follows: The feature similarity loss is the cross-entropy loss between the response vector set of each pixel and the corresponding cluster label; the spatial continuity loss utilizes the spatial relationship constraints between pixels to minimize the difference between the response vectors of adjacent pixels.
8. A system for constructing a database for labeling alum floc images in water plants based on a clustering semi-supervised learning model, characterized in that, include: The data acquisition module is used to collect images of alum floc and corresponding process operation monitoring parameters, and to preprocess the alum floc images and the process operation monitoring data. The clustering label map acquisition module is used to input the preprocessed *Hemiberlesia lataniae* image into a trained semi-supervised clustering learning model to obtain a clustering label map. The semi-supervised clustering learning model includes: a feature encoding module for extracting and encoding features from the input *Hemiberlesia lataniae* image; a response mapping module for mapping the encoded features to the clustering space and calculating the response vector for each pixel; and a pixel classification module for classifying the response vector of each pixel using the Argmax function to obtain the clustering label map. Specifically, calculating the response vector for each pixel involves: extracting a high-dimensional feature representation of each pixel in the *Hemiberlesia lataniae* image to form a feature tensor of size H×W×p, where H and W are the height and width of the image, and p is the number of feature channels; mapping the high-dimensional feature representation output by the feature encoding module to a q-dimensional clustering space through a one-dimensional 1×1 convolution operation to obtain a standard response map of size H×W×q, where each pixel corresponds to a q-dimensional response vector; and q is the predefined number of categories. The calibration database construction module is used to match the timestamps of alum flower images and process operation monitoring parameters, and combine them with cluster label maps to form sample calibration units. A consistency verification mechanism is used to verify the sample calibration units. The sample calibration units that pass the verification are used to construct the alum flower image calibration database.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the water plant floc image calibration database construction method based on a clustering semi-supervised learning model as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for constructing a water plant floc image calibration database based on a clustering semi-supervised learning model as described in any one of claims 1 to 7.