Sewage treatment detection method and system based on coagulating sedimentation

By adopting a coagulation precipitation-based detection method in the early stage of sewage treatment, and using visual image processing and machine learning to predict future color values, the problem of poor detection timeliness in the prior art is solved, and the continuity and prospectiveness of sewage treatment detection are achieved.

CN120125846APending Publication Date: 2025-06-10POWER CHINA KUNMING ENG CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510182858.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

The existing initial sewage treatment detection methods are poor in time and are not continuous and forward-looking.

Method used

The sewage treatment detection method based on coagulation and precipitation is used to sample and oscillate the water body through each preset time period, visual images are obtained, water body boundaries are extracted, future color values ​​are predicted, and sewage treatment completion time is calculated.

Benefits of technology

The continuity and prospectiveness of sewage treatment test results are achieved, and can reflect the progress and completion time of water body treatment in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120125846A_ABST
    Figure CN120125846A_ABST
Patent Text Reader

Abstract

The invention discloses a sewage treatment detection method and system based on coagulating sedimentation, and relates to the technical field of sewage treatment. According to the method, from the perspective of computer visual recognition of coagulating sedimentation, a plurality of sedimentation visual images based on the same set of sampling operation are constructed to complete the extraction and analysis operation of a series of subsequent characteristics, and meanwhile, the characteristic that a water body changes from turbid to clear at the initial stage of sewage treatment is also utilized; and the prediction function is realized through learning the characteristic of the machine learning machine. Compared with an experimental result provided by a laboratory in the prior art, the method reflects the linear characteristic of the whole initial treatment stage, so that the detection result has continuity, and perspective is realized through a prediction function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of sewage treatment, and particularly to a sewage treatment detection method and system based on coagulation sedimentation. Background Art

[0002] Sewage treatment refers to the process of separating, removing, recycling or converting the pollutants contained in sewage into harmless substances through physical, chemical and biological methods, etc., so as to meet the discharge standards or reuse requirements. The main purpose of sewage treatment is to protect the environment and human health. Through a series of treatment steps, the concentrations of various pollutants in sewage reach the legal discharge standards or specific reuse requirements.

[0003] The importance of sewage treatment lies in protecting the environment and human health. Through effective sewage treatment, the pollution of water bodies by pollutants can be reduced, the spread of diseases can be prevented, and the ecosystem can be protected. The development and application of sewage treatment technologies are of great significance for achieving sustainable development and environmental protection.

[0004] Currently, during the sewage treatment process, water quality sampling and detection are usually carried out on the water bodies at each stage. The sampling and detection methods mainly include physical detection, chemical detection, and biological detection. Among them, physical detection is an important detection means in the initial stage of sewage treatment, mainly reflecting the content of suspended solids in water through colorimetry or turbidimeter; detecting the water temperature through a thermometer to reflect the rate of biochemical reactions in the water body; and reflecting the total amount of ions in water through conductivity. The aforementioned initial detection methods usually need to be realized through laboratory experimental means, and the results obtained from the experiments can only reflect the instantaneous state at the time of sampling. Since sewage treatment is a linear continuous operation, the timeliness of the experimental results is poor, and they do not have continuity and foresight. Summary of the Invention

[0005] The main purpose of the present application is to provide a sewage treatment detection method and system based on coagulation sedimentation to solve the problems that the detection method in the initial stage of sewage treatment in the prior art has poor timeliness and does not have continuity and foresight.

[0006] To achieve the above purpose, the present application provides the following technical solutions:

[0007] A sewage treatment detection method based on coagulation sedimentation, the sewage treatment detection method is applied to a water body with coagulation sedimentation, and the sewage treatment detection method includes:

[0008] Step S1, performing equal-volume sampling on the water body with the coagulation sedimentation based on each preset time period and placing it in a number of transparent containers of the same specification;

[0009] Step S2, oscillating the transparent containers in the current preset time period with a preset amplitude and a preset duration;

[0010] Step S3, taking the completion of coagulation sedimentation of the current transparent container as the shooting node, and obtaining the visual image of the current transparent container based on the preset shooting perspective;

[0011] Step S4, respectively extracting the water body boundaries of each visual image through an edge extraction algorithm;

[0012] Step S5, taking the enclosed area of the water body boundary of the current visual image as the water body image of the current visual image;

[0013] Step S6, respectively obtaining the color values of each water body image through the OpenCV software package of Python;

[0014] Step S7, learning and training all color values through machine learning, and predicting several future color values of the water body based on several preset prediction steps;

[0015] Step S8, obtaining the number of preset prediction steps when the future color value of the water body is less than or equal to the preset color threshold;

[0016] Step S9, obtaining the future timestamp corresponding to the number of preset prediction steps, which is the sewage treatment completion time of the water body.

[0017] As a further improvement of the present application, in step S9, after obtaining the future timestamp corresponding to the number of preset prediction steps, which is the sewage treatment completion time of the water body, it includes:

[0018] Step S10, obtaining the planned treatment duration of the water body;

[0019] Step S20, obtaining the sum value of all preset time periods and all preset prediction steps, and defining it as the actual treatment duration;

[0020] Step S30, obtaining the magnitude relationship between the actual treatment duration and the planned treatment duration;

[0021] Step S40, if the actual treatment duration is greater than the planned treatment duration, generating a processing progress acceleration signal and sending it to the external monitoring end;

[0022] Step S50, if the actual treatment duration is less than or equal to the planned treatment duration, determining that the processing progress is normal.

[0023] As a further improvement of the present application, in step S4, respectively extracting the water body boundaries of each visual image through an edge extraction algorithm, includes:

[0024] Step S41, respectively converting each visual image into a grayscale image through the cv2.cvtColor() function of the OpenCV software package;

[0025] Step S42: Obtain all the edges of color patches in the current grayscale image through the Canny edge detection operator;

[0026] Step S43: Define a corrosion structuring element with a preset pixel size;

[0027] Step S44: Traverse all the edges of color patches with the center of the corrosion structuring element;

[0028] Step S45: Delete all the paths traversed by the corrosion structuring element to obtain the eroded image of the current grayscale image;

[0029] Step S46: Differentiate the current grayscale image and the current eroded image to obtain the water body boundary.

[0030] As a further improvement of the present application, in step S5, the enclosed area of the water body boundary of the current visual image is used as the water body image of the current visual image, including:

[0031] Step S51: Merge the water body boundary into the current grayscale image to obtain a grayscale image with a boundary;

[0032] Step S52: Obtain all the closed areas of the current grayscale image with a boundary;

[0033] Step S53: Obtain the shape of the transparent container based on the preset shooting perspective;

[0034] Step S54: Delete the closed areas with the same shape as the shape of the transparent container;

[0035] Step S55: Obtain the sedimentation area of the coagulation sediment through the target detection algorithm based on the current visual image;

