Flocculant addition analysis method and device
Predicting flocculant demand status through video analysis and machine learning solves the problem of inaccurate control of traditional flocculant dosage and improves the overall efficiency and economy of sewage treatment.
Patent Information
- Application Number
- CN202410771807.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-15
- Publication Date
- 2024-09-03
AI Technical Summary
The traditional flocculant dosing control method relies on manual experience and regular sampling and analysis, and cannot accurately grasp the flocculant dosage, resulting in inaccurate dosing and affecting sewage treatment effects and operating costs.
By acquiring video images of the sewage treatment process, we perform edge recognition and feature extraction, and use machine learning models to predict the flocculant demand status and accurately determine the amount of flocculant additives.
It achieves precise dosing of flocculant, improves the efficiency and economy of sewage treatment, and reduces the deviation of human subjective judgment and waste of resources.
Smart Images

Figure CN118587632A
Abstract
Description
Technical Field
[0001] The present application relates to the field of water treatment, and in particular to a flocculant addition analysis method and device. Background Art
[0002] Sewage treatment is an important part of environmental protection and resource utilization. Flocculants play a key role in the sewage treatment process. They can promote the flocculation of suspended particles, thereby improving the solid-liquid separation efficiency. Reasonable control of the dosage of flocculants is crucial to ensure treatment effects and reduce operating costs. The traditional flocculant addition control method mainly relies on manual experience and regular sampling and analysis. The operator judges the flocculation state based on visual observation and experience, and adjusts the flocculant dosage accordingly. Sewage treatment is an important part of environmental protection and resource utilization. Flocculants play a key role in the sewage treatment process. They can promote the flocculation of suspended particles, thereby improving the solid-liquid separation efficiency. Reasonable control of the dosage of flocculants is crucial to ensure treatment effects and reduce operating costs. The traditional flocculant addition control method mainly relies on manual experience and regular sampling and analysis. The operator judges the flocculation state based on visual observation and experience, and adjusts the flocculant dosage accordingly. This method cannot accurately grasp the flocculant addition dosage. Summary of the invention
[0003] The present application provides a flocculant addition analysis method and device, which improves the accuracy level of flocculant addition, thereby improving the overall efficiency and economy of sewage treatment.
[0004] In a first aspect, the present application provides a flocculant addition analysis method, comprising: Obtain video images of the sewage treatment process, and mark each frame in the video images according to the time sequence to obtain a sewage image set with time marks; Perform edge recognition on each sewage image in the sewage image set to obtain an edge image set, and perform flocculation state analysis based on the edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set; Sort the flocculant demand states corresponding to the edge images according to the time stamps to obtain a flocculant demand state set; Extracting features of the flocculant demand states in the flocculant demand state set to obtain flocculation feature values sorted by time tags, and inputting the flocculation feature values into a preset prediction model to obtain a predicted flocculant demand state; Determine the actual amount of flocculant added based on the predicted flocculant demand status.
[0005] By adopting the above technical solution, by acquiring the video images of the sewage treatment process, marking each frame in time sequence to form a sewage image set with time mark, then edge recognition is performed on the sewage image to obtain an edge image set, and flocculation state analysis is performed based on the edge image set to determine the flocculant demand state corresponding to each edge image. The demand state is sorted by time to obtain a demand state set, and feature extraction is performed on the demand state set to obtain flocculation feature values sorted by time. These feature values are input into a preset prediction model to obtain the predicted flocculant demand state. According to the predicted demand state, the actual flocculant dosage to be added can be accurately determined through the preset demand state and dosage correspondence model.
[0006] This method based on video analysis and machine learning can monitor the dynamic changes of the flocculation process in real time and grasp the actual demand for flocculants, thereby improving the accuracy of dosage. Compared with the traditional subjective judgment and experience-based methods, it avoids the deviation of human subjective judgment, reduces the waste caused by excessive or insufficient dosage, significantly improves the accuracy of flocculant addition, and thus improves the overall efficiency and economy of sewage treatment.
[0007] Optionally, edge recognition is performed on each sewage image in the sewage image set to obtain an edge image set, including: The images in the sewage image set are subjected to denoising and smoothing processing by a Gaussian filter with a Gaussian convolution kernel of 5x5 parameters to obtain a first sewage image set; The gradient magnitude and gradient direction of each pixel point of each image in the first sewage image set are calculated based on the Canny edge detection algorithm to obtain the gradient value and gradient direction of the pixel point of each image in the first sewage image set; Based on the Canny edge detection algorithm, non-maximum suppression is performed on the gradient value of each pixel point of each image in the first sewage image set, and a second sewage image set after non-maximum suppression is output; Based on the Canny edge detection algorithm, double threshold detection is performed on the images in the second sewage image set to obtain image edge data; Based on the image edge detection data, boundary tracing processing is performed on the images in the second sewage image set to obtain an edge image set.
[0008] By adopting the above technical solution, the classic Canny edge detection algorithm is used to identify the edge of each sewage image in the sewage image set to obtain an edge image set. First, the images in the sewage image set are subjected to denoising and smoothing processing by a Gaussian filter with a 5x5 Gaussian convolution kernel to obtain the first sewage image set. Gaussian filtering can effectively eliminate image noise, smooth the image, prepare for subsequent edge detection, and ensure the quality of the input image. Next, the gradient amplitude and gradient direction of each pixel point of each image in the first sewage image set are calculated based on the Canny algorithm to obtain the pixel point gradient value and gradient direction. The gradient amplitude reflects the strength of the edge, and the gradient direction reflects the orientation of the edge, which lays the foundation for subsequent non-maximum suppression and dual threshold detection. Then, based on the Canny algorithm, the gradient value of each pixel point of each image in the first sewage image set is non-maximum suppressed, and the second sewage image set after non-maximum suppression is output. Non-maximum suppression can eliminate the influence of edge blur and breakage, and improve the clarity and continuity of the edge. Next, based on the Canny algorithm, the images in the second sewage image set are subjected to dual threshold detection to obtain image edge data. Double threshold detection can effectively eliminate isolated noise responses in the edge, further improving the reliability of edge detection. Finally, the images in the second sewage image set are processed by boundary tracing based on the image edge detection data to obtain an edge image set. Boundary tracing can connect broken edges into complete edges, supplement the possible edge loss after double threshold detection, and ensure the integrity and continuity of the final edge image set.
[0009] Through the above series of strict processing steps, this implementation method fully utilizes the advantages of the Canny algorithm, including Gaussian smoothing, gradient calculation, non-maximum suppression, dual threshold detection and boundary tracking, and can reliably and accurately extract clear, continuous and complete edge information from sewage images, laying a solid foundation for subsequent flocculation state analysis. The algorithm has stable performance and strong anti-noise ability, thus ensuring the accuracy and reliability of edge recognition and providing reliable data support for achieving high-precision control.
[0010] Optionally, performing flocculation state analysis based on edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set includes: According to the values of the three channels R, G, and B corresponding to each pixel point in the edge image in the edge image set, the transmittance of the edge image in the edge image set is obtained, and according to the transmittance of the edge image in the edge image set, the connection discreteness of the edge image in the edge image set is obtained; Performing corner point detection on the edge of the edge image in the edge image set to obtain each corner point corresponding to the edge image in the edge image set, and obtaining the filamentary edge uniformity and filamentary edge compactness corresponding to the edge image in the edge image set according to each corner point corresponding to the edge image in the edge image set; According to the filamentary edge uniformity, filamentary edge compactness and connection dispersion, the flocculant demand state corresponding to the edge image in the edge image set is obtained.
[0011] By adopting the above technical solution, based on the obtained edge image set, by analyzing the transmittance of the edge image, the distribution of edge corner points, the filamentous edge characteristics and other dimensional information, the flocculant demand state corresponding to each edge image is comprehensively determined.
[0012] First, the transmittance of the edge image is calculated based on the values of the three channels R, G, and B corresponding to each pixel in the edge image. Transmittance can reflect the concentration of suspended particles in sewage, thereby indirectly reflecting the flocculation state. Then, based on the transmittance, the connection discreteness of the edge image is further obtained, and the connection discreteness characterizes the degree of flocculation aggregation of suspended particles. At the same time, the corner point detection is performed on the edge of the edge image to obtain the information of each corner point. According to the distribution of corner points, two indicators, namely, filamentary edge uniformity and filamentary edge compactness, can be calculated. The filamentary edge uniformity reflects the uniformity of the morphology of the flocculants, and the filamentary edge compactness reflects the compactness of the flocculants. Through the above three-dimensional information: connection discreteness, filamentary edge uniformity, and filamentary edge compactness, the flocculation state can be comprehensively evaluated, and the actual flocculant demand state corresponding to each edge image can be determined accordingly. This analysis method combining multi-dimensional information can comprehensively and meticulously characterize the dynamic changes of the flocculation process and evaluate the flocculation state. It avoids the one-sidedness of single-dimensional analysis and improves the accuracy and reliability of state evaluation. At the same time, through automated image analysis, the defects of traditional subjective judgment are eliminated, human interference is reduced, and the objectivity and consistency of analysis are improved.
[0013] Optionally, obtaining the transmittance of the edge image in the edge image set according to the values of the three channels R, G, and B corresponding to each pixel point in the edge image in the edge image set includes: Substitute the values of the three channels R, G, and B corresponding to each pixel in the edge image in the edge image set into the transmittance formula to calculate the transmittance value of the corresponding pixel, and determine the transmittance of the edge image in the edge image set according to the transmittance value of the pixel. The transmittance formula is: Transmittance = (0.299R + 0.587G + 0.114*B) / 255 In the formula, R represents the red channel value of the pixel, G represents the green channel value of the pixel, and B represents the blue channel value of the pixel.
[0014] By adopting the above technical solution, the transmittance information of the edge image can be accurately and effectively obtained by calculating the transmittance formula based on the RGB three-color channel values.
[0015] Specifically, for each edge image in the edge image set, first take out the values of the three channels R (red), G (green), and B (blue) corresponding to each pixel in the image. Then, substitute these RGB values into the given transmittance formula for calculation to obtain the transmittance value of the pixel. The transmittance formula comprehensively considers the weighted contribution of the three RGB channels, where the red channel weight is 0.299, the green channel weight is 0.587, the blue channel weight is 0.114, and the sum of the weights is 1. This weighting method can more accurately reflect the human eye's perception of brightness.
[0016] After calculating the transmittance values of all pixels, the overall transmittance of the edge image can be determined by certain statistical methods (such as taking the average value, etc.). Transmittance can well reflect the concentration of suspended particles in sewage. When the transmittance value is high, it means that the suspended concentration is low and the flocculation effect is good; conversely, when the transmittance value is low, it means that the suspended concentration is high and the flocculation effect is poor. Therefore, the flocculation state can be evaluated based on transmittance.
[0017] By using the RGB three-color channel values to calculate transmittance, we can avoid the one-sidedness of traditional subjective judgment and improve the objectivity and accuracy of flocculation state analysis. At the same time, this meticulous calculation based on pixel level can make full use of image information, reflect subtle changes in flocculation state, and provide accurate data support for flocculant addition.
[0018] Optionally, obtaining the connection discreteness of the edge images in the edge image set according to the transmittance of the edge images in the edge image set includes: Compare the transmittance of the edge image in the edge image set with the preset transmittance threshold. If the transmittance of the edge image is greater than the preset transmittance threshold, it means that the edge image is more transparent and the flocculation effect is poor, which is recorded as a discrete state. If the transmittance of the edge image is less than the preset transmittance threshold, it means that the edge image is more turbid and the flocculation effect is better, which is recorded as a connected state. The duration of continuous connection states and the duration of discrete states in the edge images in the edge image set are counted, and the connection dispersion of the edge images in the edge image set is calculated according to the duration of the connection states and the duration of the discrete states.
[0019] By adopting the above technical solution, the previously obtained edge image transmittance is compared with the preset transmittance threshold, and the flocculation state of the edge image is classified, thereby obtaining the important indicator of connection discreteness, which can comprehensively evaluate the flocculation process.
[0020] Specifically, first compare the transmittance of each edge image with the preset transmittance threshold. If the transmittance of the edge image is greater than the threshold, it means that the image is more transparent, there are fewer suspended particles, and the flocculation effect is poor, which is recorded as a discrete state. On the contrary, if the transmittance is less than the threshold, it means that the image is more turbid, there are more suspended particles, and the flocculation effect is better, which is recorded as a connected state. Next, the duration of the continuous connected state and discrete state in the edge image set is counted separately. A longer duration of the connected state means that the flocculation effect continues to be good; a longer duration of the discrete state means that the flocculation effect continues to be poor. Based on the time ratio relationship between the two, the overall connected discreteness of the edge image set can be calculated.
[0021] The contact dispersion can reflect the flocculation state of suspended particles. A higher contact dispersion value indicates a better flocculation effect and a more compact flocculant; a lower contact dispersion value indicates a poor flocculation effect and a loosely dispersed flocculant.
[0022] This method of first binarizing the flocculation state according to the transmittance threshold, then counting the state duration, and finally calculating the connection discreteness can quantitatively describe the dynamic changes of the flocculation process, avoid the limitations of single time point analysis, and improve the robustness and robustness of the analysis.
[0023] Optionally, obtaining the flocculant demand state corresponding to the edge image in the edge image set according to the filament edge uniformity, the filament edge compactness and the connection discreteness includes: The filament edge uniformity, filament edge compactness and connection dispersion are input into a preset state determination model, and the flocculant demand state corresponding to the edge image in the edge image set is output.
[0024] By adopting the above technical solution, the three key indicators of filament edge uniformity, filament edge tightness and connection discreteness obtained previously are taken as input and input into the preset state judgment model, and the corresponding flocculant demand state can be output, thereby realizing the intelligent evaluation of the flocculation state.
[0025] First, the filament edge uniformity and filament edge compactness can reflect the subtle characteristics of the floc morphology. A high filament edge uniformity indicates that the flocs are uniform in shape; a high filament edge compactness indicates that the flocs are dense in structure. These two indicators can describe the flocculation state from the perspective of floc morphology. At the same time, the connection dispersion can describe the overall situation of the flocculation state from the macroscopic perspective of the aggregation degree of suspended particles. A high connection dispersion indicates a good flocculation effect; a low connection dispersion indicates a poor flocculation effect.
[0026] The above three indicators comprehensively depict different aspects of the flocculation state from the two levels of microscopic morphology and macroscopic aggregation, complement each other, and have good comprehensiveness. After the three comprehensive indicators are input into the preset state judgment model together, the model can intelligently output the current flocculant demand state based on these feature information and the judgment logic obtained through training. This demand state not only reflects the general situation of whether flocculants need to be added, but also further quantifies the degree of demand, providing a basis for accurate control of the dosage. Compared with manual subjective judgment, this model method overcomes subjective arbitrariness and improves the consistency and repeatability of state assessment. At the same time, the model can efficiently process multiple input features, avoid the limitations of single analysis, and improve the accuracy and reliability of state judgment.
[0027] Optionally, the actual amount of flocculant to be added is determined based on the predicted flocculant demand state, including: The predicted flocculant demand state is input into a preset corresponding relationship model between the flocculant demand state and the dosage to obtain the actual flocculant addition dosage.
[0028] By adopting the above technical means, the predicted flocculant demand state obtained in the previous step is input into the pre-established demand state and dosage correspondence model, which can intelligently output the actual amount of flocculant currently required, laying the foundation for accurate control of flocculant dosage. The current flocculant demand state has been evaluated by analyzing image features through machine learning models. The demand state not only includes general information on whether it is necessary to add, but also quantifies the subtle differences in the degree of demand. And it is this subtle difference that will directly affect the actual amount of flocculant that needs to be added.
[0029] In order to accurately convert the demand state into the guidance value of the dosage, it is necessary to build a mapping relationship model between the demand state and the dosage. The model can be trained based on historical data through a machine learning algorithm. The input of the model is the demand state, and the output is the corresponding recommended dosage.
[0030] In actual application, the currently assessed demand status is input into the mapping model. The model can then intelligently output the specific value of the actual amount of flocculant currently required based on the trained mapping rules, providing an accurate basis for subsequent precise addition.
[0031] Compared with traditional empirical control, this intelligent control method using two cascaded models overcomes the arbitrariness of subjective judgment and improves the consistency and repeatability of control. At the same time, the model can automatically process multi-dimensional features and combine historical data, avoiding the limitations of single analysis and greatly improving the accuracy and reliability of control.
[0032] Through intelligent and precise control, the dosage of flocculant can be reasonably adjusted according to real-time status changes to avoid waste caused by excessive dosage and to avoid the impact of insufficient dosage on the treatment effect. This precise and efficient dosing control can optimize the flocculation process, maximize the role of flocculants, improve sewage treatment efficiency, save operating costs, and has significant economic and environmental value.
[0033] In a second aspect of the present application, a flocculant addition analysis device is provided, comprising: The data acquisition module is used to acquire video images of the sewage treatment process and mark each frame in the video images according to the time sequence to obtain a sewage image set with time marks; An edge recognition module is used to perform edge recognition on each sewage image in the sewage image set to obtain an edge image set, and perform flocculation state analysis based on the edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set; A flocculant demand state set generation module is used to sort the flocculant demand states corresponding to each edge image according to the time mark to obtain a flocculant demand state set; A prediction module is used to extract features of the flocculant demand states in the flocculant demand state set to obtain flocculation feature values sorted by time tags, and input the flocculation feature values into a preset prediction model to obtain a predicted flocculant demand state; The dosage determination module is used to determine the actual dosage of the flocculant according to the predicted flocculant demand state.
[0034] In a third aspect of the present application, a computer storage medium is provided, wherein the computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above method steps.
[0035] In the fourth aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the above method.
[0036] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. This application obtains video images of the sewage treatment process, marks each frame in time sequence to form a sewage image set with time mark, then performs edge recognition on the sewage image to obtain an edge image set, and performs flocculation state analysis based on the edge image set to determine the flocculant demand state corresponding to each edge image. The demand state is sorted by time to obtain a demand state set, and feature extraction is performed on the demand state set to obtain flocculation feature values sorted by time. These feature values are input into a preset prediction model to obtain a predicted flocculant demand state. According to the predicted demand state, the actual flocculant dosage that needs to be added can be accurately determined through the preset demand state and dosage correspondence model.
[0037] This method based on video analysis and machine learning can monitor the dynamic changes of the flocculation process in real time and grasp the actual demand for flocculants, thereby improving the accuracy of dosage. Compared with the traditional subjective judgment and experience-based methods, it avoids the deviation of human subjective judgment, reduces the waste caused by excessive or insufficient dosage, significantly improves the accuracy of flocculant addition, and thus improves the overall efficiency and economy of sewage treatment.
[0038] 2. This application is based on the obtained edge image set, and comprehensively determines the flocculant demand state corresponding to each edge image by analyzing multiple dimensions of information such as the transmittance of the edge image, the distribution of edge corner points, and the filamentous edge characteristics.
[0039] First, the transmittance of the edge image is calculated based on the values of the three channels R, G, and B corresponding to each pixel in the edge image. Transmittance can reflect the concentration of suspended particles in sewage, thereby indirectly reflecting the flocculation state. Then, based on the transmittance, the connection discreteness of the edge image is further obtained, and the connection discreteness characterizes the degree of flocculation aggregation of suspended particles. At the same time, the corner point detection is performed on the edge of the edge image to obtain the information of each corner point. According to the distribution of corner points, two indicators, namely, filamentary edge uniformity and filamentary edge compactness, can be calculated. The filamentary edge uniformity reflects the uniformity of the morphology of the flocculants, and the filamentary edge compactness reflects the compactness of the flocculants. Through the above three-dimensional information: connection discreteness, filamentary edge uniformity, and filamentary edge compactness, the flocculation state can be comprehensively evaluated, and the actual flocculant demand state corresponding to each edge image can be determined accordingly. This analysis method combining multi-dimensional information can comprehensively and meticulously characterize the dynamic changes of the flocculation process and evaluate the flocculation state. It avoids the one-sidedness of single-dimensional analysis and improves the accuracy and reliability of state evaluation. At the same time, through automated image analysis, the defects of traditional subjective judgment are eliminated, human interference is reduced, and the objectivity and consistency of analysis are improved.
[0040] 3. This application uses the three key indicators of filament edge uniformity, filament edge tightness and connection dispersion obtained previously as input, and inputs a preset state judgment model to output the corresponding flocculant demand state, thereby realizing intelligent evaluation of the flocculation state. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A schematic diagram of a flocculant addition analysis method provided in an embodiment of the present application; Figure 2 This is a structural diagram of a flocculant addition analysis device provided in an embodiment of the present application; Figure 3 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0042] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0043] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being better or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.
[0044] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0045] In order to facilitate the understanding of the method and system provided in the embodiments of the present application, the background of the embodiments of the present application is first introduced before introducing the embodiments of the present application. Wastewater treatment is an important part of environmental protection and resource utilization. Flocculants play a key role in the sewage treatment process. They can promote the flocculation and aggregation of suspended particles, thereby significantly improving the solid-liquid separation efficiency and ensuring that the effluent water quality meets the standards. Reasonable control of the dosage of flocculants is of great significance for achieving ideal treatment effects and reducing operating costs.
[0046] The traditional flocculant dosing control method mainly relies on manual experience and regular sampling and analysis. The operator visually observes the flocculation state of the sewage, makes subjective judgments based on years of accumulated experience, and adjusts the flocculant dosage accordingly based on the judgment results. However, this method that relies entirely on manual work has many defects: First, visual observation is highly subjective and arbitrary. Different operators may have large differences in their judgments on the same flocculation status, lacking consistency and repeatability. Secondly, it is difficult to accurately grasp the subtle morphological changes of floccules and the dynamic process of the aggregation degree of suspended particles with the naked eye, making it difficult to make accurate assessments in a timely manner. In addition, the frequency of regular sampling and analysis is limited, and the feedback information is delayed, which cannot reflect the changing trend of the flocculation status in real time.
[0047] Based on the above defects, the traditional manual experience control method is difficult to achieve accurate control of the flocculant dosage, and it is often easy to cause excessive or insufficient dosage. The former will lead to waste of resources and increase operating costs; the latter may affect the flocculation effect and reduce the effluent water quality. Therefore, there is an urgent need for a new automated and intelligent flocculant dosage control method to improve the control accuracy and stability and optimize the sewage treatment process.
[0048] After the background introduction of the above content, those skilled in the art can understand the problems existing in the prior art. The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0049] Based on the above background technology, please refer to Figure 1 , Figure 1 A flow chart of a flocculant addition analysis method provided in an embodiment of the present application. The system can be implemented by a computer program or can be run as an independent tool application. Specifically, in an embodiment of the present application, the method can be applied on a server, but can also be applied on electronic devices such as servers. A flocculant addition analysis method includes the following steps: S101, obtaining video images of a sewage treatment process, and marking each frame in the video images according to a time sequence to obtain a sewage image set with time marks; Specifically, we first need to obtain video images of the sewage treatment process. This is because the sewage flocculation process is a continuous dynamic change process, and static images are difficult to fully reflect its change trend. Video images can record the entire flocculation process frame by frame, providing comprehensive time series data support for subsequent state analysis.
[0050] After obtaining the video images, each frame in the video needs to be marked and given the corresponding timestamp information. The purpose of this step is to accurately match each frame image in the video with the corresponding time point, thus laying the foundation for subsequent timing analysis and status evaluation.
[0051] Specifically, computer vision and image processing technology can be used to automatically identify each frame in the video image and add timestamp information to each frame to form a sewage image set with time stamps. This image set not only contains the image information of sewage at various time points, but also records the precise time point corresponding to each frame of the image, making the image closely related to time.
[0052] This image set can restore the time series change trajectory of the entire sewage flocculation process. This provides a data basis for the subsequent in-depth analysis of the flocculation state, so that the analysis is no longer limited to the static information of a single time point, but can be combined with the dynamic change information of the previous and next frames for comprehensive judgment, greatly improving the accuracy and robustness of the state assessment.
[0053] At the same time, the time-stamped image set can also be easily matched with the actual flocculant addition record, so that the corresponding relationship between the image state and the dosage can be analyzed, laying the foundation for formulating accurate dosage control strategies.
[0054] S102, performing edge recognition on each sewage image in the sewage image set to obtain an edge image set, and performing flocculation state analysis based on the edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set; Specifically, after obtaining the sewage image set with time stamps, the next step is to perform edge recognition processing on each sewage image in the image set to obtain a corresponding edge image set.
[0055] The reason for edge recognition is that the edge lines of floccules in sewage can better reflect their morphology and distribution characteristics. Through the edge detection algorithm, the contour information of floccules in the image can be automatically extracted, the background and irrelevant areas can be removed, and the effective morphological line features can be focused.
[0056] Specifically, we can use classic edge detection algorithms such as Canny and Sobel to perform convolution operations on the original sewage image to detect the edge lines in the image. After this processing, we can get a new set of edge images, in which each edge image only retains the contour line information of the flocculants, and the background area is filtered out.
[0057] This step is necessary because the original sewage image contains a lot of background impurities, and these irrelevant information will interfere with the subsequent analysis of the flocculation state. After edge detection, the characteristics of the flocculent itself can be directly locked, which is conducive to the detailed analysis of its morphology, density, etc.
[0058] After obtaining the edge image set, a series of flocculation state analyses can be performed based on the extracted edge line features, such as calculating key indicators such as filamentary edge uniformity, filamentary edge density, transmittance, and connection discreteness, and based on these indicators, the flocculant demand state corresponding to each edge image can be determined through a machine learning model.
[0059] By using edge recognition, the morphological features of flocs can be automatically extracted, avoiding the defects of subjective judgment. At the same time, the flocculation state analysis is based on clear edge line features, which can greatly improve the accuracy and reliability of state assessment compared to the original messy images.
[0060] Based on the above embodiment, as an optional embodiment, edge recognition is performed on each sewage image in the sewage image set to obtain an edge image set, including: S201, performing noise reduction and smoothing processing on the images in the sewage image set through a Gaussian filter with a Gaussian convolution kernel parameter of 5x5 to obtain a first sewage image set; Specifically, before edge recognition is performed on the sewage image set, the image may be subjected to noise reduction and smoothing processing to improve the accuracy and robustness of subsequent edge detection.
[0061] Specifically, a Gaussian filter can be used to filter the original sewage image, and the convolution kernel parameters of the filter are set to a 5x5 Gaussian convolution kernel. Gaussian filtering is a classic image smoothing filtering method that can effectively eliminate image noise while retaining the main edge contour features of the image. The reason why noise reduction and smoothing are required is that there are usually some noise and detail disturbances in the sewage images actually obtained, such as uneven lighting and sensor thermal noise. These noises will interfere with subsequent edge detection, resulting in a large number of false edges and artifacts in the detection results, affecting the accuracy of feature extraction.
[0062] The Gaussian filter can effectively suppress and remove Gaussian white noise in the image, while retaining the main edge contour information of the image. Compared with the original image, the filtered image has a smoother background and significantly reduced noise, but the contour features of the flocculants are still retained, creating a good prerequisite for subsequent edge detection.
[0063] When performing Gaussian filtering, choosing a convolution kernel size of 5x5 can achieve a good balance between noise reduction and detail preservation. A smaller kernel will result in poor noise reduction, while a larger kernel may over-smooth the image and blur the edges of details. The size of 5x5 is generally considered a reasonable compromise.
[0064] After Gaussian filtering, a first sewage image set can be obtained. Compared with the original image, the noise of each image is greatly reduced, and the background is cleaner and smoother, but the edge contour features of the flocculants are still retained, providing an ideal input image for subsequent edge detection.
[0065] S202, calculating the gradient amplitude and gradient direction of each pixel point of each image in the first sewage image set based on the Canny edge detection algorithm to obtain the gradient value and gradient direction of the pixel point of each image in the first sewage image set; Specifically, after performing Gaussian filtering to reduce noise on the first sewage image set, the next step is to calculate the gradient amplitude and gradient direction of each pixel in each image based on the Canny edge detection algorithm.
[0066] The reason for using the Canny algorithm is that it is a classic and efficient edge detection method that can better extract the main edge contour lines in the image, suppress noise interference, and has high detection accuracy.
[0067] Specifically, the first step of the Canny algorithm is to calculate the gradient magnitude and gradient direction of each pixel in the image. The gradient magnitude reflects the grayscale change of the pixel, and the larger the value, the more likely it is to be at the edge; the gradient direction reflects the azimuth of the edge.
[0068] In order to calculate the gradient, a Gaussian convolution kernel is usually used to derive the image. Assuming that the grayscale function of the image is f(x,y), its gradient can be expressed as a gradient vector: ∇f=[G_x,G_y]^T, where G_x=df / dx is the horizontal gradient and G_y=df / dy is the vertical gradient.
[0069] The magnitude of the gradient is given by the modulus of this vector: |∇f|=√(G_x^2+G_y^2) The gradient direction is given by the azimuth of the vector: θ = tan^(-1)(G_y / G_x) For each image in the first sewage image set, the above formula can be used to obtain the gradient amplitude and gradient direction corresponding to each pixel through convolution operation. After completing this step, the following data can be obtained: the pixel gradient value (including gradient amplitude and direction) of each image in the first sewage image set. This lays the foundation for subsequent edge detection and contour extraction.
[0070] After obtaining the gradient information of each pixel, in the subsequent steps of the Canny algorithm, non-maximum suppression, double threshold filtering and other operations can be performed on the pixels according to the gradient values, and finally a binary edge image is obtained, which only retains the main contour edge information of the image.
[0071] Compared with directly performing edge detection on an image, calculating the pixel gradient value first can maximize the use of the grayscale change information in the image and improve the robustness and accuracy of edge detection. At the same time, through post-processing such as non-maximum suppression, it can effectively eliminate erroneous edge information introduced by noise.
[0072] S203, performing non-maximum suppression on the gradient value of each pixel point of each image in the first sewage image set based on the Canny edge detection algorithm, and outputting a second sewage image set after non-maximum suppression; Specifically, after calculating the gradient value of each pixel in the first sewage image set, the next step is to perform non-maximum suppression on these gradient values based on the Canny algorithm, thereby outputting the second sewage image set after non-maximum suppression. The purpose of non-maximum suppression is to remove some "pseudo-edge" information caused by noise, texture, etc., and only retain the real edge contour information in the image.
[0073] Specifically, the operation process of non-maximum suppression is as follows: for each pixel in the image, check whether there is a gradient value greater than the current point gradient value in the vertical direction along the gradient direction of the point. If there is, the gradient value of the pixel is set to 0, otherwise the original gradient value is retained.
[0074] Through this processing, the gradient "burrs" caused by noise, texture, etc. can be suppressed to a certain extent, while retaining the local gradient maximum points at the real edge contour.
[0075] In implementation, the following steps can be taken: first determine the gradient direction of the current pixel and map it to one of the eight basic directions. Then, in the vertical direction of the gradient direction, take the gradient values of the three adjacent pixels before and after the gradient point and compare them with the current point. If there is a larger gradient value, the gradient of the current point is set to 0. In this way, all the pixels in the entire image are traversed to complete the non-maximum suppression process.
[0076] After non-maximum suppression, a new second sewage image set can be obtained. Compared with the first sewage image set, the images in the second set only retain the real, narrow, one-dimensional edge contour line information, and other blurred edges and artifacts caused by lighting changes, textures, noise, etc. are greatly suppressed.
[0077] This feature of the second sewage image set lays a good foundation for subsequent double threshold filtering and edge connection processing. As an important pre-step of edge detection, non-maximum suppression can significantly improve the quality and accuracy of the final edge image.
[0078] S204, performing double threshold detection on the images in the second sewage image set based on the Canny edge detection algorithm to obtain image edge data; Specifically, after completing non-maximum suppression, the next step is to perform double threshold detection on the images in the second sewage image set based on the Canny edge detection algorithm to obtain the final image edge data. The reason why double threshold detection is needed is that even after non-maximum suppression, the edge information in the second sewage image set still has some breaks and blurs, which need to be further optimized and improved. Double threshold detection can solve this problem well. It sets two different thresholds-a high threshold and a low threshold. Points with pixel gradient values higher than the high threshold are directly determined as edge points; points lower than the low threshold are determined as non-edge points; and points between the two need to be considered comprehensively in combination with their connection with the determined edge points.
[0079] Specifically, we can first traverse all pixels, mark pixels above a high threshold as edge points, and pixels below a low threshold as non-edge points. Then, for pixels between the two thresholds, check whether they are connected to the edge points that have been determined. If they are connected, they are also marked as edge points, otherwise they are marked as non-edge points.
[0080] In this way, broken edge lines can be better detected and connected, while some artifact edges caused by noise can be suppressed. Dual threshold detection takes into account the size of the gradient value and spatial connectivity, and the detection effect is more accurate and complete. After dual threshold detection, the real edge data of each sewage image can be finally obtained. These data can more completely and accurately depict the contour characteristics of the flocculants. With these high-quality edge data, a solid foundation can be laid for subsequent key steps such as edge image feature extraction and state analysis, thereby achieving refined perception and high-precision control of the flocculation process.
[0081] S205 , performing boundary tracing processing on the images in the second sewage image set based on the image edge detection data to obtain an edge image set.
[0082] Specifically, after obtaining the image edge data after dual threshold detection, the next step is to perform boundary tracing processing on the second sewage image set based on these data, so as to finally obtain the edge image set. The reason why boundary tracing processing is needed is that the edge data output by dual threshold detection often presents discontinuity and fracture characteristics, which are difficult to be directly used for subsequent feature analysis and state judgment. These discrete edge points need to be connected into closed contour lines through boundary tracing in order to better depict the complete morphological characteristics of flocs.
[0083] Specifically, the process of edge tracing is: first, find an unvisited edge pixel point in the image as the starting point, and continue to find the next adjacent edge point along the edge direction, and store it in the contour vector until it returns to the starting point to form a closed contour line. Then continue to find a new starting point in the remaining unvisited points, and repeat the above process until all edge points have been visited.
[0084] During implementation, some effective tracing algorithms, such as Freeman coding and boundary tracing, can be used to ensure the smoothness and continuity of the contour line. At the same time, it is necessary to pay attention to handling some special cases, such as broken edges and intersecting edges. After boundary tracing, a new edge image set can be obtained. Each image in the set is composed of a series of complete closed contour lines, which clearly outlines the contour morphology of the floc. With this high-quality edge image set, various morphological features, such as area, perimeter, roundness, etc., can be extracted based on it to fully characterize the state characteristics of the floc, and lay a data foundation for subsequent state classification and intelligent dosing control. However, if we only rely on the discrete edge points output by dual threshold detection, it is difficult to accurately describe the overall morphology of the floc, and the quality and reliability of feature extraction will be greatly reduced.
[0085] S103, sorting the flocculant demand states corresponding to the edge images according to the time stamps to obtain a flocculant demand state set; Specifically, after performing state analysis on each edge image to determine its corresponding flocculant demand state, the next step is to sort these demand states according to the time stamps of the images to form an ordered flocculant demand state set.
[0086] The reason why the demand status needs to be arranged in chronological order is that the flocculation process is a continuous dynamic change process, and the state at a single time point is difficult to fully reflect the overall trend. Only by connecting the states of each time point in an orderly manner can the complete state change trajectory be restored, providing continuous time series data support for subsequent demand forecasting and dosing control.
[0087] Specifically, the timestamp information carried by each edge image can be used to arrange the corresponding demand states in chronological order. For example, if the timestamp of image A is 10:05:32, the corresponding demand state is 2; the timestamp of image B is 10:05:35, the corresponding demand state is 3, then in the sorted sequence, state 2 will appear first, and state 3 will appear later.
[0088] Through this time sorting, we can finally get a complete and ordered flocculant demand state set, which not only contains the discrete state values at each time point, but more importantly, it can reflect the dynamic change process and trend of the state value, laying the foundation for subsequent intelligent demand forecasting.
[0089] Once you have an ordered set of demand states, you can combine historical data and time series patterns, and apply machine learning and other technologies to predict future state changes, thereby developing an accurate dosage control strategy that can both meet real-time needs and predict and prevent possible future fluctuations.
[0090] Compared with the static state analysis at a single time point, arranging the demand status in time series and predicting its changing trend can greatly improve the foresight and pertinence of control, so that the dosing control is no longer passively adjusted after the fact, but actively understands the changes, predicts the needs, and actively grasps the sewage treatment process to ensure the best treatment effect.
[0091] S104, extracting features of the flocculant demand states in the flocculant demand state set to obtain flocculation feature values sorted by time tags, and inputting the flocculation feature values into a preset prediction model to obtain a predicted flocculant demand state; Specifically, after obtaining the flocculant demand state set sorted by time, the next step is to extract features from this state set to obtain a flocculation feature value sequence sorted by time markers.
[0092] Feature extraction is necessary because it is difficult for machine learning models to directly model and predict discrete state value sequences. It is necessary to map the state values into some eigenvalues with specific physical meanings, which can better describe the essential laws and internal mechanisms of state changes.
[0093] Specifically, features such as the change gradient, change frequency, and smoothness of the state value can be extracted. In addition, some domain knowledge can be introduced in combination with the actual flocculation process to design more characteristic indicators with physical significance, such as flocculation degree, flocculation rate, etc. These features can better reflect the dynamic nature of state changes.
[0094] After extracting the time-ordered feature value sequence, it can be input into a pre-trained prediction model. The model can be a time series prediction model based on machine learning, such as a recursive neural network, a long short-term memory network, etc. The model can predict future feature value sequences by learning the change pattern of historical feature value sequences.
[0095] By converting the future characteristic value sequence predicted by the model into the corresponding flocculant demand state, we can predict the demand state change trend in the future, which lays the foundation for the subsequent dosage control.
[0096] Through this step, intelligent prediction of future flocculant demand status can be achieved, so that dosing control is no longer passively adjusted after the fact, but actively understands changes and predicts demand, thereby improving the foresight and initiative of control.
[0097] At the same time, the feature extraction method can better capture the inherent laws of state changes. Compared with directly modeling discrete state values, the prediction accuracy and robustness are higher.
[0098] The introduction of the feature extraction link makes the entire control process more intelligent and data-based, which is conducive to improving the accuracy and stability of flocculant addition, optimizing sewage treatment effects, and reducing operating costs. It has important practical application value.
[0099] Based on the above embodiment, as an optional embodiment, performing flocculation state analysis based on edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set includes: S301, obtaining the transmittance of edge images in the edge image set according to the values of the three channels R, G, and B corresponding to each pixel point in the edge image in the edge image set, and obtaining the connection discreteness of the edge images in the edge image set according to the transmittance of the edge images in the edge image set; Specifically, after obtaining the edge image set, the next step is to perform flocculation state analysis based on these edge images to determine the flocculant demand state corresponding to each edge image.
[0100] First, the transmittance of the image needs to be calculated based on the RGB value of each pixel in the edge image. The transmittance index is needed because it can better reflect the density of flocs. The denser the flocs, the more shielding there is, and the lower the transmittance.
[0101] Specifically, we can traverse each pixel in the edge image and obtain the values of its three channels, R, G, and B. Then, we can calculate the light intensity value I of the point according to a certain light intensity formula, such as I=R0.299+G0.587+B*0.114. By averaging the light intensity values of all pixels in the entire image, we can get the average transmittance of the image.
[0102] After obtaining the transmittance, the next step is to calculate the connection dispersion of the image based on it. Connection dispersion is an important indicator to measure the connectivity of flocs. It reflects the dispersion of the edge contour of the flocs. The larger the value, the more discrete the contour and the loose the flocs. On the contrary, the smaller the value, the densely connected the flocs.
[0103] Specifically, we can first extract all independent closed contours in the image and calculate the area, centroid and other parameters of each contour. Then define the shortest distance between contours and the ratio of distance to contour area as discrete metric values. By summing and averaging the discrete metric values of all contours, we can get the connection discreteness of the entire image.
[0104] Based on the above embodiment, as an optional embodiment, the transmittance of the edge image in the edge image set is obtained according to the values of the three channels R, G, and B corresponding to each pixel point in the edge image in the edge image set, including: Substitute the values of the three channels R, G, and B corresponding to each pixel in the edge image in the edge image set into the transmittance formula to calculate the transmittance value of the corresponding pixel, and determine the transmittance of the edge image in the edge image set according to the transmittance value of the pixel. The transmittance formula is: Transmittance = (0.299R + 0.587G + 0.114*B) / 255 In the formula, R represents the red channel value of the pixel, G represents the green channel value of the pixel, and B represents the blue channel value of the pixel.
[0105] Specifically, when calculating the transmittance of each edge image in the edge image set, it is necessary to first obtain the values of the three channels R, G, and B corresponding to each pixel in the image, and then substitute these values into the transmittance formula for calculation, so as to obtain the transmittance value of each pixel, and finally determine the transmittance of the entire image based on the statistical results of the transmittance values of all pixels. The reason why the RGB value of the pixel is needed to calculate the transmittance is that the transmittance actually reflects the attenuation degree of light when passing through a certain medium, and the RGB value can well describe the intensity and color information of the light.
[0106] Specifically, we can traverse all the pixels in each edge image and obtain the R, G, and B channel values of each point. Then substitute these three values into the given transmittance formula for calculation: Transmittance = (0.299R + 0.587G + 0.114*B) / 255 Among them, R, G, and B represent the brightness values of the red, green, and blue channels of the current pixel, respectively, and the value range is 0 to 255. The transmittance formula can accurately reflect the overall light intensity of the point by weighted summing the values of the three RGB channels.
[0107] After traversing all the pixels, we can get a set of transmittance values. Then we can calculate the average or median of these values as the overall transmittance of the image.
[0108] The higher the transmittance value, the fewer floccules there are in the image and the lower the degree of obstruction; conversely, the lower the transmittance value, the denser the floccules and the more severe the obstruction. The transmittance index can more intuitively reflect the density change trend of flocs during the flocculation process, thus providing important data support for determining the current flocculation state and dosage requirements.
[0109] At the same time, compared with simply using simple indicators such as grayscale values, calculating transmittance based on RGB values can provide richer color and light intensity information, further improving the accuracy and reliability of state analysis.
[0110] S302, performing corner point detection on the edges of edge images in the edge image set to obtain corner points corresponding to the edge images in the edge image set, and obtaining filament edge uniformity and filament edge compactness corresponding to the edge images in the edge image set according to the corner points corresponding to the edge images in the edge image set; Specifically, after calculating the transmittance and the contact discreteness, the next step is to detect the corner points of the edges in the edge image set, so as to obtain the corner point information corresponding to each edge image. Based on the corner point information, two important feature quantities, the filament edge uniformity and the filament edge compactness, can be further calculated. The reason why it is necessary to detect and use the corner point information is that the state and morphology of the edge contour of the flocculent are largely reflected in the distribution of its corner points. For example, a large number of corner points and uniform distribution usually means that the edge is smooth and continuous; while sparse corner points and concentrated distribution indicate the presence of obvious clumps and fibrous structures.
[0111] Specifically, the classic Harris corner detection algorithm can be used to operate on each edge image. This algorithm is based on image gradient matrix calculation and can detect the corner positions in the image more accurately. During the detection process, it is necessary to set an appropriate corner response threshold to obtain a sufficient number of corners while avoiding excessive interference from pseudo corners.
[0112] After obtaining all the corner point information of each image, we can further calculate the uniformity and compactness of the filamentary edge. The uniformity of the filamentary edge reflects the smoothness and continuity of the edge contour. The distance difference between the corner points can be counted. The smaller the distance difference, the higher the uniformity. The compactness of the filamentary edge reflects the density of the contour, which can be obtained by counting the number of corner points per unit area.
[0113] These two characteristics can well describe the edge morphology of flocs. High uniformity and low compactness usually mean that the flocs are loose and dispersed, while low uniformity and high compactness indicate that the flocs are dense and connected.
[0114] Combined with the previously obtained transmittance and connection discreteness, the filamentary edge uniformity and compactness obtained through corner detection can fully describe the various state characteristics of the flocculants, including density, connectivity, edge smoothness, etc. With these multi-dimensional feature quantities, they can be mapped to the pre-designed flocculation state classification model to accurately determine the current state stage of the flocculants, providing reliable data support for determining the precise flocculant addition requirements. Therefore, corner point detection of edge images and subsequent calculation of filamentary edge uniformity and compactness is an important part of achieving comprehensive and refined flocculation state analysis. It can deeply mine the rich morphological feature information contained in the image data, lay a data foundation for the realization of precise intelligent flocculant addition control, and is of great significance to ensure the stable and efficient operation of sewage treatment.
[0115] S303, obtaining the flocculant demand state corresponding to the edge image in the edge image set according to the filament edge uniformity, the filament edge density and the connection dispersion.
[0116] Specifically, after calculating the three key characteristic quantities of filamentary edge uniformity, filamentary edge compactness and connection dispersion, the next step is to comprehensively judge the flocculant demand state corresponding to each edge image based on them.
[0117] The reason why the demand state is determined based on these three characteristic quantities is that they can comprehensively characterize the morphology and connectivity of flocculants, and are the key data basis for judging the flocculation process and dosage requirements.
[0118] Specifically, a flocculation state classification model can be established in advance, and the value ranges of these three characteristic quantities can be divided into several state intervals based on experience or machine learning methods. For example, high filamentary edge uniformity, low filamentary edge compactness, and high contact discreteness correspond to the early stage of flocculation, and the dosage needs to be appropriately increased; low uniformity, moderate compactness, and moderate discreteness correspond to the middle stage of the flocculation process, and the current dosage should be maintained; low uniformity, high compactness, and low discreteness correspond to the late stage of flocculation, and the dosage needs to be appropriately reduced; and so on.
[0119] For each input edge image, we can first calculate the specific values of the three quantities of its filamentary edge uniformity, compactness and discreteness, and then substitute these three values into the pre-built classification model at the same time. According to which state range they fall into, we can judge the flocculant demand state corresponding to the image.
[0120] In this way, accurate classification of flocculation state can be achieved, providing direct data support for the formulation of reasonable dosing strategies. It avoids the subjectivity and uncertainty that may exist in relying solely on manual experience judgment. For the entire edge image set, the demand state corresponding to each image can be judged one by one, thereby obtaining a complete demand state sequence, laying the foundation for the subsequent generation of dynamic demand curves and intelligent adjustment of dosage. At the same time, this method can also continuously optimize and improve the state interval division of the classification model with the accumulation of practice, so that the accuracy of the prediction continues to improve and meet the control needs of different flocculation conditions.
[0121] Based on the above embodiment, as an optional embodiment, obtaining the connection discreteness of the edge images in the edge image set according to the transmittance of the edge images in the edge image set includes: S401, comparing the transmittance of the edge image in the edge image set with a preset transmittance threshold. If the transmittance of the edge image is greater than the preset transmittance threshold, it means that the edge image is relatively transparent and the flocculation effect is relatively poor, which is recorded as a discrete state. If the transmittance of the edge image is less than the preset transmittance threshold, it means that the edge image is relatively turbid and the flocculation effect is relatively good, which is recorded as a connected state. Specifically, after calculating the transmittance of the edge image, the transmittance can be further compared with a preset transmittance threshold, so as to preliminarily determine whether the flocculation state corresponding to the image is a discrete state or a connected state. The reason for introducing this step is that the transmittance can more intuitively reflect the density of the floccules and is an important reference indicator for judging whether the flocculation effect is good or not. When the transmittance is higher than a certain threshold, it usually means that the flocculation effect is poor and the flocs are dispersed; when the transmittance is lower than the threshold, it indicates that the flocculation effect is good and the flocs are more closely connected.
[0122] Specifically, a reasonable transmittance threshold value, such as 0.6, can be set in advance based on actual process parameters and experience. For each input edge image, its transmittance value is compared with this threshold value: If the image transmittance is greater than the threshold value of 0.6, it indicates that the floccules in the image are relatively dispersed and transparent, and the flocculation effect is poor. The state corresponding to the image can be preliminarily recorded as "discrete state". If the image transmittance is less than the threshold value of 0.6, it indicates that the floccules in the image are relatively dense and turbid, and the flocculation effect is good. The state corresponding to the image can be preliminarily recorded as "connected state".
[0123] Through this simple binary judgment, we can preliminarily distinguish the two states of good flocculation effect and poor effect, laying the foundation for the subsequent refined state analysis. Of course, relying solely on transmittance judgment still has certain limitations, because in some cases, even if the floccules are dense, the transmittance may be high. Therefore, this step is more of a prejudgment and auxiliary role, and the real refined state analysis needs to be comprehensively determined in combination with other characteristic quantities.
[0124] However, by introducing the transmittance threshold, the workload of subsequent analysis can be reduced to a certain extent, and the obvious discrete or connected states can be directly and quickly classified and identified, which improves the analysis efficiency. At the same time, it also provides important prior support for the subsequent calculation of indicators such as connection discreteness.
[0125] S402, counting the duration of continuous connection states and the duration of discrete states in edge images in the edge image set, and calculating the connection dispersion of the edge images in the edge image set according to the duration of the connection states and the duration of the discrete states.
[0126] Specifically, after initially determining the discrete state or connection state corresponding to each edge image, the next step is to further count the duration of the continuous discrete state and connection state in time, and calculate the final connection discreteness index based on their duration. The reason why the state duration needs to be introduced is that the simple discrete connection state can only reflect the flocculation status at the current moment, and it is difficult to effectively describe the continuous change trend of the entire process. By analyzing the state duration, the discrete and connected characteristics of the flocculants can be better quantified, providing more reliable data support for the formulation of dosing strategies.
[0127] Specifically, the time series of the entire edge image set can be traversed, and for each state mark at a moment, the number of frames of continuity between the state at the previous and next moments can be counted. If the current state is different from the state at the previous moment, the counting starts again; if the state remains unchanged, the duration is accumulated. In this way, the duration sequence of each discrete state and connected state can be obtained. Generally speaking, the longer the duration of the discrete state, the more serious the degree of flocculant dispersion and the greater the dosage requirement; the longer the duration of the connected state, the better the connectivity of the flocculant and the smaller the dosage requirement.
[0128] With these two time series, the connection dispersion index can be further calculated. A weighted formula can be designed, such as: connection dispersion = the sum of α discrete durations - the sum of β connection durations. Among them, α and β are weight coefficients set empirically. In this way, the longer the discrete state lasts, the greater the connection dispersion value will be; conversely, the longer the connection state lasts, the smaller the dispersion value will be. This coincides with the discrete connectivity characteristics of the flocs. Finally, the connection dispersion can be further corrected in combination with the transmittance calculated previously, so that it can more accurately reflect the flocculation state. With the two key indicators of transmittance and connection dispersion, the density and connectivity changes of the flocs during the flocculation process can be fully characterized, providing important data support for determining the current dosage demand status.
[0129] S105, determining the actual amount of flocculant added according to the predicted flocculant demand state.
[0130] Specifically, after obtaining the predicted future flocculant demand state change trend, the next step is to determine the actual flocculant dosage based on this prediction result. This step is necessary because the predicted demand state is only a relative indicator value, and it needs to be converted into a specific dosage to guide the actual control execution. Different demand states correspond to different optimal dosages. Only by accurately matching the two can refined and quantitative dosage control be achieved.
[0131] Specifically, a mapping model between demand state and dosage can be pre-built. The model can be trained based on historical data through a machine learning algorithm. The input of the model is the demand state value, and the output is the corresponding recommended dosage. In actual application, the predicted demand state sequence in the future period is input into the mapping model one by one, and the model can intelligently output the corresponding flocculant dosage sequence as a control guide based on the trained mapping law. This method of mapping the demand state to the dosage can significantly improve the accuracy and consistency of control compared to traditional manual experience control. By learning a large amount of historical data, the model can more comprehensively characterize the mapping relationship between state and dosage, avoiding the arbitrariness of subjective judgment. At the same time, the model method also overcomes the blind spot of single state judgment, and can combine the trend of state changes before and after for comprehensive evaluation, so as to output more reasonable dosage values and improve the foresight and continuity of control.
[0132] After obtaining the precise flocculant dosage sequence, the actual flocculant dosage can be precisely controlled. By automatically adjusting the dosage, it can respond quickly according to the real-time changes in the flocculation state, avoiding waste of resources caused by excessive dosage and preventing insufficient dosage from affecting the treatment effect.
[0133] Based on the above embodiment, as an optional embodiment, determining the actual amount of flocculant added according to the predicted flocculant demand state includes: The predicted flocculant demand state is input into a preset corresponding relationship model between the flocculant demand state and the dosage to obtain the actual flocculant addition dosage.
[0134] See also Figure 2 , Figure 2 This is a schematic diagram of a flocculant addition analysis device provided in an embodiment of the present application. The flocculant addition analysis device may include: The data acquisition module 1 is used to acquire video images of the sewage treatment process and mark each frame in the video images according to the time sequence to obtain a sewage image set with time marks; The edge recognition module 2 is used to perform edge recognition on each sewage image in the sewage image set to obtain an edge image set, and perform flocculation state analysis based on the edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set; A flocculant demand state set generation module 3 is used to sort the flocculant demand states corresponding to the edge images according to the time tags to obtain a flocculant demand state set; Prediction module 4 is used to extract features of the flocculant demand state in the flocculant demand state set, obtain flocculation feature values sorted by time tags, and input the flocculation feature values into a preset prediction model to obtain a predicted flocculant demand state; The dosage determination module 5 is used to determine the actual dosage of the flocculant according to the predicted flocculant demand state.
[0135] Please refer to Figure 3 The application also discloses an electronic device. Figure 3 The electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0136] The communication bus 302 is used to realize the connection and communication between these components.
[0137] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0138] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0139] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field~Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.
[0140] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read~Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally be at least one storage system located away from the aforementioned processor 301. Refer to Figure 3 The memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program for a flocculant addition analysis method.
[0141] exist Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the application program storing the road assessment method in the memory 305. When executed by one or more processors 301, the electronic device 300 executes one or more methods in the above-mentioned embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application. In the above embodiments, the description of each embodiment has its own emphasis. For the parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0142] In the several implementations provided in this application, it should be understood that the disclosed system can be implemented in other ways. For example, the system embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of the system or unit can be electrical or other forms.
[0143] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0144] The present application also provides a computer storage medium that can store multiple instructions, which are suitable for being loaded and executed by a processor as described above. Figure 1 The road assessment method of the embodiment shown in the figure can be found in the specific implementation process. Figure 1 The specific description of the illustrated embodiment will not be repeated here.
[0145] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0146] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0147] The above are only exemplary embodiments of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.
[0148] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A flocculant addition analysis method, characterized in that: The method comprises: Acquire video images of the sewage treatment process, and mark each frame in the video images according to a time sequence to obtain a sewage image set with time marks; Performing edge recognition on each sewage image in the sewage image set to obtain an edge image set, and performing flocculation state analysis based on the edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set; Sorting the flocculant demand states corresponding to the edge images according to the time stamps to obtain a flocculant demand state set; Extracting features of the flocculant demand states in the flocculant demand state set to obtain flocculation feature values sorted by time tags, and inputting the flocculation feature values into a preset prediction model to obtain a predicted flocculant demand state; According to the predicted flocculant demand state, the actual amount of flocculant added is determined.
2. The method according to claim 1, characterized in that The step of performing edge recognition on each sewage image in the sewage image set to obtain an edge image set includes: Performing noise reduction and smoothing processing on the images in the sewage image set through a Gaussian filter with a Gaussian convolution kernel of 5x5 parameters to obtain a first sewage image set; Calculating the gradient magnitude and gradient direction of each pixel point of each image in the first sewage image set based on the Canny edge detection algorithm to obtain the gradient value and gradient direction of the pixel point of each image in the first sewage image set; Based on the Canny edge detection algorithm, non-maximum suppression is performed on the gradient value of each pixel point of each image in the first sewage image set, and a second sewage image set after non-maximum suppression is output; Performing double threshold detection on the images in the second sewage image set based on the Canny edge detection algorithm to obtain image edge data; Based on the image edge detection data, boundary tracing processing is performed on the images in the second sewage image set to obtain an edge image set.
3. The method according to claim 1, characterized in that The performing flocculation state analysis based on the edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set includes: Obtaining the transmittance of the edge images in the edge image set according to the values of the three channels R, G, and B corresponding to each pixel point in the edge image in the edge image set, and obtaining the connection discreteness of the edge images in the edge image set according to the transmittance of the edge images in the edge image set; Performing corner point detection on the edges of edge images in the edge image set to obtain corner points corresponding to the edge images in the edge image set, and obtaining filament edge uniformity and filament edge compactness corresponding to the edge images in the edge image set according to the corner points corresponding to the edge images in the edge image set; The flocculant demand state corresponding to the edge image in the edge image set is obtained according to the filament edge uniformity, the filament edge compactness and the connection discreteness.
4. The method according to claim 3, characterized in that The step of obtaining the transmittance of the edge image in the edge image set according to the values of the three channels R, G, and B corresponding to each pixel point in the edge image in the edge image set comprises: Substituting the values of the three channels R, G, and B corresponding to each pixel point in the edge image in the edge image set into the transmittance formula to calculate the transmittance value of the corresponding pixel point, and determining the transmittance of the edge image in the edge image set according to the transmittance value of the pixel point, wherein the transmittance formula is: Transmittance = (0.299R + 0.587G + 0.114*B) / 255 In the formula, R represents the red channel value of the pixel, G represents the green channel value of the pixel, and B represents the blue channel value of the pixel.
5. The method according to claim 3, characterized in that: The step of obtaining the connection discreteness of the edge images in the edge image set according to the transmittance of the edge images in the edge image set comprises: Compare the transmittance of the edge image in the edge image set with a preset transmittance threshold. If the transmittance of the edge image is greater than the preset transmittance threshold, it means that the edge image is relatively transparent and the flocculation effect is relatively poor, which is recorded as a discrete state. If the transmittance of the edge image is less than the preset transmittance threshold, it means that the edge image is relatively turbid and the flocculation effect is relatively good, which is recorded as a connected state. The duration of the continuous connection state and the duration of the discrete state in the edge images in the edge image set are counted, and the connection discreteness of the edge images in the edge image set is calculated according to the duration of the connection state and the duration of the discrete state.
6. The method according to claim 3, characterized in that The obtaining of the flocculant demand state corresponding to the edge image in the edge image set according to the filament edge uniformity, the filament edge compactness and the connection discreteness comprises: The filament edge uniformity, the filament edge compactness and the connection dispersion are input into a preset state determination model, and the flocculant demand state corresponding to the edge image in the edge image set is output.
7. The method according to claim 1, characterized in that The step of determining the actual amount of flocculant added according to the predicted flocculant demand state includes: The predicted flocculant demand state is input into a preset corresponding relationship model between the flocculant demand state and the dosage to obtain the actual dosage of the flocculant.
8. A flocculant addition analysis device, characterized in that: The device comprises: A data acquisition module is used to acquire video images of the sewage treatment process and mark each frame in the video images according to a time sequence to obtain a sewage image set with a time mark; An edge recognition module is used to perform edge recognition on each sewage image in the sewage image set to obtain an edge image set, and perform flocculation state analysis based on the edge images in the edge image set to determine the flocculant demand state corresponding to each edge image in the edge image set; A flocculant demand state set generation module, used for sorting the flocculant demand states corresponding to the edge images according to the time mark to obtain a flocculant demand state set; A prediction module is used to extract features of the flocculant demand states in the flocculant demand state set to obtain flocculation feature values sorted by time tags, and input the flocculation feature values into a preset prediction model to obtain a predicted flocculant demand state; The dosage determination module is used to determine the actual dosage of the flocculant according to the predicted flocculant demand state.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: It includes a processor, a memory and a transceiver, the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method according to any one of claims 1 to 7.
