A method and system for detecting the granulation degree of aerobic granular sludge.
By using a deep learning segmentation network model to identify the outline and area of aerobic granular sludge, and combining the settling stability index Z and area ratio Y, the accuracy and real-time issues of aerobic granular sludge detection were solved, enabling rapid and accurate determination of granulation degree.
Patent Information
- Application Number
- CN202310218621.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-08
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2043-03-08
AI Technical Summary
Existing technologies for detecting the granulation degree of aerobic granular sludge suffer from poor accuracy, long testing cycles, and the inability to detect in real time.
A deep learning segmentation network model is used to identify sludge settling images and planar images to obtain the outline and area ratio of aerobic granular sludge. Combined with the sludge settling stability index Z and the area ratio Y, the degree of granulation can be judged in real time and accurately.
It enables rapid and accurate detection of the granulation degree of aerobic granular sludge, simplifies data processing, improves the real-time performance and accuracy of detection, and overcomes the error and lag problems in existing technologies.
Smart Images

Figure CN116342505B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wastewater treatment technology, and in particular to a method and system for detecting the degree of granulation of aerobic granular sludge. Background Technology
[0002] Aerobic granular sludge refers to sludge that has been transformed from flocculent to granular state under specific cultivation conditions. It is a new type of activated sludge used in the field of wastewater treatment.
[0003] The aerobic granular sludge cultivation process is lengthy, influenced by numerous factors (such as temperature, hydraulic shear force, organic load, pH, and settling time), and exhibits poor stability, which limits its practical application. The aerobic granular sludge cultivation process requires monitoring the real-time granulation state of the activated sludge during the transformation from flocculent activated sludge to granular sludge.
[0004] One aspect of existing technology involves personnel visually assessing whether activated sludge exhibits granulation. Samples of the activated sludge are then sent to a laboratory where researchers observe the particle size and quantity of aerobic granular sludge under a microscope to calculate the average particle size. This process requires multiple measurements to obtain an average value, making it cumbersome. Furthermore, due to the small particle size and large quantity of aerobic granular sludge, manual measurement and statistical analysis are inaccurate and prone to significant errors, making it difficult to determine the degree of activated sludge granulation.
[0005] Another aspect of existing technology involves sending samples to a specialized laboratory for analysis and monitoring using a laser particle size analyzer. However, this approach has several drawbacks: Firstly, laser particle size analysis requires knowledge of parameters such as the refractive index and absorptivity of the particle sample during the monitoring process. In practice, it is difficult to obtain accurate parameters such as the refractive index of the particle sample. Secondly, aerobic granular sludge is a mixed material, and measuring its particle size will introduce certain errors. Furthermore, obtaining the particle size of aerobic granular sludge is a cumbersome and time-consuming process. In addition, even if the sludge particle size is known, the degree of granulation cannot be determined. Currently, there is no truly objective method for evaluating the degree of granulation of granular sludge, and the existing MLSS index cannot evaluate the degree of sludge granulation.
[0006] Therefore, there is an urgent need in the market for a method that can accurately, quickly, and in real time identify and analyze the degree of granulation of aerobic activated sludge. Summary of the Invention
[0007] Based on the above analysis, the present invention aims to provide a method for detecting the granulation degree of aerobic granular sludge, in order to solve one of the problems in the existing technical problems of poor accuracy, long testing cycle and inability to detect in real time in the detection of the granulation degree of aerobic granular sludge.
[0008] The objective of this invention is mainly achieved through the following technical solutions:
[0009] A method for detecting the granulation degree of aerobic granular sludge, comprising:
[0010] Data collection:
[0011] Wastewater samples containing aerobic granular sludge were subjected to a static settling experiment to obtain sludge settling images at different times after sampling; planar images reflecting the planar distribution of aerobic granular sludge in unsettled wastewater samples were also obtained.
[0012] Image recognition:
[0013] Two deep learning segmentation network models were constructed to identify sludge settling images and planar images at different times, respectively, and two different binary images containing binary classification results were obtained.
[0014] Image fitting:
[0015] Based on the binary classification results, the fitted image of the aerobic granular sludge contour, the position information of all points on the outer contour of the aerobic granular sludge, and the diameter and area of the aerobic granular sludge contour are obtained; based on the binary classification results, the sludge settling scale at the target time is obtained.
[0016] Data processing and assessment of the maturity of aerobic granular sludge:
[0017] The area ratio Y of aerobic granular sludge is obtained based on the area of the aerobic granular sludge outline. The sludge settling stability index Z is obtained based on the sludge settling scale at the target time. The maturity of the aerobic granular sludge is judged based on the area ratio Y and the sludge settling stability index Z. Where Y = B / A, A is the area of the aerobic granular sludge mixture in the acquired image, and B is the area of the aerobic granular sludge in the acquired image; Z = SV a / SV b ;SV a SV b These are the sludge settling ratios at the a-minute and b-minute settling times, respectively, where a < b.
[0018] Preferably, the identification of sludge settling images at different times includes:
[0019] S201: Label the sedimentation images at different times and different mud-water interface scales. Based on the labeled sedimentation images, train a deep learning segmentation network model to obtain a deep learning segmentation network model that can identify sludge sedimentation scales at different times.
[0020] S202: Based on the trained deep learning segmentation network model, identify sludge settling images at different times and obtain binary images containing binary classification results.
[0021] Preferably, in S201, the training of the deep learning segmentation network model includes:
[0022] S2011: Capture sludge settling images at different times, obtain sample data, and establish a sludge settling training set at different times;
[0023] S2012: Input the sludge settling training set at different times into the deep learning segmentation network model for training, and obtain a model that can identify the sludge settling scale at different times.
[0024] Preferably, in S2011, establishing a sludge settling training set at different times includes:
[0025] S20111. Determine the camera parameters:
[0026] Determine the magnification and shooting distance for the photo;
[0027] S20112. Collect standard image information:
[0028] The images of sludge settling at different scales on the measuring container during the sedimentation of water samples were captured.
[0029] S20113, Marking image scale:
[0030] All collected settlement images were marked, and the actual scale readings of the mud-water liquid level were marked for different images;
[0031] S20114. Processing the settlement images:
[0032] The background of all settlement images, each scale on the graduated cylinder, and the scale of the mud-water liquid level are binarized. The processed settlement images and the original settlement images are combined to form a settlement image training set.
[0033] Preferably, planar image recognition includes:
[0034] S211: Based on particles of different sizes, train a deep learning segmentation network model to obtain a deep learning segmentation network model that can identify particles of different sizes.
[0035] S212: Based on the completed training of the deep learning segmentation network model, the outline of aerobic granular sludge is identified, and binary images of different regions are obtained to provide binary classification results.
[0036] Preferably, in S211, the training of the deep learning segmentation network model includes:
[0037] S2111: Set the image capture parameters to obtain monolayer dispersion images of particles with different sizes;
[0038] S2112: Mark standard circular particles of different sizes in the image with pixels to obtain an image with multiple marked regions and the marking result corresponding to each marked region;
[0039] S2113: Use the labeled regions and labeling results as the training set to train the learning segmentation network model.
[0040] Preferably, in S2112, pixel marking is performed on standard spherical particles of different sizes in the image, including:
[0041] Using an image marking tool, the boundaries of each standard circular particle in the obtained image file are manually marked to obtain multiple marked areas, each of which corresponds one-to-one with a standard circular particle.
[0042] Preferably, after the image marking tool completes the marking, it generates a JSON text file. The image segmentation data of the standard circular particles is saved in JSON format and given a name for the particles or background; each marked area corresponds one-to-one with a JSON text file.
[0043] Preferably, the `findContours` function from the `opencv` library in Python is used to obtain the contour information of aerobic granular sludge, including:
[0044] S301: In OpenCV library search mode, set the RETR_EXTERNAL parameter to detect only the outer contour information, and use the CHAIN_APPROX_NONE parameter to store all contour information;
[0045] S302: Run the findContours function, which returns the position information of all points that constitute the outer contour of each aerobic granular sludge, and outputs the row and column coordinates of the pixels where the outer contour is located in the binary image to obtain the contour information of the aerobic granular sludge.
[0046] Preferably, the fitted image of the aerobic granular sludge profile is obtained using the contourArea function of the OpenCV library in Python software, including:
[0047] S304: Pass the information of all points constituting the outermost contour returned by the findContours function in S302 into the contourArea function;
[0048] S305: The contourArea function returns the area of the contour of each aerobic granular sludge particle.
[0049] A system for detecting the granulation degree of aerobic granular sludge, using the above-mentioned detection method, includes:
[0050] Data acquisition module:
[0051] Used to acquire sludge settling images at different times after sampling and planar images reflecting the planar distribution of aerobic granular sludge in unsettled wastewater samples;
[0052] Image recognition module:
[0053] Used to identify sludge settling images and planar images at different times, and obtain two different binary images containing binary classification results;
[0054] Image fitting module:
[0055] Used to obtain the fitted image of the aerobic granular sludge profile, the position information of all points on the outer contour of the aerobic granular sludge, the diameter and area of the aerobic granular sludge profile, and the sludge settling scale for the target time.
[0056] Data processing and aerobic granular sludge maturity assessment module:
[0057] The aerobic granular sludge is used to obtain the area ratio Y of aerobic granular sludge and the sludge settling stability index Z, and the maturity of aerobic granular sludge is judged based on the area ratio Y of aerobic granular sludge and the sludge settling stability index Z.
[0058] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0059] (1) The present invention uses the sludge settling stability index Z as the first criterion for the maturity of aerobic granular sludge cultivation, which can effectively avoid the impact of unstable sludge cultivation or the occurrence of bulky sludge on subsequent judgments; the proportion of aerobic granular sludge area Y is introduced as the second criterion for the maturity of aerobic granular sludge cultivation, which objectively reflects the state of highly active and well dispersed sludge. Compared with the MLSS mass concentration index, considering the sludge specific surface area and actual reaction activity, it can actually reflect the dispersion concentration of sludge, and more realistically reflect the sludge activity and treatment capacity, thus solving the problem of the difficulty in quantifying and evaluating the maturity of sludge particles in the existing technology.
[0060] (2) This invention trains two deep learning segmentation network models separately to identify the outline and settling scale of aerobic granular sludge, thereby achieving automated real-time acquisition of the target time settling ratio and the area ratio of aerobic granular sludge. Compared with the prior art, which acquires two parts of data separately, this invention simplifies the requirement for consistency of sampling time and avoids errors caused by different data processing methods. It also achieves better real-time detection and matching, and has better accuracy.
[0061] (3) This invention trains a deep learning segmentation network model by using a standard particle labeling training method, thereby achieving accurate, rapid and real-time identification of the outline of aerobic granular sludge. Compared with the existing laser particle size analysis method, it overcomes the difficulty in implementation due to the difficulty in knowing the accurate refractive index and other parameters of the particle sample in actual operation. It also overcomes the shortcomings of the existing technology in identifying and detecting aerobic granular sludge with poor accuracy and obvious lag.
[0062] (4) This invention uses standard microparticles of different sizes to train a deep learning segmentation network model, providing a training method with adjustable particle size and better matching of aerobic granular sludge particle size. The preferred Unet model can achieve better training results and high-precision segmentation results with less training data. On the one hand, it solves the problem that the particle size of aerobic granular sludge is difficult to calibrate and cannot be used as a standard for model training in the prior art. On the other hand, after the training method is matched with the Unet model, it has better training efficiency and recognition accuracy.
[0063] (5) The present invention achieves the identification of individual particles by taking real-time photos of standard particles of different particle sizes and pixelating the photos. Compared with the existing technology of overall identification to obtain binary grayscale images and then performing secondary classification based on grayscale, the prior labeling method of the present invention is beneficial to the identification of individual particles such as aerobic activated sludge after model training, and has higher identification accuracy.
[0064] (6) The Unet model used in this invention has an expanded FCN network architecture. This model includes multiple downsampling and convolution calculations, which has high feature extraction efficiency, enabling it to obtain very accurate segmentation results with very few training images. The Unet model of this invention adds an upsampling stage and a skip connection structure, which allows the information of the original image texture in the downsampling to propagate to the downsampling in the high-resolution layer, making up for the lack of original image information in the upsampling, which is beneficial to obtaining accurate classification results.
[0065] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained through the embodiments described and the accompanying drawings, which are particularly pointed out. Attached Figure Description
[0066] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0067] Figure 1 A flowchart illustrating a feasible implementation method for detecting the granulation degree of aerobic granular sludge;
[0068] Figure 2 This is a schematic diagram of the Unet model structure;
[0069] Figure 3 A flowchart illustrating a feasible implementation method for determining the degree of granulation of aerobic granular sludge.
[0070] Figure Labels
[0071] Encoder 6, Activation Connection Module 7, Decoder 8, Classification Module 9. Detailed Implementation
[0072] The preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which constitute a part of the present invention and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0073] To better illustrate the technical solution of this invention, the following technical terms are explained:
[0074] LabelMe
[0075] LabelMe is a JavaScript tagging tool for online image labeling. Compared to traditional image tagging tools, its advantage lies in its usability anywhere; furthermore, it helps us tag images without requiring the installation or copying of large datasets on our computers.
[0076] On the one hand, this invention discloses a method for detecting the granulation degree of aerobic granular sludge, such as... Figure 1 As shown, the specific steps are as follows:
[0077] Step 1, Data Collection:
[0078] Wastewater samples containing aerobic granular sludge were subjected to a static settling experiment to obtain sludge settling images at different times after sampling; planar images reflecting the planar distribution of aerobic granular sludge in unsettled wastewater samples were also obtained.
[0079] Step 2, Image Recognition:
[0080] Two deep learning segmentation network models were constructed to identify sludge settling images and planar images at different times, respectively, and two different binary images containing binary classification results were obtained.
[0081] Step 3, Image Fitting:
[0082] Based on the binary classification results, the fitted image of the aerobic granular sludge contour, the position information of all points on the outer contour of the aerobic granular sludge, and the diameter and area of the aerobic granular sludge contour are obtained; based on the binary classification results, the sludge settling scale at the target time is obtained.
[0083] Step 4: Data processing and assessment of aerobic granular sludge maturity:
[0084] The area ratio Y of aerobic granular sludge is obtained based on the area of the aerobic granular sludge outline. The sludge settling stability index Z is obtained based on the sludge settling scale at the target time. The maturity of the aerobic granular sludge is judged based on the area ratio Y and the sludge settling stability index Z. Where Y = B / A, A is the area of the aerobic granular sludge mixture in the acquired image, and B is the area of the aerobic granular sludge in the acquired image; Z = SV a / SV b ;SV a SV b These are the sludge settling ratios at the a-minute and b-minute settling times, respectively, where a < b.
[0085] Specifically, B is obtained by summing the contour areas of each aerobic granular sludge, and A is obtained from the fitted image of the aerobic granular sludge contour; SV is obtained based on the sludge settling scale at different target times and the total volume of wastewater sampling. a SV b .
[0086] It should be noted that the maturity of aerobic granular sludge includes morphological stability, stable reactivity, and moderate settling performance. Currently, there is no unified indicator to determine its maturity in a way that most closely reflects the actual situation and comprehensively reflects its performance.
[0087] Compared with existing technologies, this invention uses the sludge settling stability index Z as the first criterion for judging the maturity of aerobic granular sludge cultivation, which can effectively avoid the impact of unstable sludge cultivation or the occurrence of bulky sludge on subsequent judgments. The invention also introduces the area ratio Y of aerobic granular sludge as the second criterion for judging the maturity of aerobic granular sludge cultivation, which objectively reflects the state of highly active and well-dispersed sludge. Compared with the MLSS mass concentration index, considering the sludge specific surface area and actual reactivity, it can actually reflect the dispersion concentration of sludge, and more realistically reflect the sludge activity and treatment capacity, thus solving the problem of difficulty in quantifying and assessing the maturity of sludge particles in existing technologies.
[0088] Compared with existing technologies, this invention trains deep learning segmentation network models separately to identify the outline and settling scale of aerobic granular sludge, thereby achieving automated real-time acquisition of the target time settling ratio and the area ratio of aerobic granular sludge. Compared with existing technologies that acquire two parts of data separately, this invention simplifies the requirement for consistency of sampling time, avoids errors caused by different data processing methods, and better achieves real-time detection and matching, while also having better accuracy.
[0089] Compared with existing technologies, the method of training a deep learning segmentation network model to achieve contour recognition of aerobic granular sludge greatly improves the shortcomings of existing technologies that use laser particle size analysis, which are difficult to implement in practice due to the difficulty in knowing the accurate refractive index and other parameters of granular samples. It also overcomes the shortcomings of existing technologies in identifying and detecting aerobic granular sludge with poor accuracy and obvious lag.
[0090] Specifically, in step 1, obtaining sludge settling images at different times after sampling includes: using a graduated cylinder to let the wastewater sample containing aerobic granular sludge stand still, and taking pictures with a camera parallel to the sludge-water separation surface at the 0-minute settling time and at different target times.
[0091] Specifically, in step 1, obtaining a planar image reflecting the planar distribution of aerobic granular sludge in the unsettled wastewater sample includes:
[0092] Wastewater samples containing aerobic granular sludge were placed in a rectangular transparent container for static settling. At 0 min of settling, a camera was used to take a picture of the planar distribution of aerobic granular sludge on the side of the container to obtain an image.
[0093] Specifically, in step 1, the sampled wastewater is placed in a container with volume markings, and the wastewater is photographed at different times during the settling experiment using a camera to obtain the mud-water interface markings; the sampled wastewater is placed in a container with at least one flat side, and the unsettled sludge water sample is photographed on that side using a camera to obtain a planar distribution image of aerobic granular sludge in the plane.
[0094] It should be noted that since the photographic principle involves capturing all opaque objects projected onto the photographing plane, particles that do not belong to the outermost plane can also be captured through the gaps between the sludge particles arranged on the outermost plane of the container's inner wall, resulting in higher measured values from the detection model.
[0095] Therefore, the inner cavity thickness of at least one container with a flat side perpendicular to the photographing plane should be slightly larger than the maximum particle size d of the aerobic granular sludge. max .
[0096] Preferably, the inner cavity thickness of the rectangular transparent container is related to the maximum particle size d of the sludge particles. max Satisfies: Inner cavity thickness is 1.5d max ~10dmax Within this range, the impact of sludge particles not being on the same plane in the photographs on the accuracy of data collection is reduced. Sludge particles are arranged in a single layer along the photographing plane within the container. Therefore, the area of sludge particles in the photographing plane calculated as such can be approximated as not being affected by the stacking of different sludge particles.
[0097] Specifically, in step 2, two deep learning segmentation network models are trained separately so that they can identify sludge settling scales at different times and aerobic sludge particles in planar images.
[0098] It should be noted that deep learning segmentation network models are trained by inputting labeled images. They can recognize images, extract some features from images, and obtain binary images based on feature classification.
[0099] Specifically, in step 2, the identification of sludge settling images at different times includes:
[0100] S201: Label the sedimentation images at different times and different mud-water interface scales. Based on the labeled sedimentation images, train a deep learning segmentation network model to obtain a deep learning segmentation network model that can identify sludge sedimentation scales at different times.
[0101] S202: Based on the trained deep learning segmentation network model, identify sludge settling images at different times and obtain binary images containing binary classification results.
[0102] Specifically, the binary image is a feature map containing the classification results of each pixel unit belonging to aerobic granular sludge or the background. Compared with the original feature map, the classification of the basic pixel units of the feature map has been completed based on the feature extraction in the aforementioned steps; further, a contour image can be generated through fitting.
[0103] In S201, training a deep learning segmentation network model includes the following steps:
[0104] S2011: Capture sludge settling images at different times, obtain sample data, label the settling images at different times and different sludge-water interface scales, and establish a sludge settling training set at different times.
[0105] Preferably, the magnification and shooting distance of the images acquired during the training process and the data collection process in step 1 are the same.
[0106] S2012: Input the sludge settling training set at different times into the deep learning segmentation network model for training, and obtain a model that can identify the sludge settling scale at different times.
[0107] Specifically, in S2011, training sets for sludge settling at different times were established, including:
[0108] S20111. Determine the camera parameters:
[0109] Determine the magnification and shooting distance for the photo.
[0110] The camera will automatically focus on the settlement image area according to the shooting distance, and the captured settlement image will meet the requirements of complete scale and clear image.
[0111] S20112. Collect standard image information:
[0112] Images of sludge settling at different scales on a measuring container were captured as the water sample settled for a period of time.
[0113] For example, the settling time is 30 minutes, and the camera takes pictures of the water sample in the measuring container every minute to record the sludge settling images at different scales in the measuring container.
[0114] S20113, Marking image scale:
[0115] All collected settlement images were marked, and the actual scale readings of the mud-water liquid level in different images were marked.
[0116] S20114. Processing the settlement images:
[0117] The background of all settlement images, each scale on the graduated cylinder, and the scale of the mud-water liquid level are binarized. The processed settlement images and the original settlement images are combined to form a settlement image training set.
[0118] Specifically, the binarization process also includes converting the image from JPG format to PNG format.
[0119] Specifically, as described in S2012, inputting sludge settling training data from different times into a deep learning segmentation network model for training includes:
[0120] Set the termination parameters for deep learning model training, input the subsidence image training set into the deep learning model for training, the deep learning model learns from the labeled subsidence images, identifies the corresponding original subsidence images, then compares the two images to find differences and adjusts them until the training difference reaches the set termination parameters, and the trained model is obtained.
[0121] Specifically, in S202, the sludge settling images at different times are identified based on the trained deep learning segmentation network model, including:
[0122] The deep learning model identifies the background of the sedimentation image, the mud-water surface, and the adjacent scale above the mud-water surface in the measuring container. Based on the pixel information of the sedimentation image, it obtains the percentage distance between the mud-water surface and the adjacent scale above it, calculates the mud-water surface scale, and thus calculates the sludge settling ratio (SV).
[0123] For example, a commonly used measuring container typically has a volume of 1000 mL. The sedimentation ratio image recognition model identifies the mud-water surface and the adjacent graduation above the mud-water surface in the measuring container as D mL. Using the pixel information of the sedimentation image, the sedimentation ratio training model calculates the percentage of the distance between the mud-water surface and the adjacent graduation above it in the sedimentation image of the water sample to be tested as X%. Therefore, the graduation of the mud-water surface = DX% × 100 mL, and SV = graduation of the mud-water surface / 1000 × 100%. For instance, if the adjacent graduation above the mud-water surface in the measuring container is 600 mL, and using the pixel information of the sedimentation image, the sedimentation ratio training model calculates the percentage of the distance between the mud-water surface and the adjacent graduation above it in the sedimentation image of the water sample to be tested as 70%, then the graduation of the mud-water interface = 600 ml - 70% × 100 ml = 530 ml, and SV... 30 =530 / 1000×100%=53%.
[0124] Specifically, step 2, planar image recognition, includes:
[0125] S211: Based on particles of different sizes, train a deep learning segmentation network model to obtain a deep learning segmentation network model that can identify particles of different sizes.
[0126] S212: Based on the completed training of the deep learning segmentation network model, the outline of aerobic granular sludge is identified, and binary images of different regions are obtained to give binary classification results.
[0127] Specifically, step 2, training the deep learning segmentation network model, includes:
[0128] Images of particles of different sizes are labeled, and the labeled images are segmented into labeled regions containing only one label name; a deep learning segmentation network model is trained based on the labeled regions.
[0129] In practice, particles of different sizes are dispersed in a single layer onto a plane, and images of the distribution of particles of different sizes are captured by a camera. The images are then labeled using labeling software to obtain images with multiple labeled regions and the labeling results corresponding to each labeled region. The labeled regions and labeling results are used as a training set to train the learning segmentation network model.
[0130] Specifically, the camera equipment has a zoom lens, a resolution of objects smaller than 0.05mm, and a magnification of 10 to 400.
[0131] Optionally, the images captured by the camera can be saved in JPG format.
[0132] Specifically, the training of the deep learning segmentation network model described in S211 includes:
[0133] S2111: Set the image capture parameters to obtain monolayer dispersion images of particles with different sizes;
[0134] S2112: Mark standard circular particles of different sizes in the image with pixels to obtain an image with multiple marked regions and the marking result corresponding to each marked region;
[0135] S2113: Use the labeled regions and labeling results as the training set to train the learning segmentation network model.
[0136] Preferably, the magnification and shooting distance of the images acquired during the training process and the data collection process in step 1 are the same.
[0137] Preferably, the standard round particle size range is 0.1mm to 3.0mm; this range corresponds to the distribution range of most aerobic activated sludge particles; setting standard round particles within this range as the training set is beneficial to improving the detection accuracy of the model after training.
[0138] Specifically, in S2111, the photography parameters include: magnification f and photography distance d.
[0139] It should be noted that, in order to avoid systematic errors caused by the camera or photographing process, when training deep learning segmentation network models, the magnification factor f and the shooting distance d of the device should be kept consistent. In particular, the area S of the image captured after the photo is taken and the area S' of the corresponding image captured in the picture satisfy S'=f×S.
[0140] Specifically, in S2112, an image marking tool is used to manually mark the boundary of each standard circular particle in the obtained image file, obtaining multiple marked areas, each of which corresponds one-to-one with a standard circular particle.
[0141] Preferably, after the image labeling tool completes the labeling, it generates a JSON text file. The image segmentation data of standard circular particles is saved in JSON format and given a name for the particle or background. Each labeled region corresponds one-to-one with a JSON text file.
[0142] Preferably, the image labeling tool is labelme.
[0143] It should be noted that during the training of a deep learning segmentation network model, the naming of a JSON text file can be used to distinguish which pixels correspond to particles and which pixels correspond to the background, thus achieving the training objective.
[0144] Specifically, the use of the image labeling tool labelme for labeling includes:
[0145] S21121: Select the data folder to be labeled in the labelme labeling interface;
[0146] S21122: Select the point marking scheme in the Edit menu bar;
[0147] S21123: Select the polygon creation mode, select a standard circular particle, select multiple marker points along the outline of the standard circular particle to construct a closed marker region, and save the image segmentation data of the standard circular particle.
[0148] S21124: Obtain image segmentation data for all remaining standard circular particles according to S21121-S21123.
[0149] Compared with existing technologies, this invention achieves the identification of individual particles by taking real-time photos of standard particles of different sizes and pixelating the photos. Compared with the existing technology of obtaining binary grayscale images for overall identification and then performing secondary classification based on grayscale, the prior labeling method of this invention is beneficial for the identification of smaller particles such as aerobic activated sludge after model training, and has higher identification accuracy for small particles.
[0150] Compared with existing technologies, this invention uses particles of different sizes to train a deep learning segmentation network model, providing a training method with adjustable particle size to better match the particle size of aerobic granular sludge, thus solving the problem that the particle size of aerobic granular sludge is difficult to calibrate and cannot be used as a standard in existing technologies.
[0151] Specifically, the deep learning segmentation network model described in step 2 includes:
[0152] 1) Encoder: Converts the original image into a feature map, processes it through convolutional units to preserve features, and continuously reduces the resolution of the feature map;
[0153] 2) Activate the connection module: Transform the dense matrix of the feature map into a sparse matrix, retain the key information of the data, and remove noise;
[0154] 3) Decoder: The decoder presents an expanded structure symmetrical to the encoder, gradually repairing the details and spatial dimensions of the segmented feature map to achieve accurate localization;
[0155] 4) Classification module: The feature map is convolved with a 1×1 convolution to obtain pixels and classify the pixels.
[0156] It should be noted that computers cannot directly recognize and process images. Instead, they segment the image into multiple pixel units and assign pixel values. The feature maps formed by the feature values of multiple pixel units are then convolved to obtain the values corresponding to the convolution calculations in different regions, thus constructing new feature maps. The convolution calculation values corresponding to non-feature regions are then filtered out to obtain higher-level feature maps. These feature maps contain all feature information related to the feature regions. After multiple convolution calculations and filtering out non-feature regions, a feature map with the least storage resources can be obtained. Data irrelevant to non-feature regions is then deleted, completing feature extraction.
[0157] During implementation, the convolution kernel is matched with the feature region, and the convolution calculation result of the non-feature region is 0 or much smaller than the calculation result of the feature region. Then, the convolution calculation results of each region are compared through max pooling operation, and the feature regions are selected and their corresponding convolution calculation feature values are used to form a higher-level feature map.
[0158] It should be noted that the encoder output feature map exists in the form of a dense matrix. Even after max pooling, there is still some interference information that is not conducive to the feature region being recognized. In order to improve the model's sensitivity to feature map recognition, an activation connection module needs to be added to process the encoder output feature map, transform the dense matrix of the feature map into a sparse matrix, retain the key information of the data, and remove noise.
[0159] It should be noted that the encoder completes the feature extraction of the original image, but the extracted pixel units have different pixel values and correspond to the feature regions. However, the classification module cannot directly classify the low-dimensional feature map that has been processed multiple times. The classification module needs to process the high-dimensional feature map that corresponds one-to-one with the original image. Compared with the feature map obtained by the encoder from processing the original image, the high-dimensional feature map reduces interference from non-feature regions, which is beneficial to obtaining high-precision classification results for feature regions.
[0160] Specifically, the deep learning segmentation network model is the Unet model.
[0161] Specifically, such as Figure 2 As shown: The Unet model includes an encoder, an activation connection module, a decoder, and a classification module; the encoder is connected to the decoder through the activation connection structure, and the classifier is connected to the output of the decoder.
[0162] Specifically, the encoder is divided into multiple sequentially connected convolutional units.
[0163] Specifically, such as Figure 2As shown, the encoder includes four coded convolutional units connected sequentially in data streams, and the output of the previous coded convolutional unit can be used as the input of the next coded convolutional unit.
[0164] Specifically, each encoding convolutional unit has a max pooling layer at the input, followed by two SAME convolutional connection layers in sequence.
[0165] Among them, the max pooling layer is used to perform downsampling and feature map extraction while reducing dimensionality and maintaining the invariance of feature extraction. This helps to reduce the deviation of the estimated mean caused by the parameter error of the convolutional layer and retain more of the texture information of the original image.
[0166] Among them, the SAME convolutional connection layer can optimize the feature map while ensuring that the output feature map of the SAME convolutional connection layer and the feature map after max pooling are the same size. This helps to reduce the loss of edge information when calculating at the edge of the feature map during convolution calculation and improve the accuracy of feature extraction.
[0167] It should be noted that the max pooling layer satisfies the valid convolution calculation rule, and the size W of the output feature map of the max pooling layer is... out satisfy:
[0168]
[0169] Among them, W in F is the size of the input feature map, F is the kernel size, and stride is the convolution stride; therefore, by adjusting the kernel size and stride of the max pooling layer, the output size of the feature map can be adjusted.
[0170] Preferably, the size W of the output feature map of the max pooling layer out =0.5W in This allows the output feature map of each decoding convolutional unit to be reduced by half the size of the input feature map.
[0171] Specifically, the feature map obtained after passing through four code convolution units of the encoder is 16 times smaller than the feature map at the encoder input.
[0172] Specifically, the activation module selects the ReLU activation function. For the results of max pooling and convolution, there are always some features that are negative and are irrelevant features. The ReLU function can discard negative features, and for the detection of the correlation between features and tasks, only useful features are retained and irrelevant features are removed, thus realizing feature extraction.
[0173] Furthermore, compared to the traditional sigmoid function, the derivative of the ReLU function is only 0 or 1, which avoids the gradient vanishing problem during the calculation process and greatly improves the training speed.
[0174] Specifically, such as Figure 2 As shown, the decoder input is connected to the output of the active connection structure. The decoder includes four decoding convolutional units connected sequentially in data streams. The output of the previous decoding convolutional unit can be used as the input of the next decoding convolutional unit.
[0175] At the same time, such as Figure 2 As shown, the decoder and encoder of the Unet model are connected through a skip connection structure, which combines the shallow features of the decoder with the deep features of the encoder, enabling pixel-level accurate segmentation of images.
[0176] Specifically, the neural network model has skip connections, meaning that every time the decoder upsamples, it merges the feature maps of the same resolution in the decoder and encoder in a concatenated manner to help the decoder better recover the details of the target.
[0177] It's important to note that a pure codec framework compresses and loses a significant amount of detail during the encoding process, information that could potentially be helpful for later image segmentation. Deconvolution or upsampling processes fill in many gaps in the image, generating something from scratch, but this process lacks sufficient auxiliary information. The advantage of using skip connections is that it introduces feature information at the corresponding scale into the upsampling or deconvolution process, providing multi-scale, multi-level information for later image segmentation, thereby achieving more refined segmentation results.
[0178] Compared to existing technologies, the Unet model employed in this invention features an expanded FCN network architecture, incorporating multiple downsampling and convolution calculations, resulting in high feature extraction efficiency. This allows for highly accurate segmentation results with a small number of training images. Furthermore, the Unet model of this invention adds an upsampling stage and a skip connection structure, allowing information from the original image texture during downsampling to propagate from the high-resolution layers to the downsampling stage. This compensates for the loss of original image information during upsampling, contributing to accurate classification results. Specifically, each decoding convolutional unit has a concatenation layer at its input, followed by two sequentially connected SAME deconvolutional layers.
[0179] The concatenation layer is used to concatenate the shallow features of the decoder with the upsampled feature map. Upsampling increases the resolution of the feature map, and concatenating the feature maps of corresponding sizes on the left and right sides increases the number of channels in the feature map, resulting in more accurate segmentation.
[0180] Specifically, the two features are directly concatenated. For example, if the dimensions of the two input features x and y are p and q, the dimension of the output feature z is p+q.
[0181] Specifically, the shallow features input from the encoder to the decoder are the same size as the upsampled feature map, and after processing by the concatenation layer, the resulting feature map is twice the size of the input upsampled feature map.
[0182] Among them, the SAME deconvolutional connection layer can optimize the feature map while ensuring that the output feature map of the SAME deconvolutional connection layer and the feature map after max pooling are the same size. This helps to reduce the loss of edge information when calculating at the edge of the feature map during convolution calculation and improve the accuracy of feature extraction.
[0183] Specifically, the feature map obtained by the decoder through four decoding convolutional units is 16 times larger than the feature map at the decoder input.
[0184] Specifically, the classification module uses the softmax function to classify each pixel in the image.
[0185] In implementation, for each pixel value in the image, the softmax function is input to obtain the probability of that pixel unit in the original image being either background or sample particle. The sum of these two probabilities is 1. The larger of the two probabilities is taken as the output of the softmax function for that pixel unit: that is, the pixel unit belongs to either the background or the sample particle. Regarding the training of deep learning segmentation network models, it should be noted that the initial recognition performance of deep learning segmentation network models, such as the UNet model, may not meet the requirements and needs to be trained to achieve better recognition results.
[0186] On the one hand, a loss function needs to be introduced to characterize the recognition effect of the final output of the deep learning segmentation network model and determine whether it meets the training requirements; on the other hand, it is necessary to calculate the loss of each module of the deep learning segmentation network model, such as the convolutional unit, and adjust the model parameters, such as the convolutional kernel, based on the loss of each module.
[0187] Specifically, the loss calculation of the deep learning segmentation network model is achieved through the cross-entropy function; the loss of the max pooling layer, convolutional layer, etc. in the deep learning segmentation network model is calculated using methods in this field, and the model parameters are adjusted based on the loss.
[0188] Specifically, training the deep learning segmentation network model as described in S211 includes:
[0189] a. Initialize model parameters and assign initial values;
[0190] b. The input data is propagated forward through a deep learning segmentation network model to obtain the output value, which is used as the training set output;
[0191] c. Based on the loss function, obtain the error between the model output value and the target value in the label set;
[0192] d. Training ends when the error is equal to or less than the expected value;
[0193] When the error is greater than the expected value, the error is fed back to the deep learning segmentation network model, and the error of each module is calculated in turn. The model parameters of each module are updated based on the error of each module, and the above ad is repeated until the error is equal to or less than the expected value.
[0194] Specifically, the expected value in step d can be selected and set according to actual needs. For example, the cross-entropy function loss can be set to 0.01% as the expected value.
[0195] Specifically, for example: Python is used to convert the JSON file of the labeling results corresponding to each labeled region into a PNG file. The original image is used as the training set, and the PNG file is used as the label set. Based on the PyCharm development environment and PyTorch machine learning library, the Unet deep neural network model structure is used to train the model.
[0196] Specifically, in step 3, the image fitting tool is used to query the contour point location information of each aerobic granular sludge in the binary classification results, and the contour point location information is fitted and calculated to obtain the contour diameter and area of the aerobic granular sludge; the image fitting tool is used to query the contour point location information of the sedimentation image background, sludge-water interface, and measuring container scale in the binary classification results, and the contour point location information is fitted and calculated to obtain the sludge sedimentation scale.
[0197] It should be noted that the image fitting tool can transform abstract, invisible binary classification images into visible ones, classify different regions in the image, and output parameters such as the diameter and area of individual regions in the image.
[0198] Specifically, in step 3, obtaining a fitted image of the aerobic granular sludge profile includes:
[0199] The contour information of aerobic granular sludge is obtained from the binary image, and a fitted image of the aerobic granular sludge contour is generated based on the contour information.
[0200] Specifically, the `findContours` function from the `opencv` library in Python is used to find the contour information of each aerobic granular sludge, including:
[0201] S301: In OpenCV library search mode, set the RETR_EXTERNAL parameter to detect only the outer contour information, and use the CHAIN_APPROX_NONE parameter to store all contour information;
[0202] S302: Run the findContours function, which returns the position information of all points that constitute the outer contour of each aerobic granular sludge, and outputs the row and column coordinates of the pixels where the outer contour is located in the binary image to obtain the contour information of the aerobic granular sludge.
[0203] Specifically, the approxPolyDP function from the OpenCV library in Python was used to plot a fitted image of the aerobic granular sludge profile, including:
[0204] S303: Run the approxPolyDP function to perform polygon fitting on the image contour points to obtain a fitted image of the aerobic granular sludge contour.
[0205] Compared with existing technologies, this invention uses the Python software OpenCV library for image contour information acquisition and image fitting, which can seamlessly connect to directly obtain contour information in binary images output by deep learning models, resulting in higher processing efficiency.
[0206] Specifically, based on the positional information of all points on the outer contour of the aerobic granular sludge, the area of each aerobic granular sludge contour is obtained;
[0207] Specifically, the contourArea function of the OpenCV library in Python was used to obtain fitted images of the aerobic granular sludge profile, including:
[0208] S304: Pass the information of all points constituting the outermost contour returned by the findContours function in S302 into the contourArea function;
[0209] S305: The contourArea function returns the area of the contour of each aerobic granular sludge particle.
[0210] Specifically, in step 3, obtaining the sludge settling scale at the target time includes:
[0211] The binary image containing the binary classification results is input into the deep learning model to identify the background of the sedimentation image, the mud-water surface, and the adjacent scale above the mud-water surface in the measuring container. Based on the pixel information of the sedimentation image, the percentage distance between the mud-water surface and the adjacent scale above it is obtained, and the mud-water surface scale is calculated.
[0212] In step 4, based on the area of the aerobic granular sludge outline, the area ratio Y of the aerobic granular sludge is obtained, including:
[0213] The area of the aerobic granular sludge in the fitted image of the sludge profile is statistically analyzed to obtain the area B of the aerobic granular sludge in the acquired image.
[0214] Based on the magnification f when the camera equipment acquires a planar image and the actual area A' of the aerobic granular sludge imaging plane, the area A of the aerobic granular sludge mixed liquor in the acquired image is obtained, satisfying: A=f×A';
[0215] Based on Y = B / A, the area ratio Y of aerobic granular sludge is obtained.
[0216] It should be noted that Y represents the volume occupied by aerobic granular sludge in the wastewater. A smaller Y indicates less effectively dispersed sludge and lower activity; a larger Y may indicate sludge bulking, lacking settling properties and unable to be separated through sedimentation in subsequent processes, making it unusable. Compared to the MLSS mass concentration index, Y can more accurately reflect the dispersed concentration of sludge, providing a more realistic picture of sludge activity and treatment capacity.
[0217] To further rule out sludge bulking and confirm that the sludge has matured, step 4 introduces the sludge settling stability index Z as a prerequisite for judging sludge maturity.
[0218] In step 4, the sludge settling stability index Z is obtained based on the sludge settling scale at the target time, including:
[0219] Based on the sludge settling ratio (SV) at different target times, a sludge settling stability index Z = SV is defined. a / SV b SV a SV b These are the sludge settling ratios at the a-minute and b-minute settling times, respectively, where a < b. For example, SV a SV b Take SV5 and SV respectively 30 Z = SV5 / SV 30 .
[0220] Specifically, such as Figure 3 As shown: Determine the maturity of aerobic granular sludge according to the following steps:
[0221] S1: Determine if Z is greater than or equal to 1. If not, output "The aerobic granular waste culture is not mature". If it is greater than or equal to 1, proceed to S2.
[0222] S2: Determine if Y is greater than or equal to 80%. If yes, output "The aerobic granular sludge is well cultivated, and its aerobic granular sludge percentage is Y", and end; otherwise, proceed to S3.
[0223] S3: Determine if Y is approximately equal to 60% and less than 80%. If so, output "The aerobic granular sludge is well cultivated, and its aerobic granular sludge percentage is Y", and end; otherwise, output "The aerobic granular sludge is poorly cultivated, and its aerobic granular sludge percentage is Y", and end.
[0224] On the other hand, this invention discloses a system for detecting the granulation degree of aerobic granular sludge, comprising:
[0225] Data acquisition module:
[0226] Used to acquire sludge settling images at different times after sampling and planar images reflecting the planar distribution of aerobic granular sludge in unsettled wastewater samples;
[0227] Image recognition module:
[0228] Used to identify sludge settling images and planar images at different times, and obtain two different binary images containing binary classification results;
[0229] Image fitting module:
[0230] Used to obtain the fitted image of the aerobic granular sludge profile, the position information of all points on the outer contour of the aerobic granular sludge, the diameter and area of the aerobic granular sludge profile, and the sludge settling scale for the target time.
[0231] Data processing and aerobic granular sludge maturity assessment module:
[0232] The aerobic granular sludge is used to obtain the area ratio Y of aerobic granular sludge and the sludge settling stability index Z, and the maturity of aerobic granular sludge is judged based on the area ratio Y of aerobic granular sludge and the sludge settling stability index Z.
[0233] Specifically, in the data acquisition module, images of sludge settling at different times after sampling are obtained. The methods include: using a graduated cylinder to let the wastewater sample containing aerobic granular sludge stand still, and taking pictures with a camera parallel to the sludge-water separation surface at the 0-minute settling time and at different target times.
[0234] Specifically, in the data acquisition module, planar images reflecting the planar distribution of aerobic granular sludge in unsettled wastewater samples are obtained. This is achieved through methods including:
[0235] Wastewater samples containing aerobic granular sludge were placed in a rectangular transparent container for static settling. At 0 min of settling, a camera was used to take a picture of the planar distribution of aerobic granular sludge on the side of the container to obtain an image.
[0236] Preferably, the inner cavity thickness of the rectangular transparent container is related to the maximum particle size d of the sludge particles. max Satisfies: Inner cavity thickness is 1.5d max ~10d max between.
[0237] Specifically, the image recognition module identifies sludge settling images at different times, including:
[0238] The first training unit: Based on labeled sedimentation images, a deep learning segmentation network model is trained to obtain a deep learning segmentation network model that can identify sludge sedimentation scales at different times.
[0239] First recognition unit: Based on the trained deep learning segmentation network model, it identifies sludge settling images at different times and obtains binary images containing binary classification results;
[0240] The first training unit trains the deep learning segmentation network model, which is implemented in the following ways:
[0241] Capture images of sludge settling at different times, obtain sample data, and establish a training set of sludge settling at different times;
[0242] Preferably, the magnification and shooting distance of the images acquired during the training process and the data collection process are the same.
[0243] The sludge settling data at different times were input into the deep learning segmentation network model for training, resulting in a model that can identify the sludge settling scale at different times.
[0244] Specifically, a training set of sludge settling data at different time points is established. This can be achieved through methods including:
[0245] Determine the shooting parameters:
[0246] Determine the magnification and shooting distance for the photo.
[0247] The camera will automatically focus on the settlement image area according to the shooting distance, and the captured settlement image will meet the requirements of complete scale and clear image.
[0248] Collect standard image information:
[0249] At a determined magnification and shooting distance, images of sludge settling at different scales on a measuring container were captured after a period of sedimentation of the water sample. These settling images were then used as training photos.
[0250] Mark image tick marks:
[0251] All collected settlement images were marked, and the actual scale readings of the mud-water liquid level in different images were marked.
[0252] Processing the settlement images:
[0253] Binarize the background of all settlement images, each scale mark on the graduated cylinder, and the mud-water level mark, and convert the images from JPG format to PNG format. The processed settlement images and the original settlement images together constitute the settlement image training set.
[0254] Specifically, training sets of sludge settling data from different time periods are input into a deep learning segmentation network model for training. This can be achieved through methods including:
[0255] Set the termination parameters for deep learning model training, input the subsidence image training set into the deep learning model for training, the deep learning model learns from the labeled subsidence images, identifies the corresponding original subsidence images, then compares the two images to find differences and adjusts them until the training difference reaches the set termination parameters, and the trained model is obtained.
[0256] Specifically, in the first identification unit, the sludge settling images at different times are identified based on a trained deep learning segmentation network model. The implementation methods include:
[0257] The deep learning model identifies the background of the sedimentation image, the mud-water surface, and the adjacent scale above the mud-water surface in the measuring container. Based on the pixel information of the sedimentation image, it obtains the percentage distance between the mud-water surface and the adjacent scale above it, calculates the mud-water surface scale, and thus calculates the sludge settling ratio (SV).
[0258] Specifically, the image recognition module includes the following for planar image recognition:
[0259] The second training unit trains a deep learning segmentation network model based on particles of different sizes to obtain a deep learning segmentation network model that can identify particles of different sizes.
[0260] The second identification unit: Based on the trained deep learning segmentation network model, the outline of aerobic granular sludge is identified, and binary images of different regions are obtained to provide binary classification results.
[0261] Specifically, the second training unit involves training the deep learning segmentation network model, including:
[0262] Images of particles of different sizes are labeled, and the labeled images are segmented into labeled regions containing only one label name; a deep learning segmentation network model is trained based on the labeled regions.
[0263] In practice, particles of different sizes are dispersed in a single layer onto a plane, and images of the distribution of particles of different sizes are captured by a camera. The images are then labeled using labeling software to obtain images with multiple labeled regions and the labeling results corresponding to each labeled region. The labeled regions and labeling results are used as a training set to train the learning segmentation network model.
[0264] Specifically, the camera equipment has a zoom lens, a resolution of objects smaller than 0.05mm, and a magnification of 10 to 400.
[0265] Optionally, the images captured by the camera can be saved in JPG format.
[0266] Specifically, in the second training module, the training of the deep learning segmentation network model is implemented in the following ways:
[0267] Set the image capture parameters to obtain monolayer dispersion images of particles of different sizes;
[0268] Pixel-marked standard spherical particles of different sizes in the image were obtained to acquire an image with multiple marked regions and the marking result corresponding to each marked region.
[0269] The labeled regions and labeling results are used as the training set to train the learning segmentation network model.
[0270] Preferably, the magnification and shooting distance of the images are the same during the training process and data collection process.
[0271] Preferably, the standard round particle size range is 0.1mm to 3.0mm; this range corresponds to the distribution range of most aerobic activated sludge particles; setting standard round particles within this range as the training set is beneficial to improving the detection accuracy of the model after training.
[0272] Specifically, using an image marking tool, the boundaries of each standard circular particle in the obtained image file are manually marked to obtain multiple marked areas, each of which corresponds one-to-one with a standard circular particle.
[0273] Preferably, after the image labeling tool completes the labeling, it generates a JSON text file. The image segmentation data of standard circular particles is saved in JSON format and given a name for the particle or background. Each labeled region corresponds one-to-one with a JSON text file.
[0274] Preferably, the image labeling tool is labelme.
[0275] It should be noted that during the training of a deep learning segmentation network model, the naming of a JSON text file can be used to distinguish which pixels correspond to particles and which pixels correspond to the background, thus achieving the training objective.
[0276] Specifically, the use of the image labeling tool labelme for labeling includes:
[0277] Select the data folder you want to label in the labelme labeling interface;
[0278] Select the dot marking scheme in the edit menu bar;
[0279] Select the polygon creation mode, select a standard circular particle, select multiple marker points along the outline of the standard circular particle to construct a closed marker region, and save the image segmentation data of the standard circular particle.
[0280] Obtain image segmentation data for all remaining standard circular particles by following the steps described above.
[0281] Compared with existing technologies, this invention achieves the identification of individual particles by taking real-time photos of standard particles of different sizes and pixelating the photos. Compared with the existing technology of obtaining binary grayscale images for overall identification and then performing secondary classification based on grayscale, the prior labeling method of this invention is beneficial for the identification of smaller particles such as aerobic activated sludge after model training, and has higher identification accuracy for small particles.
[0282] Specifically, in the second training module, the deep learning segmentation network model is trained, and the implementation methods include:
[0283] a. Initialize model parameters and assign initial values;
[0284] b. The input data is propagated forward through a deep learning segmentation network model to obtain the output value, which is used as the training set output;
[0285] c. Based on the loss function, obtain the error between the model output value and the target value in the label set;
[0286] d. Training ends when the error is equal to or less than the expected value;
[0287] When the error is greater than the expected value, the error is fed back to the deep learning segmentation network model, and the error of each module is calculated in turn. The model parameters of each module are updated based on the error of each module, and the above ad is repeated until the error is equal to or less than the expected value.
[0288] Specifically, the expected value in step d can be selected and set according to actual needs. For example, the cross-entropy function loss can be set to 0.01% as the expected value.
[0289] Specifically, for example: Python is used to convert the JSON file of the labeling results corresponding to each labeled region into a PNG file. The original image is used as the training set, and the PNG file is used as the label set. Based on the PyCharm development environment and PyTorch machine learning library, the Unet deep neural network model structure is used to train the model.
[0290] Specifically, the image fitting module acquires a fitted image of the aerobic granular sludge contour, and the implementation methods include:
[0291] The contour information of aerobic granular sludge is obtained from the binary image, and a fitted image of the aerobic granular sludge contour is generated based on the contour information.
[0292] Specifically, the `findContours` function from the `opencv` library in Python is used to find the contour information of each aerobic granular sludge, including:
[0293] In OpenCV library search mode, set the RETR_EXTERNAL parameter to detect only the outer contour information, and use the CHAIN_APPROX_NONE parameter to store all contour information;
[0294] Run the findContours function to return the position information of all points that constitute the outer contour of each aerobic granular sludge, and output the row and column coordinates of the pixels where the outer contour is located in the binary image to obtain the contour information of the aerobic granular sludge.
[0295] Specifically, the approxPolyDP function from the OpenCV library in Python was used to plot a fitted image of the aerobic granular sludge profile, including:
[0296] Run the approxPolyDP function to perform polygon fitting on the image contour points to obtain a fitted image of the aerobic granular sludge contour.
[0297] Compared with existing technologies, this invention uses the Python software OpenCV library for image contour information acquisition and image fitting, which can seamlessly connect to directly obtain contour information in binary images output by deep learning models, resulting in higher processing efficiency.
[0298] Specifically, based on the positional information of all points on the outer contour of the aerobic granular sludge, the area of each aerobic granular sludge contour is obtained;
[0299] Specifically, the contourArea function of the OpenCV library in Python was used to obtain fitted images of the aerobic granular sludge profile, including:
[0300] Pass the information of all points that constitute the outermost contour returned by the findContours function in S302 into the contourArea function;
[0301] The contourArea function returns the area of the contour of each aerobic sludge particle.
[0302] Specifically, in the image fitting module, the sludge settling scale for the target time is obtained, including:
[0303] The binary image containing the binary classification results is input into the deep learning model to identify the background of the sedimentation image, the mud-water surface, and the adjacent scale above the mud-water surface in the measuring container. Based on the pixel information of the sedimentation image, the percentage distance between the mud-water surface and the adjacent scale above it is obtained, and the mud-water surface scale is calculated.
[0304] Specifically, in the data processing and aerobic granular sludge maturity assessment module, the area ratio Y of aerobic granular sludge is obtained based on the area of the aerobic granular sludge outline, including:
[0305] The area of the aerobic granular sludge in the fitted image of the sludge profile is statistically analyzed to obtain the area B of the aerobic granular sludge in the acquired image.
[0306] Based on the magnification f when the camera equipment acquires a planar image and the actual area A' of the aerobic granular sludge imaging plane, the area A of the aerobic granular sludge mixed liquor in the acquired image is obtained, satisfying: A=f×A';
[0307] Based on Y = B / A, the area ratio Y of aerobic granular sludge is obtained.
[0308] It should be noted that Y represents the volume occupied by aerobic granular sludge in the wastewater. A smaller Y indicates less effectively dispersed sludge and lower activity; a larger Y may indicate sludge bulking, lacking settling properties and unable to be separated through sedimentation in subsequent processes, making it unusable. Compared to the MLSS mass concentration index, Y can more accurately reflect the dispersed concentration of sludge, providing a more realistic picture of sludge activity and treatment capacity.
[0309] To further rule out sludge bulking and confirm that the sludge has matured, the sludge settling stability index Z is introduced as a prerequisite for judging sludge maturity in the data processing and aerobic granular sludge maturity judgment module.
[0310] In the data processing and aerobic granular sludge maturity assessment module, the sludge settling stability index Z is obtained based on the sludge settling scale at the target time, including:
[0311] Based on the sludge settling ratio (SV) at different target times, a sludge settling stability index Z = SV is defined. a / SV b SV a SV b These are the sludge settling ratios at the a-minute and b-minute settling times, respectively, where a < b. For example, SV a SV b Take SV5 and SV respectively 30 Z = SV5 / SV 30 .
[0312] Specifically, such as Figure 3 As shown: Determine the maturity of aerobic granular sludge according to the following steps:
[0313] S1: Determine if Z is greater than or equal to 1. If not, output "The aerobic granular waste culture is not mature". If it is greater than or equal to 1, proceed to S2.
[0314] S2: Determine if Y is greater than or equal to 80%. If yes, output "The aerobic granular sludge is well cultivated, and its aerobic granular sludge percentage is Y", and end; otherwise, proceed to S3.
[0315] S3: Determine if Y is approximately equal to 60% and less than 80%. If so, output "The aerobic granular sludge is well cultivated, and its aerobic granular sludge percentage is Y", and end; otherwise, output "The aerobic granular sludge is poorly cultivated, and its aerobic granular sludge percentage is Y", and end.
[0316] Compared with existing technologies, this invention uses the sludge settling stability index Z as the first criterion for judging the maturity of aerobic granular sludge cultivation, which can effectively avoid the impact of unstable sludge cultivation or the occurrence of bulky sludge on subsequent judgments. The invention also introduces the area ratio Y of aerobic granular sludge as the second criterion for judging the maturity of aerobic granular sludge cultivation, which objectively reflects the state of highly active and well-dispersed sludge. Compared with the MLSS mass concentration index, considering the sludge specific surface area and actual reactivity, it can actually reflect the dispersion concentration of sludge, and more realistically reflects the sludge activity and treatment capacity.
[0317] To illustrate the technical advancements of this invention, the following embodiments are further disclosed:
[0318] Example 1
[0319] This invention discloses a method for detecting the particle size of aerobic granular sludge, such as... Figure 1 As shown:
[0320] Step 1: Data collection.
[0321] The data acquisition module collects image data. When aerobic granular sludge is loaded into a 1000ml graduated cylinder, the camera will take pictures of the side of the standard graduated cylinder filled with 1000ml of aerobic granular sludge. The pictures are taken at 5 minutes and 30 minutes of settling time, and the image data is transmitted to the image recognition module.
[0322] Wastewater samples containing aerobic granular sludge were placed in a rectangular transparent container. The system automatically adjusted the magnification to 10x and the shooting distance to 30cm. At the 0-minute mark of standing, a camera was used to take a picture perpendicular to the side of the container to obtain a planar distribution image of the aerobic granular sludge.
[0323] Step 2: Image recognition.
[0324] Image recognition includes two aspects: scale image recognition and area image recognition.
[0325] The area image recognition process includes a deep learning segmentation network model training process and a recognition process. The training process includes:
[0326] The system automatically adjusts the magnification to 10x, the shooting distance to 30cm, and defines the image acquisition area as 5cm×5cm after shooting; it acquires monolayer dispersion images of an equal number of standard spherical particles of different sizes with particle sizes ranging from 0.1mm, 0.2mm, 0.5mm, 0.8mm, 1.0mm, 1.2mm, 1.5mm, 1.8mm, 2.0mm, 2.2mm, 2.5mm, 2.8mm, to 3.0mm.
[0327] Pixel-marked standard spherical particles of different sizes in the image were obtained to acquire an image with multiple marked regions and the marking result corresponding to each marked region.
[0328] Select the data folder you want to label in the labelme labeling interface;
[0329] Select the dot marking scheme in the edit menu bar;
[0330] Select the polygon creation mode, select a standard circular particle, select multiple marker points along the outline of the standard circular particle to construct a closed marker region, and save the image segmentation data of the standard circular particle.
[0331] Obtain image segmentation data for all remaining standard circular particles by following the steps described above.
[0332] The labeled regions and labeling results are used as the training set to train the Unet model; including:
[0333] Initialize model parameters, assigning initial values to model parameters such as convolution kernels;
[0334] The input data is propagated forward through a deep learning segmentation network model to obtain the output value;
[0335] Based on the loss function, the error between the model output value and the target value is obtained;
[0336] Training ends when the error is equal to or less than the expected value.
[0337] When the error is greater than the expected value, the error is fed back to the deep learning segmentation network model, and the error of each module is calculated in turn. The model parameters of each module are updated based on the error of each module. The above steps are repeated until the error is equal to or less than the expected value, which is 0.1% of the cross-entropy function loss.
[0338] Based on the trained deep learning segmentation network model, a binary classification image is obtained from the planar image reflecting the planar distribution of aerobic granular sludge in the unsettled sewage sample acquired during the data acquisition process, which is then used for area image fitting.
[0339] The scale image recognition process includes a deep learning segmentation network model training process and a recognition process. The training process includes:
[0340] Acquire settlement images at different target times, mark the actual scale readings of mud and water liquid levels at different target times, and binarize the background of all settlement images, each scale on the graduated cylinder, and the mud and water liquid level scale, and combine them with the original settlement images to form a settlement image training set.
[0341] Set the termination parameters for deep learning model training, input the subsidence image training set into the deep learning model for training, the deep learning model learns from the labeled subsidence images, identifies the corresponding original subsidence images, then compares the two images to find differences and adjusts them until the training difference reaches the set termination parameters, and the trained model is obtained.
[0342] Step 3: Image fitting.
[0343] Image fitting includes two aspects: scale image fitting and area image fitting. Scale image fitting involves reading the settling volume of aerobic granular sludge after settling at 5 min and 30 min, respectively.
[0344] The area image fitting process primarily utilizes a pre-trained image recognition model to fit the binary image containing the binary classification results of the image taken at minute 0. This yields the fitted image and the contour area of all aerobic granular sludge particles. The total area of all aerobic granular sludge particles is then calculated, and the marked contours of the aerobic granular sludge particles are converted into areas. The identified area of the aerobic granular sludge particles is denoted as B. At this point, the total area B of the aerobic granular sludge particles is 150 cm³. 2 Let A be the total surface area of the aerobic granular sludge mixed liquor. In this case, A is 200.6 cm². 2 .
[0345] Step 4: Data processing and assessment of the maturity of aerobic granular sludge.
[0346] Data calculation and analysis are performed on the obtained area and scale data based on computer programs or manual mathematical statistics.
[0347] Based on scale image recognition, the aerobic granular sludge settling ratio data at 5 minutes and 30 minutes, namely SV5 and SV6, can be obtained. 30 Where SV5 = volume of settled sludge after 5 minutes of settling / total volume of mixed liquor (1000 ml), SV 30 = Volume of settled sludge after 30 minutes / Total volume of mixed liquor (1000 ml). For example, in this embodiment, the image identification shows: SV5 = 27%, SV... 30 =25%.
[0348] The area ratio Y of aerobic granular sludge is used as an indicator to judge the degree of granulation of aerobic granular sludge, where Y = B / A, A is the area of the aerobic granular sludge mixed liquor, and B is the area of the aerobic granular sludge. From this formula, Y = 150 / 200.6 = 74.78%.
[0349] The above-mentioned judgment module makes judgments according to the following method, "A Method for Judging the Maturity of Aerobic Granular Sludge," and its judgment logic flow is shown in the figure. The specific steps are as follows:
[0350] S1: Determine if Z is greater than or equal to 1. At this time, Z = 1.08. If it is greater than 1, proceed to S2.
[0351] S2: Determine if Y is greater than or equal to 80%? If Y = 74.78% < 80%, then proceed to S3;
[0352] S3: Determine if Y is approximately equal to 60% and Y is less than 80%. In this case, 60≤Y<80, then output "The aerobic granular sludge is well cultivated, and its aerobic granular sludge ratio is Y=74.78%", and end.
[0353] Example 2
[0354] This invention discloses a detection system for detecting the granulation degree of aerobic granular sludge, used in the detection method of Example 1, comprising:
[0355] Data acquisition module:
[0356] Used to acquire sludge settling images at different times after sampling and planar images reflecting the planar distribution of aerobic granular sludge in unsettled wastewater samples;
[0357] Image recognition module:
[0358] Used to identify sludge settling images and planar images at different times, and obtain two different binary images containing binary classification results;
[0359] Image fitting module:
[0360] Used to obtain the fitted image of the aerobic granular sludge profile, the position information of all points on the outer contour of the aerobic granular sludge, the diameter and area of the aerobic granular sludge profile, and the sludge settling scale for the target time.
[0361] Data processing and aerobic granular sludge maturity assessment module:
[0362] The aerobic granular sludge is used to obtain the area ratio Y of aerobic granular sludge and the sludge settling stability index Z, and the maturity of aerobic granular sludge is judged based on the area ratio Y of aerobic granular sludge and the sludge settling stability index Z.
[0363] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting the degree of granulation of aerobic granular sludge, characterized in that, The method comprises the following steps: Data acquisition: A sewage sample containing aerobic granular sludge is subjected to a standing experiment to obtain sludge sedimentation images at different times after sampling; a planar image reflecting the planar distribution of aerobic granular sludge in the undegraded sewage sample is obtained; Image recognition: Two deep learning segmentation network models are constructed to recognize the sludge sedimentation images at different times and the planar image respectively, and two binary images containing binary classification results are obtained; the sludge sedimentation images at different times are recognized to obtain binary images containing binary classification results of the sludge sedimentation images at different times; the two deep learning segmentation network models are respectively a deep learning segmentation network model for recognizing sludge sedimentation scales at different times and a deep learning segmentation network model for recognizing particles of different sizes; Specifically, the sludge sedimentation images at different times are recognized, including recognizing the sludge sedimentation images at different times based on the deep learning segmentation network model for recognizing sludge sedimentation scales at different times to obtain binary images containing binary classification results of the sludge sedimentation images at different times; The planar image is recognized, including recognizing the planar image reflecting the planar distribution of aerobic granular sludge in the undegraded sewage sample based on the deep learning segmentation network model for recognizing particles of different sizes to obtain binary images containing binary classification results of different regions; Image fitting: Based on the binary classification results of different regions, a fitting image of the aerobic granular sludge contour, position information of all points of the outer contour of the aerobic granular sludge, and the diameter and area of the aerobic granular sludge contour are obtained; based on the binary classification results of the sludge sedimentation images at different times, a sludge sedimentation scale at a target time is obtained; Data processing and aerobic granular sludge maturity judgment: The area proportion Y of the aerobic granular sludge is obtained based on the outlines of the aerobic granular sludge, the sludge sedimentation stability index Z is obtained based on a target time, and the maturity of the aerobic granular sludge is determined based on the area proportion Y of the aerobic granular sludge and the sludge sedimentation stability index Z; wherein Y=B / A, A is the area of the mixed liquor of the aerobic granular sludge in the plane image, and B is the sum of the areas of all the outlines of the aerobic granular sludge in the plane image; Z= SV a / SV b ; SV a , SV b are the sludge sedimentation ratios of the wastewater sample containing the aerobic granular sludge at the a min and b min, respectively, and a<b.
2. The detection method according to claim 1, characterized in that, The sludge sedimentation images at different times are recognized, including: S201: Marking the sedimentation images at different times and at different sludge-water interface scales, training the deep learning segmentation network model based on the marked sedimentation images, and obtaining the deep learning segmentation network model for recognizing sludge sedimentation scales at different times; S202: Recognizing the sludge sedimentation images at different times based on the trained deep learning segmentation network model to obtain binary images containing binary classification results.
3. The detection method according to claim 2, characterized in that, In S201, the training of the deep learning segmentation network model comprises: S2011: Taking pictures of the sludge sedimentation images at different times to obtain sample data and establish a sludge sedimentation training set at different times; S2012: Inputting the sludge sedimentation training set at different times into the deep learning segmentation network model for training to obtain a model for recognizing sludge sedimentation scales at different times.
4. The detection method according to claim 3, characterized in that, In S2011, the establishment of the sludge sedimentation training set at different times comprises: S20111, determining the photographing parameters: Determining the photographing magnification and photographing distance; S20112, collecting standard picture information: Taking pictures of the sludge sedimentation images of the water sample at different scales of the sludge-water interface during sedimentation; S20113, marking the picture scales: Marking the collected all sedimentation images, and marking the actual scale readings of the sludge-water interface of different pictures; S20114, processing the sedimentation images: The background of all the sedimentation images, each scale on the measuring cylinder, and the mud-water level scale are binarized, and the processed sedimentation images and the original sedimentation images jointly constitute a sedimentation image training set.
5. The detection method according to claim 4, characterized in that, The planar image recognition includes: S211: training a deep learning segmentation network model based on the particles of different particle sizes, to obtain a deep learning segmentation network model for recognizing the particles of different particle sizes; S212: recognizing the aerobic granular sludge contour based on the trained deep learning segmentation network model, to obtain a binary image giving binary classification results of different regions.
6. The detection method according to claim 5, characterized in that, In S211, the training of the deep learning segmentation network model includes: S2111: setting a photographing parameter, to obtain a single-layer dispersion picture of the particles of different particle sizes; S2112: pixel labeling the standard circular particles of different particle sizes in the picture, to obtain a picture with multiple labeled regions and a labeled result corresponding to each labeled region; S2113: using the labeled regions and the labeled result as a training set to train the learning segmentation network model.
7. The detection method according to claim 6, characterized in that, In S2112, the pixel labeling of the standard circular particles of different particle sizes in the picture includes: Using an image labeling tool, manually labeling the boundary of each standard circular particle in the obtained picture file, to obtain multiple labeled regions, each of which corresponds to a standard circular particle.
8. The detection method according to claim 7, characterized in that, After the image labeling tool completes the labeling, a json text file is generated, and the image segmentation data of the standard circular particles are saved in the json format and given a name of the particle or the background; each labeled region corresponds to a json text file.
9. The detection method according to claim 8, characterized in that, Using the findContours function of the opencv library of the python software to obtain the aerobic granular sludge contour information includes: S301: in the opencv library retrieval mode, setting the RETR_EXTERNAL parameter to detect only the outer contour information, and using the CHAIN_APPROX_NONE parameter to store all the information of the contour; S302: running the findContours function to return the position information of all points constituting the outer contour of each aerobic granular sludge, outputting the row and column coordinates of the pixel points where the outer contour is located in the binary image, to obtain the aerobic granular sludge contour information.
10. A system for detecting the degree of granulation of aerobic granular sludge, characterized in that it comprises: Using the detection method of any one of claims 1-9 includes: A data acquisition module: used to obtain sludge sedimentation images at different times after sampling and planar images reflecting the planar distribution of aerobic granular sludge in the unsedimented sewage sample; An image recognition module: used to recognize the sludge sedimentation images at different times and the planar images, to obtain two binary images containing binary classification results; the recognition of the sludge sedimentation images at different times obtains a binary image containing binary classification results of the sludge sedimentation images at different times, and the two deep learning segmentation network models are respectively a deep learning segmentation network model for recognizing sludge sedimentation scales at different times and a deep learning segmentation network model for recognizing particles of different particle sizes; Specifically, the sludge settling image at different times is identified, including a deep learning segmentation network model based on identifying the depth of the sludge settling scale at different times, identifying the sludge settling image at different times, and obtaining a binary image containing a binary classification result of the sludge settling image at different times; The planar image is identified, including a deep learning segmentation network model based on identifying different particle sizes of particles, identifying the planar image reflecting the planar distribution of the aerobic granular sludge in the unsettled sewage sample, and obtaining a binary image containing a binary classification result of different regions; An image fitting module: The fitting image of the aerobic granular sludge contour, the position information of all points of the outer contour of the aerobic granular sludge, the diameter and area of the aerobic granular sludge contour, and the sludge settling scale at the target time are obtained; based on the binary classification result of different regions, the fitting image of the aerobic granular sludge contour, the position information of all points of the outer contour of the aerobic granular sludge, and the diameter and area of the aerobic granular sludge contour are obtained; based on the binary classification result of the sludge settling image at different times, the sludge settling scale at the target time is obtained; A data processing and aerobic granular sludge maturity judgment module: The area proportion Y of the aerobic granular sludge and a sludge settling stability index Z are obtained, and the maturity of the aerobic granular sludge is determined based on the area proportion Y of the aerobic granular sludge and the sludge settling stability index Z; wherein Y = B / A, A is the area of the aerobic granular sludge mixed liquid in the planar image collection image, B is the sum of the areas of all aerobic granular sludge contours in the planar image collection image; Z = SV a / SV b ; SV a , SV b are sludge settling ratios of the wastewater sample containing the aerobic granular sludge at the a min and b min, respectively, and a < b.
Citation Information
Patent Citations
Device for automatically collecting, observing and identifying activated sludge settlement experiment process
CN112229770A
Intelligent diagnosis system for running state of wastewater biochemical treatment system and application method of intelligent diagnosis system
CN114372706A