[0036] Step S56: Delete the closed areas with the same shape as the shape of the sedimentation area;

[0037] Step S57: Define the remaining closed areas as the water body image.

[0038] As a further improvement of the present application, in step S7, all color values are learned and trained through a machine learning machine, and several future color values of the water body are predicted based on several preset prediction steps, including:

[0039] Step S71: Integrate all the pixel color values of a water body image into a pixel color data set;

[0040] Step S72: Perform standard normalization processing on all the pixel color data sets to obtain a normalized data set based on a pixel color data set;

[0041] Step S73: Divide the normalized data set into a training set and a validation set according to a preset ratio;

[0042] Step S74: Define a neural network model with signal connections in sequence for the input layer, hidden layer, and output layer;

[0043] Step S75: Input all the training sets into the input layer in sequence and perform several trainings through the neural network model;

[0044] Step S76: Based on each training, obtain the root mean square error of the training results corresponding to the current validation set and the current training set respectively;

[0045] Step S77: Obtain the minimum error among all the root mean square errors;

[0046] Step S78: Obtain the training result corresponding to the minimum error as the water body color value prediction model;

[0047] Step S79: Predict several future water body color values based on several preset prediction steps through the water body color value prediction model.

[0048] As a further improvement of the present application, in step S9, obtain the future timestamps corresponding to the number of preset prediction steps, which are the sewage treatment completion times of the water body. After that, it includes:

[0049] Step S100: Send the sewage treatment completion time to an external monitoring terminal.

[0050] To achieve the above object, the present application also provides the following technical solutions:

[0051] A sewage treatment detection system based on coagulation sedimentation, the sewage treatment detection system is applied to the sewage treatment detection method as described above, and the sewage treatment detection system includes:

[0052] A coagulation sedimentation water body extraction module, which is used to perform equal - volume sampling on the water body with the coagulation sedimentation based on each preset time period and place it in several transparent containers of the same specification;

[0053] A transparent container oscillation module, which is used to oscillate the transparent containers of the current preset time period with a preset amplitude and a preset duration;

[0054] A transparent container visual image acquisition module, which is used to take the visual image of the current transparent container based on a preset shooting angle with the sedimentation completion of the coagulation sedimentation in the current transparent container as the shooting node;

[0055] A visual image water body boundary extraction module, which is used to extract the water body boundaries of each visual image respectively through an edge extraction algorithm;

[0056] A water body image acquisition module, which is used to take the enclosed area of the water body boundary of the current visual image as the water body image of the current visual image;

[0057] A water body image color value acquisition module, which is used to respectively acquire the color values of each water body image through the OpenCV software package of Python;

[0058] A water body future color value prediction module, which is used to learn and train all color values through machine learning, and predict a number of water body future color values based on a number of preset prediction steps;

[0059] A preset prediction step number acquisition module, which is used to acquire the number of preset prediction steps when the water body future color value is less than or equal to a preset color threshold;

[0060] A sewage treatment completion time acquisition module, which is used to acquire the future timestamp corresponding to the number of preset prediction steps as the sewage treatment completion time of the water body.

[0061] To achieve the above object, the present application also provides the following technical solutions:

[0062] An electronic device, including a processor and a memory coupled to the processor, where the memory stores program instructions executable by the processor; when the processor executes the program instructions stored in the memory, the sewage treatment detection method as described above is implemented.

[0063] To achieve the above object, the present application also provides the following technical solutions:

[0064] A storage medium, where program instructions are stored in the storage medium, and when the program instructions are executed by a processor, the sewage treatment detection method as described above can be implemented.

[0065] This application takes equal - volume samples of water bodies with coagulation sedimentation every preset time period and places them in a number of transparent containers of the same specification; shakes the transparent containers of the current preset time period with a preset amplitude and for a preset duration; takes the completion of the coagulation sedimentation in the current transparent container as the shooting node, and obtains the visual image of the current transparent container based on a preset shooting perspective; extracts the water - body boundaries of each visual image respectively through an edge - extraction algorithm; takes the enclosed area of the water - body boundary of the current visual image as the water - body image of the current visual image; obtains the color values of each water - body image respectively through the OpenCV software package of Python; learns and trains all the color values through machine learning, and predicts the future color values of a number of water bodies based on a number of preset prediction steps; obtains the number of preset prediction steps when the future color value of the water body is less than or equal to a preset color threshold; and obtains the future timestamp corresponding to the number of preset prediction steps, which is the sewage - treatment completion time of the water body. This application starts from the perspective of computer - vision recognition of coagulation sedimentation, constructs a number of sedimentation visual images based on the same set of sampling operations for subsequent extraction and analysis of a series of features. At the same time, this application also utilizes the characteristic that the water body changes from turbid to clear in the initial stage of sewage treatment, and realizes the prediction function by learning this characteristic through machine learning. Compared with the prior - art laboratory providing experimental results, this application reflects the linear characteristics of the entire initial - treatment stage, making the detection results continuous, and realizes the forward - looking nature through the prediction function. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 It is a schematic diagram of the process steps of an embodiment of the sewage - treatment detection method based on coagulation sedimentation of this application;

[0067] Figure 2 It is a schematic diagram of the functional modules of an embodiment of the sewage - treatment detection system based on coagulation sedimentation of this application;

[0068] Figure 3 It is a schematic diagram of the structure of an embodiment of the electronic device of this application;

[0069] Figure 4 It is a schematic diagram of the structure of an embodiment of the storage medium of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0070] Next, the technical solutions in the embodiments of this application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

[0071] The terms "first", "second", and "third" in this application are only used for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first", "second", and "third" may explicitly or implicitly include at least one such feature. In the description of this application, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically and clearly defined. All directional indications (such as up, down, left, right, front, back...) in the embodiments of this application are only used to explain the relative positional relationship and movement conditions between components in a specific posture (as shown in the drawings). If this specific posture changes, then the directional indications will also change accordingly. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units not listed, or optionally also includes other steps or units inherent to these processes, methods, products, or devices.

[0072] Reference to "embodiments" in this context means that a particular feature, structure, or characteristic described in connection with the embodiments can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.

[0073] As Figure 1 shown, this embodiment provides an embodiment of a sewage treatment detection method based on coagulation sedimentation. In this embodiment, the sewage treatment detection method is applied to a water body with coagulation sedimentation.

[0074] Preferably, this embodiment is mainly used in the initial stage of sewage treatment, that is, the stage where coagulation sedimentation is clearly visible to the naked eye, and it is also an important stage of the entire sewage treatment.

[0075] Specifically, the sewage treatment detection method includes the following steps:

[0076] Step S1, perform equal-volume sampling on the water body with coagulation sedimentation based on each preset time period and place it in a number of transparent containers of the same specification.

[0077] Preferably, since the initial sedimentation rate of coagulation sedimentation is relatively fast, the preset time period and the preset prediction steps in this embodiment can be set to the same step size, such as one second, ten seconds, thirty seconds, etc.

[0078] Preferably, the transparent container can be set to a cylindrical shape to prevent the existence of side prisms from interfering with subsequent visual recognition.

[0079] Step S2, oscillate the transparent container in the current preset time period with a preset amplitude for a preset duration.

[0080] Preferably, the oscillation with the preset amplitude and preset duration in Step S2 can be achieved by one of the following oscillation devices:

[0081] Separatory funnel vertical oscillator: It adopts high-quality core components, has the characteristics of large amplitude and high speed, and both the working time and frequency can be adjusted and set. It is suitable for batch processing of samples, can minimize the opportunity for operators to contact reagents, and protect personal safety and the reagents from being contaminated.

[0082] Liquid oscillator: It can finely adjust the oscillation speed in the range of 0 - 300 times / minute to ensure oscillation accuracy. Moreover, the timing function of the liquid oscillator is precise and can operate according to the set time, avoiding errors caused by improper time control.

[0083] Vortex mixer oscillator: It has good mixing effect and is easy to operate.

[0084] Rotary water bath oscillator: It has advantages such as a wide temperature control range and easy operation.

[0085] Step S3, taking the completion of coagulation sedimentation in the current transparent container as the shooting node, obtain the visual image of the current transparent container based on the preset shooting perspective.

[0086] Preferably, the completion of coagulation sedimentation can be determined by computer vision recognition when the last visible particle falls into the sedimentation area.

[0087] Preferably, the preset shooting perspective can be set to the side of the above-mentioned cylindrical transparent container, that is, the shooting normal is perpendicular to the height of the cylinder.

[0088] Preferably, the visual image can be cropped to delete the background part outside the transparent container to ensure the accuracy of subsequent detection.

[0089] Step S4, extract the water body boundary of each visual image through the edge extraction algorithm.

[0090] Preferably, the edge is the place where the image brightness changes significantly and is the boundary line between the object and the background or different objects. The edge detection algorithm finds the edge by identifying the brightness gradient in the image. Commonly used edge detection operators include Sobel, Prewitt, Roberts, and Canny, etc.

[0091] Among them, Sobel operator, Prewitt operator, Roberts operator: The aforementioned operators detect edges by calculating the gradient amplitude of each pixel in the image, and estimate the gradient through filters in the horizontal and vertical directions. Canny edge detector: The Canny algorithm is a more complex edge detection method, which aims to capture the edges in the image as accurately as possible and minimize false detections and missed detections. The Canny detector first uses a Gaussian filter to smooth the image to reduce noise, then calculates the gradient amplitude and direction of each point in the image, then applies non-maximum suppression (NMS) to refine the edges, and finally uses a double threshold method and edge connection technology to detect and connect edges.

[0092] Step S5: taking the enclosed area of ​​the water body boundary of the current visual image as the water body image of the current visual image.

[0093] Preferably, since the background of the image has been deleted in advance, the shape of the water body can be obtained by deleting the shape of the container and the shape of the sedimentation area.

[0094] Step S6, obtaining the color value of each water body image respectively through the OpenCV software package of Python.

[0095] Preferably, the commonly used models of the OpenCV software package are the RGB (red, green, blue) model and the HSV (hue, saturation, brightness). RGB is widely used in color monitors and color video cameras, and our daily pictures are generally RGB models. The HSV model is more in line with the way people describe and interpret colors, and the color description of HSV is natural and intuitive to people.

[0096] Among them, RGB refers to Red, Green and Blue, and an image is composed of these three channels; Gray is a channel with only grayscale value; HSV refers to Hue (hue), Saturation (saturation) and Value (brightness) channels.

[0097] Among them, the parameters of colors in the HSV model are respectively: hue (H: hue), saturation (S: saturation), and value (V: value), also known as the Hexcone Model; Hue (H: hue): Measured in degrees, the value range is from 0° to 360°, calculated counterclockwise starting from red, with red being 0°, green being 120°, and blue being 240°. Their complementary colors are: yellow is 60°, cyan is 180°, and magenta is 300°; (In OpenCV, the value range of H is from 0 to 180 when stored in 8 bits); Saturation (S: saturation): The value range is from 0.0 to 1.0. The larger the value, the more saturated the color; Value (V: value): The value range is from 0 (black) to 255 (white).

[0098] Furthermore, for RGB to HSV: Let (r, g, b) be the red, green, and blue coordinates of a color respectively, and their values are real numbers between 0 and 1. Let max be equivalent to the maximum of r, g, and b. Let min be equal to the minimum of these values. To find the (h, s, v) values in the HSV space, where h ∈ [0, 360) is the hue angle in degrees, and s, v ∈ [0, 1] are the saturation and value, the calculations are as follows:

[0099] max = max(R, G, B)

[0100] min = min(R, G, B)

[0101] if R = max: H = (G - B) / (max - min)

[0102] if G = max: H = 2 + (B - R) / (max - min)

[0103] if B = max: H = 4 + (R - G) / (max - min)

[0104] H = H * 60

[0105] if H < 0: H = H + 360

[0106] V = max(R, G, B)

[0107] S = (max - min) / max.

[0108] Furthermore, there is a function in OpenCV that can directly convert the RGB model to the HSV model. Note that in OpenCV, H ∈ [0, 180), S ∈ [0, 255], and V ∈ [0, 255]. We know that the H component can basically represent the color of an object, but the values of S and V need to be within a certain range. Since S represents the degree of mixing of the color represented by H and white, that is, the smaller S is, the whiter and lighter the color; V represents the degree of mixing of the color represented by H and black, that is, the smaller V is, the blacker the color. Through experiments, the values for identifying blue are H ranging from 100 to 140, and S and V both ranging from 90 to 255; the values of the basic color H can be set as follows:

[0109] Orange 0-22

[0110] Yellow 22-38

[0111] Green 38-75

[0112] Blue 75-130

[0113] Violet 130-160

[0114] Red 160-179。

[0115] Furthermore, Python implements RGB to be stored in the order of RGB in OpenCV. The data structure is a 3D numpy.array, and the indexing order is row, column, and channel:

[0116] RGBImg = cv2.imread(ImgPath)

[0117] B, G, R = cv2.split(RGBImg).

[0118] It should be noted that the speed of cv2.split is slower than direct indexing, but cv2.split returns a copy, while direct indexing returns a reference (changing B will change RGBImg).

[0119] Convert color space (from RGB to HSV):

[0120] cv2.cvtColor(imgOriginal, imgHSV, COLOR_RGB2HSV)

[0121] HSV = cv2.cvtColor(Img, cv2.COLOR_RGB2HSV)

[0122] H, S, V = cv2.split(HSV).

[0123] Step S7: Use a machine learning machine to learn and train all color values, and predict several future color values of the water body based on several preset prediction steps.

[0124] Preferably, the machine learning machine can select a BP neural network.

[0125] Step S8: Obtain the number of preset prediction steps when the future color value of the water body is less than or equal to a preset color threshold.

[0126] Preferably, since the transparency of the water body can generally reach 90% after the initial sedimentation is completed, the preset color threshold can be set to 10% of the initial RGB value of the visual image.

[0127] Step S9: Obtain the future timestamp corresponding to the number of preset prediction steps, which is the completion time of the sewage treatment of the water body.

[0128] For example, if the number of preset prediction steps when the future color value of the water body is less than or equal to the preset color threshold is 15, and the step size of each preset prediction step is the above-mentioned ten seconds, then the future timestamp is the 150th second in the future.

[0129] Further, in step S9, after obtaining the future timestamp corresponding to the number of preset prediction steps as the completion time of the sewage treatment of the water body, the following steps are further included:

[0130] Step S10: Obtain the planned treatment duration of the water body.

[0131] Step S20: Obtain the sum value of all preset time periods and all preset prediction steps, and define it as the actual treatment duration.

[0132] Step S30: Obtain the magnitude relationship between the actual treatment duration and the planned treatment duration.

[0133] Step S40: If the actual treatment duration is greater than the planned treatment duration, generate a signal to accelerate the treatment progress and send it to the external monitoring end.

[0134] Step S50: If the actual treatment duration is less than or equal to the planned treatment duration, it is determined that the treatment progress is normal.

[0135] Further, in step S4, the water body boundaries of each visual image are extracted respectively by an edge extraction algorithm, which specifically includes the following steps:

[0136] Step S41: Convert each visual image into a grayscale image respectively through the cv2.cvtColor() function of the OpenCV software package.

[0137] Preferably, the first step of boundary extraction is usually edge detection. The edge is where the image brightness changes significantly, and is the dividing line between the object and the background or between different objects. The edge detection algorithm finds the edge by identifying the brightness gradient in the image. Commonly used edge detection operators include Sobel, Prewitt, Roberts and Canny.

[0138] Among them, Sobel operator, Prewitt operator, Roberts operator: The aforementioned operators detect edges by calculating the gradient amplitude of each pixel in the image, and estimate the gradient through filters in the horizontal and vertical directions. Canny edge detector: The Canny algorithm is a more complex edge detection method, which aims to capture the edges in the image as accurately as possible and minimize false detections and missed detections. The Canny detector first uses a Gaussian filter to smooth the image to reduce noise, then calculates the gradient amplitude and direction of each point in the image, then applies non-maximum suppression (NMS) to refine the edges, and finally uses a double threshold method and edge connection technology to detect and connect edges.

[0139] Step S42, obtaining all color block edges of the current grayscale image through the Canny edge detection operator.

[0140] Preferably, the main detection process of the Canny edge detection operator is as follows:

[0141] Noise reduction: First, the original image is Gaussian smoothed to reduce the impact of noise on edge detection. This step is achieved by convolving the original image with a Gaussian smoothing template, and the resulting image will be slightly blurred.

[0142] Calculate gradient: Next, the algorithm calculates the magnitude and direction of the gradient for each point in the image. Edges can be detected in horizontal, vertical, and diagonal directions.

[0143] Non-maximum suppression: In order to refine the edge, the algorithm will perform a non-maximum suppression step, that is, only retain the local maximum value in the gradient direction and remove non-boundary points. This can make the edge more accurate.

[0144] Double threshold screening: Finally, the algorithm uses a double threshold technique to determine the final edge. Two thresholds are set, one is a high threshold and the other is a low threshold. Points above the high threshold are considered strong edges, and points below the low threshold are discarded. Points between the two are considered edges if they are connected to a strong edge, otherwise they are discarded.

[0145] Step S43, defining an erosion structure element of a preset pixel size.

[0146] Preferably, the pixel size of the erosion structuring element can be set according to the resolution of the image data, generally set to 3×3 pixels. One traversal can erode one layer of pixel points. If the resolution is high, the preset pixel size can be selected as odd numbers such as 5×5, 7×7, 9×9, etc.

[0147] Step S44, traverse all the edges of the color blocks with the center of the erosion structuring element.

[0148] Step S45, delete all the paths traversed by the erosion structuring element to obtain the eroded image of the current grayscale image.

[0149] Step S46, perform a difference between the current grayscale image and the current eroded image to obtain the water body boundary.

[0150] Preferably, image difference means subtracting the corresponding pixel values of two images to weaken the similar parts of the images or eliminate the same parts of the images.

[0151] Further, in step S5, take the enclosed area of the water body boundary of the current visual image as the water body image of the current visual image, which specifically includes the following steps:

[0152] Step S51, merge the water body boundary into the current grayscale image to obtain a grayscale image with boundary.

[0153] Step S52, obtain all the closed areas of the current grayscale image with boundary.

[0154] Step S53, obtain the shape of the transparent container based on the preset shooting perspective.

[0155] Step S54, delete the closed areas with the same shape as the shape of the transparent container.

[0156] Step S55, obtain the sedimentation area of the coagulation sediment through the target detection algorithm based on the current visual image.

[0157] Preferably, the recognition of the above shapes can be achieved through target detection algorithms such as VJ, HOG, DPMDetector; deep learning two-stage target detection algorithms such as RCNN, SPPNet, FastRCNN, FasterRCNN; target detection trick algorithms such as FPN, CascadeRCNN; deep learning one-stage target detection algorithms such as Yolo, X, SSD, RetinaNet; deep learning anchor-free target detection algorithms such as CornerNet, CenterNet, FCOS; target detection algorithms based on Transformer such as DETR, etc.

[0158] Further, different target detections are achieved by changing the highest confidence of the detected object.

[0159] For example, the detection steps of the target detection algorithm Yolo are as follows:

[0160] ① Divide the visual image or grayscale image evenly into several square grids.

[0161] ② Define that the transparent container has the highest confidence, and predict several bounding boxes for all transparent containers through all the square grids. Each bounding box includes at least one square grid.

[0162] ③ Obtain the confidence of each bounding box respectively.

[0163] ④ Obtain the bounding box with the largest confidence and mark it as the first-order bounding box.

[0164] Preferably, the intersection over union is the ratio obtained by dividing the intersection of the first-order bounding box and each bounding box by the union of the first-order bounding box and each bounding box (which can be the ratio of areas).

[0165] ⑤ Calculate the intersection over union of the first-order bounding box and each other bounding box respectively.

[0166] ⑥ Select all the bounding boxes with the intersection over union greater than or equal to the preset threshold as the second-order bounding boxes.

[0167] ⑦ Obtain the second-order bounding box with the highest confidence and define it as the detection box of the transparent container.

[0168] Preferably, each grid is used to predict the coordinates, width and height of N first-order bounding boxes, and the confidence of each first-order bounding box, that is, each grid needs to predict N×(4 + 1) values.

[0169] It can be understood that each grid needs to predict N (x, y, w, h, confidence); where (x, y) is the offset of the center of the first-order bounding box relative to the grid, (w, h) is the ratio of the first-order bounding box relative to the adjusted-size picture, and (confidence) is the confidence of the grid, with a value of 1 or 0.

[0170] Preferably, the confidence can be understood as whether there is a target in the current grid and the accuracy of the first-order bounding box.

[0171] For example: Suppose there is a target in an adjusted-size picture, and the width and height of the adjusted-size picture are (w a , h a ), then:

[0172] Divide the picture evenly into 7×7 (S×S) grids. Then there is a grid located at the center of the target. The coordinates of this grid are (x a , y a ). Suppose the coordinates of the center of the target are (xb , y b ), then the above offset can be calculated according to the calculation.

[0173] Preferably, in actual detection, if the predicted first-order bounding box and the actual bounding box perfectly overlap, the value of the intersection over union is 1. In the actual application process, the preset ratio is generally set to 0.5 first to determine whether the predicted second-order bounding box is correct, and the accuracy of the second-order bounding box is positively correlated with the intersection over union.

[0174] Preferably, the YOLO algorithm also needs to train the first-order bounding box to improve the accuracy of object detection.

[0175] Next, the above training model is trained through a preset target training set, and the weights and biases of the training model are adjusted iteratively a certain number of times through the backpropagation algorithm to reduce the value of the loss function of the training model.

[0176] Preferably, the loss function is

[0177] where is an indicator function indicating whether the j-th first-order bounding box of the i-th grid is responsible for the target, taking values of 1 or 0; x i , y i , w i , h i , C i correspond to the (x, y, w, h, confidence) prediction values of the i-th grid respectively.

[0178] It can be understood that the loss function includes the deviation of the coordinate values of the first-order bounding box, the deviation of the confidence, and the deviation of the prediction probability (or class deviation).

[0179] where is the midpoint loss of the first-order bounding box in the coordinate value deviation, is the width and height loss of the first-order bounding box in the coordinate value deviation, is the deviation of the confidence, is the deviation of the prediction probability (or class deviation).

[0180] where λ coord is the localization error penalty. Generally, λ coord = 5; S 2 is the above-mentioned S×S grids; B is the number of first-order bounding boxes; is the estimated value of the midpoint abscissa and ordinate of the i-th first-order bounding box; is the estimated value of the width and height of the i-th first-order bounding box; C iis the confidence of the i-th first-order bounding box; is the estimated value of the confidence of the i-th first-order bounding box; λ noobj is the confidence prediction loss. Generally, λ noobj = 0.5; p i (c) is the class probability of the i-th first-order bounding box; is the estimated value of the class probability of the i-th first-order bounding box; The c in

[0181] It should be noted that since each grid may not necessarily contain a target, if there is no target in the grid, it will cause the value of (confidence) to be 0, resulting in an overly large gradient span in the subsequent backpropagation algorithm. Therefore, λ coord is introduced to control the loss of the predicted position of the first-order bounding box, and λ noobj is introduced to control the loss when there is no target in a single grid.

[0182] It should be noted that the above additional content is only for principle explanation, and the symbolic meanings of the above additional content are not interoperable with the symbolic meanings in other parts of this embodiment.

[0183] Step S56, delete the closed area with the same shape as the settlement area.

[0184] Step S57, define the remaining closed area as the water body image.

[0185] Further, in step S7, all color values are learned and trained by a machine learning machine, and several future color values of the water body are predicted based on several preset prediction steps, which specifically include the following steps:

[0186] Step S71, integrate all pixel color values of a water body image into a pixel color data set.

[0187] Step S72, perform standard normalization processing on all pixel color data sets to obtain a normalized data set based on a pixel color data set.

[0188] Preferably, in this embodiment, a zero-mean normalization (Z-score normalization) method is preferred. This method normalizes data based on the mean and standard deviation of the original data, and the processed data conforms to the standard normal distribution, that is, the mean is 0 and the standard deviation is 1. For the normalization method, batch normalization can also be used in this embodiment. Compared with simple normalization in previous neural network training, only the data of the input layer was normalized, but not in the intermediate layer. Although the dataset of the input nodes was normalized, the data distribution was likely to change greatly after matrix multiplication of the input data, and as the number of network layers in the hidden layer increased, the change in data distribution would become larger and larger. Therefore, batch normalization in the intermediate layer of the neural network makes the training effect better.

[0189] Step S73: Divide the normalized dataset into a training set and a validation set according to a preset ratio.

[0190] Preferably, the preset ratio can be set to 8:2 to divide the data in the normalized dataset into a training set and a sample set at a ratio of 8:2.

[0191] Step S74: Define a neural network model with signal connections between the input layer, hidden layer, and output layer in sequence.

[0192] Preferably, the neural network model is characterized by the following formula:

[0193]

[0194] where y is the neural network model; x n is the nth input node of the input layer, and each input node corresponds to a data in the training set. is the weight from the mth input node of the input layer to the nth input node of the hidden layer; is the bias connected to the nth input node of the hidden layer; is the bias of the output layer; tansig(·) is the activation function; the numbers in the parentheses of the symbol subscript are the layer numbers, the subscript (1) is the first layer, that is, the input layer, and the subscript (1, 2) is from the first layer to the second layer, that is, from the input layer to the hidden layer.

[0195] It should be noted that the above formula and formula symbols are only for principle explanation, and their meanings are not interoperable with those in other positions.

[0196] Step S75: Input all the training sets into the input layer in sequence and perform several trainings through the neural network model.

[0197] Step S76: Obtain the root mean square error of the training results corresponding to the current validation set and the current training set respectively for each training.

[0198] Step S77: Obtain the minimum error among all the root mean square errors.

[0199] Step S78: Obtain the training result corresponding to the minimum error as the water body color value prediction model.

[0200] Step S79: Predict several future water body color values based on several preset prediction steps through the water body color value prediction model.

[0201] Preferably, training a neural network usually requires providing a large amount of data, that is, a data set; the data set is generally divided into three categories, namely the above-mentioned training set, validation set, and test set.

[0202] Among them, one epoch is equal to the process of training once using all the samples in the training set. By training once, it means performing one forward pass and one back pass; when the number of samples in one epoch (i.e., the training set) is too large, training once may consume too much time, and it is not entirely necessary to use all the data in the training set each time. Then, the entire training set needs to be divided into multiple small pieces, that is, divided into multiple batches for training; one epoch consists of one or more batches. A batch is a part of the training set, and only a part of the data, that is, one batch, is used in each training process. The process of training one batch is one iteration.

[0203] Preferably, the neural network training specifically includes a perceptron. The perceptron consists of two layers of neurons. The input layer receives external input signals and then transmits them to the output layer. The output layer is an M-P neuron, and the step function is y j = f(Σ i w i ·x i -θ i ). Here, the step function is for principle explanation and does not communicate with other symbols.

[0204] Preferably, given the training data set, the weights w i (i = 1, 2,..., n) and the training bias θ i can be obtained through learning. θ i can be understood as the weight w corresponding to a fixed value with fixed inputs of -1 and 0 i+1 .

[0205] Preferably, the number of neural network training times in this embodiment can be set to 10,000 times.

[0206] Preferably, the learning rate for the 1st to 5000th epochs can be set to 0.01, the learning rate for the 5001st to 7500th epochs can be set to 0.001, and the learning rate for the 7501st to 10000th epochs can be set to 0.0001.

[0207] It can be understood that the neural network training in this embodiment mainly includes the following ideas:

[0208] ① Initialize the weights and bias terms in the network.

[0209] Initialize the parameter values (the weights and bias terms of the output units, and the weights and bias terms of the hidden units are all parameters of the model), which is to activate the forward propagation, obtain the output values of each layer of elements, and then obtain the value of the loss function.

[0210] ② Activate the forward propagation to obtain the output values of each layer and the expected values of the loss functions of each layer.

[0211] ③ Calculate the error terms of the output units and the error terms of the hidden units according to the loss function.

[0212] Calculate each error, calculate the gradient of the parameter with respect to the loss function or calculate the partial derivative according to the calculus chain rule. For the partial derivative of a vector or matrix in a composite function, the partial derivative of the inner function of the composite function always chooses left multiplication; for the partial derivative of a scalar in a composite function, the partial derivative of the inner function of the composite function can choose either left multiplication or right multiplication.

[0213] ④ Update the weights and bias terms in the neural network.

[0214] ⑤ Repeat ② to ④ until the loss function is less than the preset bias or the number of iterations is used up, and output the parameters at this time as the current optimal parameters.

[0215] Furthermore, in step S9, obtaining the future timestamps corresponding to the preset number of prediction steps is the sewage treatment completion time of the water body. After that, the following steps are further included:

[0216] Step S100, send the sewage treatment completion time to the external monitoring end.

[0217] In this embodiment, equal - volume sampling of the water body with coagulation sedimentation is performed based on each preset time period and placed in a number of transparent containers of the same specification; the transparent containers in the current preset time period are shaken with a preset amplitude and for a preset duration; taking the completion of the sedimentation of the coagulation sediment in the current transparent container as the shooting node, a visual image of the current transparent container is obtained based on a preset shooting perspective; the water - body boundaries of each visual image are extracted respectively through an edge - extraction algorithm; the enclosed area of the water - body boundary of the current visual image is used as the water - body image of the current visual image; the color values of each water - body image are obtained respectively through the OpenCV software package of Python; all the color values are learned and trained through a machine learning algorithm, and several future color values of the water body are predicted based on several preset prediction steps; the number of preset prediction steps when the future color value of the water body is less than or equal to a preset color threshold is obtained; the future timestamp corresponding to the number of preset prediction steps is obtained, which is the sewage treatment completion time of the water body. This embodiment starts from the perspective of computer vision to identify coagulation sedimentation. By constructing several sedimentation visual images based on the same set of sampling operations to complete a series of subsequent feature extraction and analysis operations. At the same time, this embodiment also utilizes the characteristic that the water body in the initial stage of sewage treatment changes from turbid to clear. By learning this characteristic through a machine learning algorithm, the prediction function is realized. Compared with the prior art where the laboratory provides experimental results, this embodiment reflects the linear characteristics of the entire initial treatment stage, making the detection results continuous, and achieving foresight through the prediction function.

[0218] As Figure 2 shown, this embodiment provides an embodiment of a sewage treatment detection system based on coagulation sedimentation. In this embodiment, the sewage treatment detection system is applied to the sewage treatment detection method in the above - mentioned embodiment.

[0219] Specifically, the sewage treatment detection system includes a coagulation - sedimentation water - body extraction module 1, a transparent - container oscillation module 2, a transparent - container visual - image acquisition module 3, a visual - image water - body - boundary extraction module 4, a water - body - image acquisition module 5, a water - body - image color - value acquisition module 6, a water - body - future - color - value prediction module 7, a preset - prediction - step - number acquisition module 8, and a sewage - treatment - completion - time acquisition module 9, which are electrically connected in sequence.

[0220] Among them, the coagulation sedimentation water body extraction module 1 is used to perform equal-volume sampling on the water body with coagulation sedimentation based on each preset time period and place it in a number of transparent containers of the same specification; the transparent container oscillation module 2 is used to oscillate the transparent containers of the current preset time period with a preset amplitude and for a preset duration; the transparent container visual image acquisition module 3 is used to take the completion of the coagulation sedimentation of the current transparent container as the shooting node and acquire the visual image of the current transparent container based on a preset shooting angle; the visual image water body boundary extraction module 4 is used to extract the water body boundaries of each visual image respectively through an edge extraction algorithm; the water body image acquisition module 5 is used to use the enclosed area of the water body boundary of the current visual image as the water body image of the current visual image; the water body image color value acquisition module 6 is used to acquire the color values of each water body image respectively through the OpenCV software package of Python; the water body future color value prediction module 7 is used to learn and train all color values through machine learning and predict a number of water body future color values based on a number of preset prediction steps; the preset prediction step number acquisition module 8 is used to acquire the number of preset prediction steps when the water body future color value is less than or equal to a preset color threshold; the sewage treatment completion time acquisition module 9 is used to acquire the future timestamp corresponding to the number of preset prediction steps, which is the sewage treatment completion time of the water body.

[0221] Furthermore, the sewage treatment detection system further includes a planned processing duration acquisition module, an actual processing duration definition module, a processing duration comparison module, a processing progress acceleration signal generation and sending module, and a processing progress normal determination module that are electrically connected in sequence; the planned processing duration acquisition module is electrically connected to the sewage treatment completion time acquisition module 9.

[0222] Among them, the planned processing duration acquisition module is used to acquire the planned processing duration of the water body; the actual processing duration definition module is used to acquire the sum value of all preset time periods and all preset prediction steps and define it as the actual processing duration; the processing duration comparison module is used to acquire the magnitude relationship between the actual processing duration and the planned processing duration; the processing progress acceleration signal generation and sending module is used to generate a processing progress acceleration signal and send it to an external monitoring end if the actual processing duration is greater than the planned processing duration; the processing progress normal determination module is used to determine that the processing progress is normal if the actual processing duration is less than or equal to the planned processing duration.

[0223] Further, the visual image water body boundary extraction module 4 specifically includes a first visual image water body boundary extraction unit, a second visual image water body boundary extraction unit, a third visual image water body boundary extraction unit, a fourth visual image water body boundary extraction unit, a fifth visual image water body boundary extraction unit, and a sixth visual image water body boundary extraction unit that are electrically connected in sequence; the first visual image water body boundary extraction unit is electrically connected to the transparent container visual image acquisition module 3, and the sixth visual image water body boundary extraction unit is electrically connected to the water body image acquisition module 5.

[0224] Among them, the first visual image water body boundary extraction unit is used to convert each visual image into a grayscale image respectively through the cv2.cvtColor() function of the OpenCV software package; the second visual image water body boundary extraction unit is used to obtain all the color block edges of the current grayscale image through the Canny edge detection operator; the third visual image water body boundary extraction unit is used to define an erosion structuring element with a preset pixel size; the fourth visual image water body boundary extraction unit is used to traverse all the color block edges with the center of the erosion structuring element; the fifth visual image water body boundary extraction unit is used to delete all the paths traversed by the erosion structuring element to obtain the erosion image of the current grayscale image; the sixth visual image water body boundary extraction unit is used to differentiate the current grayscale image and the current erosion image to obtain the water body boundary.

[0225] Further, the water body image acquisition module 5 specifically includes a first water body image acquisition unit, a second water body image acquisition unit, a third water body image acquisition unit, a fourth water body image acquisition unit, a fifth water body image acquisition unit, a sixth water body image acquisition unit, and a seventh water body image acquisition unit that are electrically connected in sequence; the first water body image acquisition unit is electrically connected to the sixth visual image water body boundary extraction unit, and the seventh water body image acquisition unit is electrically connected to the water body image color value acquisition module 6.

[0226] Among them, the first water body image acquisition unit is used to merge the water body boundary into the current grayscale image to obtain a grayscale image with a boundary; the second water body image acquisition unit is used to obtain all the closed regions of the current grayscale image with a boundary; the third water body image acquisition unit is used to obtain the shape of the transparent container based on a preset shooting angle; the fourth water body image acquisition unit is used to delete the closed regions with the same shape as the shape of the transparent container; the fifth water body image acquisition unit is used to obtain the sedimentation region of coagulation sedimentation through a target detection algorithm based on the current visual image; the sixth water body image acquisition unit is used to delete the closed regions with the same shape as the sedimentation region; the seventh water body image acquisition unit is used to define the remaining closed regions as the water body image.

[0227] Furthermore, the future water body color value prediction module 7 specifically includes a first future water body color value prediction unit, a second future water body color value prediction unit, a third future water body color value prediction unit, a fourth future water body color value prediction unit, a fifth future water body color value prediction unit, a sixth future water body color value prediction unit, a seventh future water body color value prediction unit, an eighth future water body color value prediction unit, and a ninth future water body color value prediction unit, which are electrically connected in sequence; the first future water body color value prediction unit is electrically connected to the water body image color value acquisition module 6, and the ninth future water body color value prediction unit is electrically connected to the preset prediction step number acquisition module 8.

[0228] Among them, the first future water body color value prediction unit is used to integrate all pixel color values of a water body image into a pixel color data set; the second future water body color value prediction unit is used to perform standard normalization processing on all pixel color data sets to obtain a normalized data set based on a pixel color data set; the third future water body color value prediction unit is used to divide the normalized data set into a training set and a validation set according to a preset ratio; the fourth future water body color value prediction unit is used to define a neural network model with signal connections between the input layer, the hidden layer, and the output layer in sequence; the fifth future water body color value prediction unit is used to input all training sets into the input layer in sequence and perform several trainings through the neural network model; the sixth future water body color value prediction unit is used to obtain the root mean square error of the training results corresponding to the current validation set and the current training set respectively based on each training; the seventh future water body color value prediction unit is used to obtain the minimum error among all root mean square errors; the eighth future water body color value prediction unit is used to obtain the training result corresponding to the minimum error as the water body color value prediction model; the ninth future water body color value prediction unit is used to predict several future water body color values based on several preset prediction steps through the water body color value prediction model.

[0229] Furthermore, the sewage treatment detection system further includes a sewage treatment completion time sending module electrically connected to the sewage treatment completion time acquisition module 9, and this module is used to send the sewage treatment completion time to an external monitoring terminal.

[0230] It should be noted that this embodiment is a functional module embodiment based on the above method embodiment. For the preferred, extended, limited, exemplified, and principle description parts of this embodiment, please refer to the above embodiment, and this embodiment will not be elaborated here.

[0231] In this embodiment, equal-volume sampling of the water body with coagulation sedimentation is performed based on each preset time period and placed in a number of transparent containers of the same specification; the transparent containers in the current preset time period are shaken with a preset amplitude and for a preset duration; taking the completion of the sedimentation of the coagulation sediment in the current transparent container as the shooting node, a visual image of the current transparent container is obtained based on a preset shooting angle; the water body boundaries of each visual image are extracted respectively through an edge extraction algorithm; the enclosed area of the water body boundary of the current visual image is used as the water body image of the current visual image; the color values of each water body image are obtained respectively through the OpenCV software package of Python; all color values are learned and trained through a machine learning algorithm, and a number of future color values of the water body are predicted based on a number of preset prediction steps; the number of preset prediction steps when the future color value of the water body is less than or equal to a preset color threshold is obtained; the future timestamp corresponding to the number of preset prediction steps is obtained, which is the sewage treatment completion time of the water body. This embodiment starts from the perspective of computer vision recognition of coagulation sedimentation, constructs a number of sedimentation visual images based on the same set of sampling operations to complete a series of subsequent feature extraction and analysis operations. At the same time, this embodiment also utilizes the characteristic that the water body in the initial stage of sewage treatment changes from turbid to clear, and realizes the prediction function by learning this characteristic through a machine learning algorithm. Compared with the experimental results provided by the prior art laboratory, this embodiment reflects the linear characteristics of the entire initial treatment stage, making the detection results continuous, and realizes the forward-looking through the prediction function.

[0232] Figure 3 An embodiment of the electronic device of the present application is shown. Refer to Figure 3 , the electronic device 10 includes a processor 101 and a memory 102 coupled to the processor 101.

[0233] The memory 102 stores program instructions for implementing the sewage treatment detection method based on coagulation sedimentation in any of the above embodiments.

[0234] The processor 101 is configured to execute the program instructions stored in the memory 102 to perform sewage treatment detection based on coagulation sedimentation.

[0235] Among them, the processor 101 can also be called a CPU (Central Processing Unit, central processing unit). The processor 101 may be an integrated circuit chip with signal processing capabilities. The processor 101 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0236] Further,Figure 4 The following is a schematic structural diagram of a storage medium according to an embodiment of the present application. Refer to Figure 4 The storage medium 11 of the embodiment of the present application stores program instructions 111 that can implement all the above methods. Among them, the program instructions 111 can be stored in the above storage medium in the form of a software product, including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media that can store program codes such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, or a terminal device such as a computer, a server, a mobile phone, or a tablet.

[0237] In several embodiments provided by the present application, it should be understood that the disclosed systems, systems, and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of systems or units can be in electrical, mechanical, or other forms.

[0238] In addition, the functional units in various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. The above is only the embodiment of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the specification and drawings of the present application, or directly or indirectly applied to other related technical fields, is equally included in the patent protection scope of the present application.

[0239] The specific embodiments of the present application have been described in detail above, but it is only an example, and the present application is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modification or substitution of the invention is also within the scope of the present application. Therefore, all equal transformations, modifications, and improvements made without departing from the spirit and principles of the present application should be covered by the scope of the present application.

Claims

1. A sewage treatment detection method based on coagulation and sedimentation, the sewage treatment detection method is applied to water bodies with coagulation and sedimentation, characterized in that: The sewage treatment detection method comprises: Step S1, sampling the water body with the coagulation precipitation in equal volumes based on each preset time period and placing the samples in a plurality of transparent containers of the same specifications; Step S2, oscillating the transparent container in the current preset time period with a preset amplitude and a preset duration; Step S3, taking the completion of coagulation and sedimentation of the current transparent container as the shooting node, and acquiring a visual image of the current transparent container based on a preset shooting angle; Step S4, extracting the water body boundary of each visual image by edge extraction algorithm; Step S5, taking the enclosed area of ​​the water body boundary of the current visual image as the water body image of the current visual image; Step S6, obtaining the color value of each water body image respectively through the OpenCV software package of Python; Step S7, learning and training all color values ​​through a machine learning machine, and predicting a number of future color values ​​of the water body based on a number of preset prediction steps; Step S8, obtaining a preset number of prediction steps when the future color value of the water body is less than or equal to a preset color threshold; Step S9, obtaining a future timestamp corresponding to a preset number of prediction steps, which is the completion time of sewage treatment of the water body.

2. The sewage treatment detection method according to claim 1, characterized in that: Step S9, obtaining a future timestamp corresponding to a preset number of prediction steps, which is the completion time of sewage treatment of the water body, and then comprising: Step S10, obtaining the planned treatment time of the water body; Step S20, obtaining the sum of all preset time periods and all preset prediction steps, and defining it as the actual processing time; Step S30, obtaining the relationship between the actual processing time and the planned processing time; Step S40, if the actual processing time is longer than the planned processing time, a processing progress acceleration signal is generated and sent to an external monitoring terminal; Step S50: If the actual processing time is less than or equal to the planned processing time, it is determined that the processing progress is normal.

3. The sewage treatment detection method according to claim 1, characterized in that: Step S4, extracting the water body boundary of each visual image by edge extraction algorithm, including: Step S41, converting each visual image into a grayscale image by using the cv2.cvtColor() function of the OpenCV software package; Step S42, obtaining all color block edges of the current grayscale image through the Canny edge detection operator; Step S43, defining an erosion structure element of a preset pixel size; Step S44, traversing all color block edges with the center of the erosion structure element; Step S45, deleting all paths traversed by the eroded structure element to obtain an eroded image of the current grayscale image; Step S46, differentiating the current grayscale image and the current erosion image to obtain the water body boundary.

4. The sewage treatment detection method according to claim 2, characterized in that: Step S5, taking the enclosed area of ​​the water body boundary of the current visual image as the water body image of the current visual image, including: Step S51, merging the water body boundary into the current grayscale image to obtain a grayscale image with boundary; Step S52, obtaining all closed areas of the current grayscale image with boundaries; Step S53, obtaining the shape of the transparent container based on the preset shooting angle; Step S54, deleting the closed area having the same shape as the transparent container; Step S55, obtaining the sedimentation area of ​​the coagulation sedimentation through a target detection algorithm based on the current visual image; Step S56, deleting the closed area with the same shape as the settlement area; Step S57, defining the retained closed area as the water body image.

5. The sewage treatment detection method according to claim 1, characterized in that: Step S7, learning and training all color values ​​through a machine learning machine, and predicting several future color values ​​of water bodies based on several preset prediction steps, including: Step S71, integrating all pixel color values ​​of a water body image into a pixel color data set; Step S72, performing standard normalization processing on all pixel color data sets, and obtaining a normalized data set based on one pixel color data set; Step S73, dividing the normalized data set into a training set and a validation set according to a preset ratio; Step S74, defining a neural network model in which the input layer, the hidden layer, and the output layer are sequentially connected; Step S75, inputting all training sets into the input layer in sequence, and performing several trainings through the neural network model; Step S76, obtaining a root mean square error of the training results corresponding to the current validation set and the current training set based on each training; Step S77, obtaining the minimum error value among all root mean square errors; Step S78, obtaining a training result corresponding to the minimum error value as a water body color value prediction model; Step S79, predicting several future color values ​​of the water body based on several preset prediction steps through the water body color value prediction model.

6. The sewage treatment detection method according to claim 1, characterized in that: Step S9, obtaining a future timestamp corresponding to a preset number of prediction steps, which is the completion time of sewage treatment of the water body, and then comprising: Step S100, sending the sewage treatment completion time to an external monitoring terminal.

7. A sewage treatment detection system based on coagulation and sedimentation, the sewage treatment detection system is applied to the sewage treatment detection method according to any one of claims 1 to 6, characterized in that: The sewage treatment detection system comprises: A coagulation sedimentation water extraction module is used to sample equal volumes of the water body with the coagulation sedimentation based on each preset time period and place the samples in a number of transparent containers of the same specifications; A transparent container oscillation module, used to oscillate the transparent container with a preset amplitude and a preset duration in a current preset time period; A transparent container visual image acquisition module is used to acquire a visual image of the current transparent container based on a preset shooting angle, taking the completion of coagulation and sedimentation of the current transparent container as a shooting node; A visual image water body boundary extraction module is used to extract the water body boundary of each visual image by using an edge extraction algorithm; A water body image acquisition module, used for taking the enclosed area of ​​the water body boundary of the current visual image as the water body image of the current visual image; The water body image color value acquisition module is used to obtain the color value of each water body image through Python's OpenCV software package; A water body future color value prediction module, used to learn and train all color values ​​through a machine learning machine, and predict several future color values ​​of water bodies based on several preset prediction steps; A preset prediction step number acquisition module is used to obtain the preset prediction step number when the future color value of the water body is less than or equal to a preset color threshold; The sewage treatment completion time acquisition module is used to obtain a future timestamp corresponding to a preset number of prediction steps, which is the sewage treatment completion time of the water body.

8. An electronic device, characterized in that: It includes a processor and a memory coupled to the processor, wherein the memory stores program instructions that can be executed by the processor; when the processor executes the program instructions stored in the memory, the sewage treatment detection method as described in any one of claims 1 to 6 is implemented.

9. A storage medium, characterized in that: The storage medium stores program instructions, and when the program instructions are executed by the processor, the sewage treatment detection method according to any one of claims 1 to 6 can be implemented.