Image Recognition-Based Method for Analyzing the Treatment Effect of Oily Wastewater
By using an image recognition-based method, optical microscopy and target detection models are employed to perform microscopic image analysis on oily wastewater. This solves the problems of cumbersome operation and insufficient accuracy of traditional methods, and enables rapid and accurate analysis of the treatment effect of oily wastewater.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA PETROLEUM & CHEMICAL CORP
- Filing Date
- 2024-11-25
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, traditional infrared and ultraviolet methods for measuring oil content in water are cumbersome, time-consuming, and have poor adaptability to different scenarios. Image recognition-based methods are difficult to guarantee in terms of accuracy and lack generalization ability for unknown application scenarios, thus failing to meet the need for rapid and accurate analysis of the treatment effect of oily wastewater.
An image recognition-based method is used to photograph wastewater samples using an optical microscope. After image enhancement processing, an object detection model is used to label and identify emulsified oil droplets, construct a training dataset, and train a lightweight or feature extraction-enhanced object detection model to achieve real-time analysis of the treatment effect of oily wastewater.
It enables rapid and accurate analysis of the treatment effect of oily wastewater, is easy to operate, highly adaptable, and can perform quantitative calculations and analyses, thus improving accuracy.
Smart Images

Figure CN122090441A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of environmental emergency technology, and in particular relates to a method for analyzing the treatment effect of oily wastewater based on image recognition. Background Technology
[0002] Petrochemical enterprises generate large amounts of intermediate wastewater during production processes and firefighting and cooling wastewater during accident rescue operations. These oily wastewaters require timely treatment to prevent environmental pollution and other adverse consequences. Therefore, petrochemical enterprises often install multiple oily wastewater treatment systems. In certain production or accident scenarios, it is necessary to analyze the treatment effectiveness of these systems in real time to determine whether treatment requirements or discharge standards are met. Furthermore, fluctuations in the composition and concentration of the influent to the systems can also affect the treatment efficiency of the oily wastewater.
[0003] Existing methods for measuring emulsified oil in wastewater mainly employ traditional infrared and ultraviolet (UV) methods. These methods are cumbersome and time-consuming, failing to meet the need for rapid on-site assessment of oily wastewater treatment effectiveness and hindering timely process adjustments. Furthermore, portable equipment based on infrared and UV principles suffers from low measurement accuracy, and both methods require redrawing standard curves for different types of oil being tested, resulting in limited application flexibility. Current image recognition-based wastewater treatment effectiveness analysis methods primarily rely on identifying and analyzing macroscopic images of wastewater and flocs in the water. However, accuracy is difficult to guarantee, and these methods often rely on machine learning, which lacks generalization ability for unknown application scenarios.
[0004] Therefore, there is an urgent need to propose a rapid and accurate method for measuring and analyzing the treatment effect of oily wastewater. Summary of the Invention
[0005] The purpose of this invention is to provide a method for analyzing the treatment effect of oily wastewater based on image recognition, which effectively solves the problems of traditional methods such as infrared and ultraviolet methods for measuring oil content in water, which require a lot of instruments and equipment, are cumbersome to operate, are time-consuming, and have poor adaptability to different scenarios.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0007] A method for analyzing the treatment effect of oily wastewater based on image recognition includes the following steps: S1. Determine the oily wastewater treatment device, collect multiple wastewater samples of the influent and effluent from the device at different time periods, obtain floating oil and water samples containing emulsified oil by settling and stratification, and measure the carbon content of the floating oil and the emulsified oil content of the water sample in each wastewater sample to obtain the average carbon content n of the oily wastewater treatment device and the emulsified oil content C of the influent. 进 and the content of emulsified oil in the effluent C 出 .
[0008] S2. Determine the emulsified oil content range based on the influent and effluent emulsified oil content of each wastewater sample. Use floating oil to prepare wastewater samples with different concentration gradients within the emulsified oil content range, and perform full emulsification so that the oil forms emulsified oil droplets that are evenly distributed in the water.
[0009] S3. Use an optical microscope to photograph and save wastewater samples with different concentration gradients to form a microscopic image database of wastewater samples with different emulsified oil contents.
[0010] S4. Perform image enhancement processing on the microscopic image of the sewage sample obtained in step S3.
[0011] S5. Label the emulsified oil droplets in the microscopic image of the sewage sample enhanced in step S4 to obtain the number and volume of emulsified oil droplets in different water samples, construct the sample dataset required for training the target detection model, and divide the sample dataset into training set, validation set and test set.
[0012] S6. Use the target detection model to train and learn the correlation between the number, volume and color of emulsified oil droplets in the microscopic images of sewage samples of different concentrations and the images captured.
[0013] S7. Real-time sampling of the influent and effluent of the oily wastewater treatment device is performed. Microscopic images are captured using an optical microscope at the same magnification and image resolution as in step S3. The target detection model trained in step S6 is used for identification, and the emulsified oil content of the oily wastewater predicted by the target detection model is output. The oily wastewater treatment effect of the oily wastewater treatment device is analyzed in real time by the emulsified oil content of the influent, the emulsified oil content of the effluent, and the separation efficiency index.
[0014] Furthermore, during the shooting process in step S3, the magnification and image resolution of the optical microscope are set to fixed values, and the same magnification and image resolution are used for observation and shooting when analyzing the processing effect in step S7.
[0015] Furthermore, in step S4, color correction, contrast enhancement, multi-scale feature fusion, and detail enhancement algorithms are used to correct and overcome the problems of color distortion, low contrast, and unclear details in the underwater images acquired due to scattering and attenuation of light as it propagates in water.
[0016] Furthermore, in step S5, the emulsified oil droplets in the enhanced microscopic image of the sewage sample are labeled using the target detection dataset annotation tool.
[0017] Furthermore, in step S6, the number of emulsified oil droplets is represented by the counting variable count. For each emulsified oil droplet target identified by the target detection model, the emulsified oil droplet target count variable count = count + 1. When all emulsified oil droplets in the microscopic image of the sewage sample have been identified, the count value is the total number of emulsified oil droplet targets identified.
[0018] Furthermore, in step S6, the actual volume of the emulsified oil droplet is represented by the area of the label box, the detection volume of the emulsified oil droplet is represented by the area of the recognition box, and the areas of the label box and the recognition box are calculated by coordinates.
[0019] Furthermore, in step S6, the color of the emulsified oil droplets is represented by grayscale and RGB vector values, and the color features of different oils are learned through the feature extraction module of the target detection model.
[0020] Furthermore, in step S6, the performance of the object detection model is evaluated by monitoring the recognition accuracy, recall rate, and intersection-union ratio during the training process. Multiple rounds of training are carried out, and the hyperparameters epoch and batch_size are dynamically adjusted according to the trend of the indicators so that the recognition accuracy, recall rate, and intersection-union ratio of the trained object detection model reach the expected values.
[0021] Furthermore, due to different treatment processes, the volume of emulsified oil distributed in water varies among different oily wastewater treatment devices; different oils also exhibit different colors in the microscopic images of wastewater samples. The type of oil is determined by the average carbon content n of the oil. When the difference in n is less than 5, they are considered to be the same type of oil.
[0022] Furthermore, when applied to the same set of oily wastewater treatment equipment and the same type of oil, the volume and color of the emulsified oil droplets in the influent and effluent of the oily wastewater treatment equipment are similar, and the oil content depends on the number of emulsified oil droplets.
[0023] Furthermore, in step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents, an engineering mathematical model of the number of emulsified oil droplets x and the oil content C is established.
[0024] In step S6, a lightweight target detection model is selected, and through multiple rounds of training, the recognition accuracy and recall rate of the target detection model reach above 0.9.
[0025] In step S7, the number of emulsified oil droplets obtained from the microscopic image recognition is substituted into the engineering mathematical model to calculate the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
[0026] Furthermore, when applied to the treatment effect analysis of different oily wastewater treatment devices and the same type of oil, the colors of the emulsified oil droplets in the influent and effluent of the oily wastewater treatment device are similar, and the oil content depends on the number and volume of the emulsified oil droplets.
[0027] Furthermore, in step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil content and different oil treatment devices, the number of emulsified oil droplets and the volume S of each emulsified oil droplet in wastewater samples with different oil content are obtained. i The total volume S of emulsified oil droplets in the wastewater sample was calculated as follows: Where x represents the number of emulsified oil droplets in the wastewater sample, an engineering mathematical model is established for the total volume S of the emulsified oil droplets and the oil content C.
[0028] In step S6, a lightweight target detection model is selected, and an algorithm for summing the area of the recognition box is added. Through multiple rounds of training, the recognition accuracy, recall rate, and intersection-union ratio of the target detection model are made to reach above 0.9.
[0029] In step S7, the total volume S of the emulsified oil droplets is calculated from the count variable value and the area of the recognition box obtained from the microscopic image recognition. This volume is then substituted into the engineering mathematical model to calculate the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
[0030] Furthermore, when applied to the same oily wastewater treatment device and the treatment effect analysis of different types of oil, the volume of emulsified oil droplets in the influent and effluent of the oily wastewater treatment device is similar, and the oil content depends on the number and color of the emulsified oil droplets.
[0031] Furthermore, in step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number and color of emulsified oil droplets in wastewater samples with different oil contents is obtained.
[0032] In step S6, a target detection model containing feature extraction enhancement algorithm is selected. The target detection model is trained to learn the relationship between oil content and the count variable count value and the grayscale and RGB vector values of the oil droplet image. Through multiple rounds of training, the recognition accuracy and recall rate of the target detection model reach more than 0.9.
[0033] In step S7, the count value of the emulsified oil droplets obtained from microscopic image recognition, along with the image grayscale and RGB vector values, are used by the target detection model to predict the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.
[0034] Furthermore, when applied to the analysis of treatment effects of different oily wastewater treatment devices and different types of oil, the oil content depends on the number, volume, and color of the emulsified oil droplets.
[0035] Furthermore, in step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number, volume, and color of emulsified oil droplets in wastewater samples with different oil contents is obtained.
[0036] In step S6, a target detection model that includes a feature extraction enhancement algorithm and a self-attention mechanism is selected. The target detection model is trained to learn the relationship between oil content and the count variable count value, the area of the bounding box, the gray level of the oil drop image, and the RGB vector value. Through multiple rounds of training, the recognition accuracy, recall rate, and intersection-union ratio of the target detection model reach more than 0.9.
[0037] In step S7, the count value of the emulsified oil droplets, the area of the recognition box, the image grayscale value, and the RGB vector value obtained from the microscopic image recognition are used to predict the emulsified oil content C in the influent of the oily wastewater treatment device through the target detection model. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.
[0038] Compared with the prior art, the beneficial effects of the present invention are:
[0039] (1) This invention combines deep learning-based target detection technology with microscopic images of oily wastewater. The target detection model is used to learn and train the features such as the number, volume and color of emulsified oil droplets in wastewater with different oil content, treatment processes and oil types. In the field application process, the target detection model is used to identify and calculate the microscopic images of oily wastewater, thereby quickly predicting the oil content and realizing real-time analysis of the treatment effect of oily wastewater.
[0040] (2) Compared with traditional infrared and ultraviolet methods for measuring oil content, this invention can quickly measure the emulsified oil content in water, is easy to operate, realizes real-time analysis of the treatment effect of oily wastewater, and is highly adaptable to changes in application scenarios.
[0041] (3) Compared with existing image recognition analysis technology for macroscopic images of sewage, the present invention can perform quantitative calculation and analysis, and is more operable and more accurate. Attached Figure Description
[0042] Figure 1 This is a flowchart of the image recognition-based method for analyzing the treatment effect of oily wastewater according to the present invention.
[0043] Figure 2This is a flowchart illustrating the implementation plan for the image recognition-based oily wastewater treatment effect analysis method of the present invention under different application conditions. Detailed Implementation
[0044] A method for analyzing the treatment effect of oily wastewater based on image recognition includes the following steps: S1. Select a specific oily wastewater treatment device, collect multiple wastewater samples of the influent and effluent from the device at different time periods, and obtain floating oil and water samples containing emulsified oil by settling and stratification. Measure the carbon content of the floating oil and the emulsified oil content of the water sample in each wastewater sample to obtain the average carbon content n of the oily wastewater treatment device and the emulsified oil content C of the influent. 进 and the content of emulsified oil in the effluent C 出 .
[0045] S2. Determine the emulsified oil content range based on the influent and effluent emulsified oil content of each wastewater sample. Use floating oil to prepare wastewater samples with different concentration gradients within the emulsified oil content range, and perform full emulsification so that the oil forms emulsified oil droplets that are evenly distributed in the water.
[0046] S3. Use an optical microscope to photograph and save wastewater samples with different concentration gradients to form a microscopic image database of wastewater samples with different emulsified oil contents. During the photographing process, the magnification and image resolution of the optical microscope are set to fixed values, and the same magnification and image resolution are used for observation and photographing when analyzing the processing effect in step S7.
[0047] S4. Perform image enhancement processing on the microscopic image of the sewage sample obtained in step S3. Use color correction, contrast enhancement, multi-scale feature fusion and detail enhancement algorithms to correct the problems of color distortion, low contrast and unclear details in the underwater image obtained due to scattering and attenuation of light in water.
[0048] S5. Use the target detection dataset annotation tool to annotate the emulsified oil droplets in the microscopic image of the sewage sample enhanced in step S4, obtain the number and volume of emulsified oil droplets in different water samples, construct the sample dataset required for training the target detection model, and divide the sample dataset into training set, validation set and test set according to a certain ratio.
[0049] S6. Use the target detection model to train and learn the correlation between the number, volume and color of emulsified oil droplets in the microscopic images of sewage samples of different concentrations and the images captured.
[0050] The number of emulsified oil droplets is represented by the count variable count. For each emulsified oil droplet target identified by the target detection model, the emulsified oil droplet target count variable count = count + 1. When all emulsified oil droplets in the microscopic image of the sewage sample have been identified, the count value is the total number of emulsified oil droplet targets identified.
[0051] The actual volume of the emulsified oil droplet is represented by the area of the label box, and the detected volume of the emulsified oil droplet is represented by the area of the recognition box. The areas of the label box and the recognition box are calculated using coordinates.
[0052] The color of the emulsified oil droplets is represented by grayscale and RGB vector values. The color features of different oils are learned through the feature extraction module of the object detection model.
[0053] During training, metrics such as precision, recall, and intersection-union ratio (IOU) are monitored to evaluate the performance of the object detection model. Multiple rounds of training are conducted, and the settings of hyperparameters such as epoch and batch size are dynamically adjusted according to the trend of the metrics to ensure that the precision, recall, and IOU values of the trained object detection model reach the expected values.
[0054] S7. Real-time sampling of the influent and effluent of the oily wastewater treatment device is performed. Microscopic images are captured using an optical microscope at the same magnification and image resolution as in step S3. The target detection model trained in step S6 is used for identification, and the emulsified oil content of the oily wastewater predicted by the target detection model is output. The oily wastewater treatment effect of the oily wastewater treatment device is analyzed in real time by the emulsified oil content of the influent, the emulsified oil content of the effluent, and the separation efficiency index.
[0055] like Figure 1 As shown, the steps of the image recognition-based oily wastewater treatment effect analysis method provided by this invention can be summarized as follows:
[0056] (1) Select a wastewater treatment device, collect multiple wastewater samples of the influent and effluent of the device at different times, and measure the carbon content of the floating oil and the emulsified oil content of the water sample.
[0057] (2) Determine the range of emulsified oil content and prepare wastewater samples with different concentration gradients;
[0058] (3) Use an optical microscope to photograph the prepared sewage samples and establish a microscopic image database. Set the microscope magnification and image resolution to fixed values.
[0059] (4) Image enhancement processing is performed on the captured microscopic images, using algorithms such as color correction, contrast enhancement, multi-scale feature fusion and detail enhancement;
[0060] (5) Label the emulsified oil droplets in the enhanced microscopic images of the sewage samples to obtain the training sample dataset;
[0061] (6) Using a target detection model, train the model to learn the correlation between the number, volume and color of emulsified oil droplets in the captured microscopic images of wastewater samples of different concentrations;
[0062] (7) Use the trained target detection model to identify the microscopic images of the inlet and outlet sampled sewage, output the emulsified oil content of the oily sewage predicted by the model, and analyze the treatment effect of the oily sewage by the device.
[0063] The image recognition-based method for analyzing the treatment effect of oily wastewater provided by this invention can be applied to different oily wastewater treatment devices and different types of oil. Due to the different treatment processes of different oily wastewater treatment devices, the volume of emulsified oil distributed in water varies; different oils also exhibit color differences in the microscopic images of wastewater samples. Petrochemical enterprises deal with complex oil compositions; the type of oil can be determined by the average carbon content *n*. When the difference in *n* is less than 5, they are considered to be of the same type of oil.
[0064] like Figure 2 As shown, there are four specific application scenarios, and the implementation plan is determined according to the specific application scenarios.
[0065] (I) When the analytical method of the present invention is applied to the same set of oily wastewater treatment device and the same type of oil for treatment effect analysis, the volume and color of the emulsified oil droplets in the inlet and outlet water of the oily wastewater treatment device are similar, and the oil content depends on the number of emulsified oil droplets.
[0066] Therefore, in step S5, by labeling the emulsified oil droplets in the microscopic images of sewage samples with different oil contents, an engineering mathematical model of the number of emulsified oil droplets x and the oil content C can be established.
[0067] In step S6, a lightweight target detection model is selected, and through multiple rounds of training, the recognition accuracy and recall rate of the target detection model reach above 0.9.
[0068] In step S7, the number of emulsified oil droplets obtained from the microscopic image recognition is substituted into the engineering mathematical model to calculate the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
[0069] (II) When the analytical method of the present invention is applied to the analysis of the treatment effect of different oily wastewater treatment devices and the same type of oil, the colors of the emulsified oil droplets in the influent and effluent of the oily wastewater treatment device are similar, and the oil content depends on the number and volume of the emulsified oil droplets.
[0070] Therefore, in step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil content and different oil treatment devices, the number of emulsified oil droplets and the volume S of each emulsified oil droplet in wastewater samples with different oil content are obtained. i The total volume S of emulsified oil droplets in the wastewater sample was calculated as follows: Where x represents the number of emulsified oil droplets in the wastewater sample, an engineering mathematical model can be established for the total volume S of the emulsified oil droplets and the oil content X.
[0071] In step S6, a lightweight target detection model is selected, and an algorithm for summing the area of the recognition box is added. Through multiple rounds of training, the recognition accuracy, recall rate, and intersection-union ratio of the target detection model are made to reach above 0.9.
[0072] In step S7, the total volume S of the emulsified oil droplets is calculated from the count variable value and the area of the recognition box obtained from the microscopic image recognition. This volume is then substituted into the engineering mathematical model to calculate the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
[0073] (III) When the analytical method of the present invention is applied to the same set of oily wastewater treatment device and the treatment effect analysis of different types of oil, the volume of emulsified oil droplets in the inlet and outlet water of the oily wastewater treatment device is similar, and the oil content depends on the number and color of the emulsified oil droplets.
[0074] Therefore, in step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number and color of emulsified oil droplets in wastewater samples with different oil contents is obtained.
[0075] In step S6, a target detection model containing feature extraction enhancement algorithm is selected. The target detection model is trained to learn the relationship between oil content and the count variable count value and the grayscale and RGB vector values of the oil droplet image. Through multiple rounds of training, the recognition accuracy and recall rate of the target detection model reach more than 0.9.
[0076] In step S7, the count value of the emulsified oil droplets obtained from microscopic image recognition, along with the image grayscale and RGB vector values, are used by the target detection model to predict the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.
[0077] (IV) When the analytical method of the present invention is applied to the analysis of the treatment effect of different oily wastewater treatment devices and different types of oil, the oil content depends on the number, volume and color of the emulsified oil droplets.
[0078] Therefore, in step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number, volume, and color of emulsified oil droplets in wastewater samples with different oil contents is obtained.
[0079] In step S6, a target detection model that includes a feature extraction enhancement algorithm and a self-attention mechanism is selected. The target detection model is trained to learn the relationship between oil content and the count variable count value, the area of the bounding box, the gray level of the oil drop image, and the RGB vector value. Through multiple rounds of training, the recognition accuracy, recall rate, and intersection-union ratio of the target detection model reach more than 0.9.
[0080] In step S7, the count value of the emulsified oil droplets, the area of the recognition box, the image grayscale value, and the RGB vector value obtained from the microscopic image recognition are used to predict the emulsified oil content C in the influent of the oily wastewater treatment device through the target detection model. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.
[0081] This invention combines deep learning-based target detection technology with microscopic images of oily wastewater. It uses a target detection model to learn and train on the number, volume, and color of emulsified oil droplets in wastewater with different oil contents, treatment processes, and oil types. In field applications, the target detection model is used to identify and calculate the microscopic images of oily wastewater, thereby quickly predicting the oil content and achieving real-time analysis of the treatment effect of oily wastewater.
[0082] Compared to traditional infrared and ultraviolet methods for measuring oil content, this invention enables rapid measurement of emulsified oil content in water, is easy to operate, and allows for real-time analysis of the treatment effect of oily wastewater. It also exhibits strong adaptability to changing application scenarios. Compared to existing image recognition analysis techniques that analyze macroscopic images of wastewater, this invention allows for quantitative calculation and analysis, offering greater operability and accuracy.
[0083] The present invention will be further described in detail below with reference to specific embodiments.
[0084] Example 1: An image recognition-based method for analyzing the treatment effect of oily wastewater, comprising: S1, selecting a specific oily wastewater treatment device, collecting eight wastewater samples from the device's influent and treated effluent at four different times of the day, obtaining floating oil and water samples containing emulsified oil through settling and stratification, respectively, measuring the carbon content of the floating oil in each wastewater sample as 14.77, 15.54, 13.79, and 14.83, respectively, obtaining the average carbon content of oil in the oily wastewater treatment device n = 14.73, and measuring the emulsified oil content C in the influent. 进 The concentrations were 2.32%, 2.47%, 2.21%, and 2.18%, respectively, indicating that the water-emulsified oil content (C) was... 出The percentages were 0.51%, 0.66%, 0.25%, and 0.42%, respectively.
[0085] S2. Based on the emulsified oil content in the influent and effluent of each wastewater sample, the range of emulsified oil content is determined to be 0.25% to 2.47%. Using the floating oil obtained from the oily wastewater treatment device, 10 wastewater samples with different concentration gradients within the emulsified oil content range are prepared, with concentrations of 0.25%, 0.5%, 0.75%, 1%, 1.25%, 1.5%, 1.75%, 2%, 2.25%, and 2.5%, respectively. The samples are then fully emulsified to form emulsified oil droplets that are evenly distributed in the water.
[0086] S3. Use an optical microscope to photograph and preserve the prepared sewage samples to form a microscopic image database of sewage samples with different emulsified oil contents. The magnification during the shooting process is 800 times and the image resolution is 1920*1200. The same magnification and image resolution are used for observation and shooting in subsequent processing effect analysis.
[0087] S4. Image enhancement processing is performed on the captured microscopic images. Algorithms such as color correction, contrast enhancement, multi-scale feature fusion, and detail enhancement are used to correct these issues and overcome the problems of color distortion, low contrast, and unclear details in the underwater images caused by light scattering and attenuation during propagation in water.
[0088] S5. Use the target detection dataset annotation tool to annotate the emulsified oil droplets in the enhanced microscopic images of the sewage samples, obtain the number and volume of emulsified oil droplets in different water samples, and construct the sample dataset required to train the emulsified oil droplet target detection model. Divide the sample dataset into training set, validation set and test set according to a certain ratio.
[0089] The LabelImg object detection dataset annotation tool was used to annotate oil droplet targets in microscopic images of oily wastewater, generating a one-to-one label file corresponding to each image. The labels recorded the coordinates and size of the oil droplets in the image. The annotation mode was set to YOLO, and the annotation file format was .txt. The annotated microscopic images of wastewater samples with different concentrations were then compiled to construct the sample dataset needed to train the object detection model.
[0090] The sample dataset is divided into training, validation, and test sets in a specific ratio, such as 4:1:1 or 5:1:1, to ensure a sufficient amount of training data. The training set is used to train the object detection model, the validation set is used to verify the model's performance metrics, and the test set is used to evaluate the final object detection performance. A better-performing object detection model is obtained through iterative optimization of parameter settings.
[0091] S6. Using the object detection model YOLOv5, train the model to learn the correlation between the number, volume, and color of emulsified oil droplets in the captured microscopic images of wastewater samples of different concentrations:
[0092] The number of emulsified oil droplets is represented by the count variable count. For each emulsified oil droplet target identified by the target detection model, the emulsified oil droplet target count variable count = count + 1. When all emulsified oil droplets in the microscopic image of the sewage sample have been identified, the count value is the total number of emulsified oil droplet targets identified.
[0093] The actual volume of the emulsified oil droplet is represented by the area of the label box, and the detected volume of the emulsified oil droplet is represented by the area of the recognition box. The areas of the label box and the recognition box are calculated from the coordinates. For example, if the coordinates of a certain label box are (0.218, 0.105, 0.009, 0.015), then the area of the label box S = (0.218 - 0.009) × (0.105 - 0.015) = 0.01881. The areas of the label box and the recognition box are positively correlated with the oil droplet volume.
[0094] The color of the emulsified oil droplets is represented by grayscale and RGB vector values. The color features of different oils are learned through the feature extraction module of the object detection model. Feature extraction of the emulsified oil droplet image yields an average grayscale value of 177 and an average RGB vector value of (64, 224, 205).
[0095] During training, metrics such as precision, recall, and intersection-union ratio (IOU) are monitored to evaluate the performance of the object detection model. Multiple rounds of training are conducted, and the settings of hyperparameters such as epoch and batch size are dynamically adjusted according to the trend of the metrics to ensure that the precision, recall, and IOU values of the trained object detection model reach the expected values.
[0096] S7. Real-time sampling of the influent and effluent of the selected oily wastewater treatment device is performed. Microscopic images are taken using an optical microscope at a fixed magnification and image resolution. The trained target detection model is used for identification, and the model-predicted emulsified oil content of the oily wastewater is output. The oil content of the influent and effluent, separation efficiency, and other indicators are used to analyze the oily wastewater treatment effect of the device in real time.
[0097] When the analysis method of this embodiment is applied to the same set of oily wastewater treatment device and the same type of oil, the volume and color of the emulsified oil droplets in the influent and effluent of the oily wastewater treatment device are similar, and the oil content depends on the number of emulsified oil droplets.
[0098] In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents, an engineering mathematical model of the number of emulsified oil droplets x and the oil content C can be established.
[0099] The number of emulsified oil droplets in the microscopic images of 10 wastewater samples with different concentration gradients was labeled, and the results are shown in Table 1. Based on the data in Table 1, the relationship between the number of emulsified oil droplets and the oil content was fitted as C = -0.0002x. 2 +0.0428x-0.3541.
[0100] Table 1. Number and oil content of emulsified oil droplets in microscopic images of different wastewater samples in Example 1.
[0101]
[0102]
[0103] In step S6, a lightweight target detection model, YOLOv5s, is selected, and through multiple rounds of training, the recognition accuracy and recall rate of the target detection model reach above 0.9.
[0104] In step S7, the number of emulsified oil droplets obtained from the microscopic image recognition is substituted into the engineering mathematical model to calculate the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
[0105] Real-time sampling of the influent and effluent from a selected wastewater treatment plant was performed. Microscopic images were captured using an optical microscope at 800x magnification and 1920*1200 resolution. A trained YOLOv5s model was used to identify the number of emulsified oil droplets (x) in the influent sample. 进 =111, number of emulsified oil droplets in the effluent sample x 出 =24, substituting them into the above equations, we get C 进 =1.93%, C 出 =0.56%, the separation efficiency can be calculated as η = (C 进 -C 出 ) / C 进 ×100%=70.98%. Based on the oil content of the influent and effluent and the separation efficiency, the oily wastewater treatment effect of the selected device can be analyzed.
[0106] Example 2: An image recognition-based method for analyzing the treatment effect of oily wastewater, comprising: S1, selecting a specific oily wastewater treatment device, collecting eight wastewater samples from the device's influent and treated effluent at four different times of the day, obtaining floating oil and water samples containing emulsified oil through settling and stratification, respectively, measuring the carbon content of the floating oil in each wastewater sample as 14.77, 15.54, 13.79, and 14.83, respectively, obtaining the average carbon content of oil in the oily wastewater treatment device n = 14.73, and measuring the emulsified oil content C in the influent. 进The concentrations were 2.32%, 2.47%, 2.21%, and 2.18%, respectively, indicating that the water-emulsified oil content (C) was... 出 The percentages were 0.51%, 0.66%, 0.25%, and 0.42%, respectively.
[0107] S2. Based on the emulsified oil content in the influent and effluent of each wastewater sample, the range of emulsified oil content is determined to be 0.25% to 2.47%. Using the floating oil obtained from the oily wastewater treatment device, 10 wastewater samples with different concentration gradients within the emulsified oil content range are prepared, with concentrations of 0.25%, 0.5%, 0.75%, 1%, 1.25%, 1.5%, 1.75%, 2%, 2.25%, and 2.5%, respectively. The samples are then fully emulsified to form emulsified oil droplets that are evenly distributed in the water.
[0108] S3. Use an optical microscope to photograph and preserve the prepared sewage samples to form a microscopic image database of sewage samples with different emulsified oil contents. The magnification during the shooting process is 800 times and the image resolution is 1920*1200. The same magnification and image resolution are used for observation and shooting in subsequent processing effect analysis.
[0109] S4. Image enhancement processing is performed on the captured microscopic images. Algorithms such as color correction, contrast enhancement, multi-scale feature fusion, and detail enhancement are used to correct these issues and overcome the problems of color distortion, low contrast, and unclear details in the underwater images caused by light scattering and attenuation during propagation in water.
[0110] S5. Use the target detection dataset annotation tool to annotate the emulsified oil droplets in the enhanced microscopic images of the sewage samples, obtain the number and volume of emulsified oil droplets in different water samples, and construct the sample dataset required to train the emulsified oil droplet target detection model. Divide the sample dataset into training set, validation set and test set according to a certain ratio.
[0111] The LabelImg object detection dataset annotation tool was used to annotate oil droplet targets in microscopic images of oily wastewater, generating a one-to-one label file corresponding to each image. The labels recorded the coordinates and size of the oil droplets in the image. The annotation mode was set to YOLO, and the annotation file format was .txt. The annotated microscopic images of wastewater samples with different concentrations were then compiled to construct the sample dataset needed to train the object detection model.
[0112] The sample dataset is divided into training, validation, and test sets in a specific ratio, such as 4:1:1 or 5:1:1, to ensure a sufficient amount of training data. The training set is used to train the object detection model, the validation set is used to verify the model's performance metrics, and the test set is used to evaluate the final object detection performance. A better-performing object detection model is obtained through iterative optimization of parameter settings.
[0113] S6. Using the object detection model YOLOv5, train the model to learn the correlation between the number, volume, and color of emulsified oil droplets in the captured microscopic images of wastewater samples of different concentrations:
[0114] The number of emulsified oil droplets is represented by the count variable count. For each emulsified oil droplet target identified by the target detection model, the emulsified oil droplet target count variable count = count + 1. When all emulsified oil droplets in the microscopic image of the sewage sample have been identified, the count value is the total number of emulsified oil droplet targets identified.
[0115] The actual volume of the emulsified oil droplet is represented by the area of the label box, and the detected volume of the emulsified oil droplet is represented by the area of the recognition box. The areas of the label box and the recognition box are calculated from the coordinates. For example, if the coordinates of a certain label box are (0.218, 0.105, 0.009, 0.015), then the area of the label box S = (0.218 - 0.009) × (0.105 - 0.015) = 0.01881. The areas of the label box and the recognition box are positively correlated with the oil droplet volume.
[0116] The color of the emulsified oil droplets is represented by grayscale and RGB vector values. The color features of different oils are learned through the feature extraction module of the object detection model. Feature extraction of the emulsified oil droplet image yields an average grayscale value of 177 and an average RGB vector value of (64, 224, 205).
[0117] During training, metrics such as precision, recall, and intersection-union ratio (IOU) are monitored to evaluate the performance of the object detection model. Multiple rounds of training are conducted, and the settings of hyperparameters such as epoch and batch size are dynamically adjusted according to the trend of the metrics to ensure that the precision, recall, and IOU values of the trained object detection model reach the expected values.
[0118] S7. Real-time sampling of the influent and effluent of the selected oily wastewater treatment device is performed. Microscopic images are taken using an optical microscope at a fixed magnification and image resolution. The trained target detection model is used for identification, and the model-predicted emulsified oil content of the oily wastewater is output. The oil content of the influent and effluent, separation efficiency, and other indicators are used to analyze the oily wastewater treatment effect of the device in real time.
[0119] When the analysis method of this embodiment is applied to the treatment effect analysis of different oily wastewater treatment devices and the same type of oil, the colors of the emulsified oil droplets in the influent and effluent of the oily wastewater treatment device are similar, and the oil content depends on the number and volume of the emulsified oil droplets.
[0120] In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil content and different oil treatment devices, the number of emulsified oil droplets and the volume S of each emulsified oil droplet in wastewater samples with different oil content are obtained. i The total volume S of emulsified oil droplets in the wastewater sample was calculated as follows: Where x represents the number of emulsified oil droplets in the wastewater sample, an engineering mathematical model can be established for the total volume S of the emulsified oil droplets and the oil content C.
[0121] Five different oily wastewater treatment devices were selected, and two influent and two effluent samples were collected from each device, for a total of 10 wastewater samples. The oil content was determined, and microscopic images were taken to label the emulsified oil droplets, obtaining the number of emulsified oil droplets x and the volume S of each emulsified oil droplet. i The total volume of oil droplets and the oil content data are shown in Table 2. Based on Table 2, the relationship between the total volume of emulsified oil droplets and the oil content is fitted as C = 1.3499S - 0.1155.
[0122] Table 2. Total volume and oil content of emulsified oil droplets in microscopic images of different wastewater samples in Example 2.
[0123] Total volume S of emulsified oil droplets Oil content C / % 0.33 0.27 0.45 0.5 0.68 0.77 0.75 0.94 1.19 1.54 1.97 2.55 2.11 2.67 2.38 3.22 2.52 3.36 2.78 3.49
[0124] In step S6, the lightweight target detection model YOLOv5s is selected, and a bounding box area summation algorithm is added. Through multiple rounds of training, the target detection model's recognition accuracy, recall rate, and intersection-union ratio reach above 0.9.
[0125] In step S7, the total volume S of the emulsified oil droplets is calculated by taking the count value and the area of the recognition box obtained from the microscopic image recognition, and then substituting them into the engineering mathematical model to calculate the emulsified oil content C of the influent. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
[0126] Real-time sampling of the influent and effluent from a selected wastewater treatment plant was conducted. Microscopic images were captured using an optical microscope at 800x magnification and 1920*1200 resolution. The total volume S of emulsified oil droplets in the influent sample was determined using a trained YOLOv5s model. 进 =2.63, total volume S of emulsified oil droplets in the effluent sample 出 =0.29, substituting into the above relationship, we get C 进 =3.43%, C 出 =0.28%, the separation efficiency can be calculated as η = (C 进 -C 出 ) / C 进 ×100%=91.84%. Based on the oil content of the influent and effluent and the separation efficiency, the oily wastewater treatment effect of the selected device can be analyzed.
[0127] Example 3: An image recognition-based method for analyzing the treatment effect of oily wastewater, comprising: S1, selecting a specific oily wastewater treatment device, collecting eight wastewater samples from the device's influent and treated effluent at four different times of the day, obtaining floating oil and water samples containing emulsified oil through settling and stratification, respectively, measuring the carbon content of the floating oil in each wastewater sample as 14.77, 15.54, 13.79, and 14.83, respectively, obtaining the average oil carbon content of the oily wastewater treatment device n = 14.73, and measuring the emulsified oil content C in the influent. 进 The concentrations were 2.32%, 2.47%, 2.21%, and 2.18%, respectively, indicating that the water-emulsified oil content (C) was... 出 The percentages were 0.51%, 0.66%, 0.25%, and 0.42%, respectively.
[0128] S2. Based on the emulsified oil content in the influent and effluent of each wastewater sample, the range of emulsified oil content is determined to be 0.25% to 2.47%. Using the floating oil obtained from the oily wastewater treatment device, 10 wastewater samples with different concentration gradients within the emulsified oil content range are prepared, with concentrations of 0.25%, 0.5%, 0.75%, 1%, 1.25%, 1.5%, 1.75%, 2%, 2.25%, and 2.5%, respectively. The samples are then fully emulsified to form emulsified oil droplets that are evenly distributed in the water.
[0129] S3. The prepared wastewater samples were photographed and preserved using an optical microscope to form a microscopic image database of wastewater samples with different emulsified oil contents. The magnification during the imaging process was 800x, and the image resolution was 1920*1200. The same magnification and image resolution were used for observation and imaging in subsequent processing effect analysis.
[0130] S4. Image enhancement processing is performed on the captured microscopic images. Algorithms such as color correction, contrast enhancement, multi-scale feature fusion, and detail enhancement are used to correct these issues and overcome the problems of color distortion, low contrast, and unclear details in the underwater images caused by light scattering and attenuation during propagation in water.
[0131] S5. Use the target detection dataset annotation tool to annotate the emulsified oil droplets in the enhanced microscopic images of the sewage samples, obtain the number and volume of emulsified oil droplets in different water samples, and construct the sample dataset required to train the emulsified oil droplet target detection model. Divide the sample dataset into training set, validation set and test set according to a certain ratio.
[0132] The LabelImg object detection dataset annotation tool was used to annotate oil droplet targets in microscopic images of oily wastewater, generating a one-to-one label file corresponding to each image. The labels recorded the coordinates and size of the oil droplets in the image. The annotation mode was set to YOLO, and the annotation file format was .txt. The annotated microscopic images of wastewater samples with different concentrations were then compiled to construct the sample dataset needed to train the object detection model.
[0133] The sample dataset is divided into training, validation, and test sets in a specific ratio, such as 4:1:1 or 5:1:1, to ensure a sufficient amount of training data. The training set is used to train the object detection model, the validation set is used to verify the model's performance metrics, and the test set is used to evaluate the final object detection performance. A better-performing object detection model is obtained through iterative optimization of parameter settings.
[0134] S6. Using the object detection model YOLOv5, train the model to learn the correlation between the number, volume, and color of emulsified oil droplets in the captured microscopic images of wastewater samples of different concentrations:
[0135] The number of emulsified oil droplets is represented by the count variable count. For each emulsified oil droplet target identified by the target detection model, the emulsified oil droplet target count variable count = count + 1. When all emulsified oil droplets in the microscopic image of the sewage sample have been identified, the count value is the total number of emulsified oil droplet targets identified.
[0136] The actual volume of the emulsified oil droplet is represented by the area of the label box, and the detected volume of the emulsified oil droplet is represented by the area of the recognition box. The areas of the label box and the recognition box are calculated from the coordinates. For example, if the coordinates of a certain label box are (0.218, 0.105, 0.009, 0.015), then the area of the label box S = (0.218 - 0.009) × (0.105 - 0.015) = 0.01881. The areas of the label box and the recognition box are positively correlated with the oil droplet volume.
[0137] The color of the emulsified oil droplets is represented by grayscale and RGB vector values. The color features of different oils are learned through the feature extraction module of the object detection model. Feature extraction of the emulsified oil droplet image yields an average grayscale value of 177 and an average RGB vector value of (64, 224, 205).
[0138] During training, metrics such as precision, recall, and intersection-union ratio (IOU) are monitored to evaluate the performance of the object detection model. Multiple rounds of training are conducted, and the settings of hyperparameters such as epoch and batch size are dynamically adjusted according to the trend of the metrics to ensure that the precision, recall, and IOU values of the trained object detection model reach the expected values.
[0139] S7. Real-time sampling of the influent and effluent of the selected oily wastewater treatment device is performed. Microscopic images are taken using an optical microscope at a fixed magnification and image resolution. The trained target detection model is used for identification, and the model-predicted emulsified oil content of the oily wastewater is output. The oil content of the influent and effluent, separation efficiency, and other indicators are used to analyze the oily wastewater treatment effect of the device in real time.
[0140] When the analysis method of this embodiment is applied to the same set of oily wastewater treatment device and the treatment effect analysis of different types of oil, the volume of emulsified oil droplets in the influent and effluent of the oily wastewater treatment device is similar, and the oil content depends on the number and color of the emulsified oil droplets.
[0141] In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number and color of emulsified oil droplets in wastewater samples with different oil contents is obtained.
[0142] Two types of oily wastewater were selected to measure the average carbon content (n) of the oil. The results were n1 = 14.73 and n2 = 9.15, respectively. Since n1 - n2 > 5, they were identified as different types of oil. The grayscale of the emulsified oil droplet images in the microscopic images of the two types of oily wastewater with different concentrations was measured. The average grayscale values were 177 and 149, respectively, and the average RGB vector values were (64, 224, 205) and (55, 207, 205), respectively. It can be seen that as the carbon content decreases, both the grayscale value and the RGB vector value decrease. A database of the number of emulsified oil droplets and the grayscale and RGB vector values of each oil droplet image was established.
[0143] In step S6, the target detection model YOLOv5x, which includes a feature extraction enhancement algorithm, is selected. The target detection model is trained to learn the relationship between oil content and the count variable count value and the grayscale and RGB vector values of the oil drop image. Through multiple rounds of training, the recognition accuracy and recall rate of the target detection model reach more than 0.9.
[0144] In step S7, the count value of the emulsified oil droplets obtained from microscopic image recognition, along with the image grayscale and RGB vector values, are used by the target detection model to predict the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.
[0145] Example 4: An image recognition-based method for analyzing the treatment effect of oily wastewater, comprising: S1, selecting a specific oily wastewater treatment device, collecting eight wastewater samples from the device's influent and treated effluent at four different times of the day, obtaining floating oil and water samples containing emulsified oil through settling and stratification, respectively, measuring the carbon content of the floating oil in each wastewater sample as 14.77, 15.54, 13.79, and 14.83, respectively, obtaining the average carbon content of oil in the oily wastewater treatment device n = 14.73, and measuring the emulsified oil content C in the influent. 进 The concentrations were 2.32%, 2.47%, 2.21%, and 2.18%, respectively, indicating that the water-emulsified oil content (C) was... 出 The percentages were 0.51%, 0.66%, 0.25%, and 0.42%, respectively.
[0146] S2. Based on the emulsified oil content in the influent and effluent of each wastewater sample, the range of emulsified oil content is determined to be 0.25% to 2.47%. Using the floating oil obtained from the oily wastewater treatment device, 10 wastewater samples with different concentration gradients within the emulsified oil content range are prepared, with concentrations of 0.25%, 0.5%, 0.75%, 1%, 1.25%, 1.5%, 1.75%, 2%, 2.25%, and 2.5%, respectively. The samples are then fully emulsified to form emulsified oil droplets that are evenly distributed in the water.
[0147] S3. The prepared wastewater samples were photographed and preserved using an optical microscope to form a microscopic image database of wastewater samples with different emulsified oil contents. The magnification during the imaging process was 800x, and the image resolution was 1920*1200. The same magnification and image resolution were used for observation and imaging in subsequent processing effect analysis.
[0148] S4. Image enhancement processing is performed on the captured microscopic images. Algorithms such as color correction, contrast enhancement, multi-scale feature fusion, and detail enhancement are used to correct these issues and overcome the problems of color distortion, low contrast, and unclear details in the underwater images caused by light scattering and attenuation during propagation in water.
[0149] S5. Use the target detection dataset annotation tool to annotate the emulsified oil droplets in the enhanced microscopic images of the sewage samples, obtain the number and volume of emulsified oil droplets in different water samples, and construct the sample dataset required to train the emulsified oil droplet target detection model. Divide the sample dataset into training set, validation set and test set according to a certain ratio.
[0150] The LabelImg object detection dataset annotation tool was used to annotate oil droplet targets in microscopic images of oily wastewater, generating a one-to-one label file corresponding to each image. The labels recorded the coordinates and size of the oil droplets in the image. The annotation mode was set to YOLO, and the annotation file format was .txt. The annotated microscopic images of wastewater samples with different concentrations were then compiled to construct the sample dataset needed to train the object detection model.
[0151] The sample dataset is divided into training, validation, and test sets in a specific ratio, such as 4:1:1 or 5:1:1, to ensure a sufficient amount of training data. The training set is used to train the object detection model, the validation set is used to verify the model's performance metrics, and the test set is used to evaluate the final object detection performance. A better-performing object detection model is obtained through iterative optimization of parameter settings.
[0152] S6. Using the object detection model YOLOv5, train the model to learn the correlation between the number, volume, and color of emulsified oil droplets in the captured microscopic images of wastewater samples of different concentrations:
[0153] The number of emulsified oil droplets is represented by the count variable count. For each emulsified oil droplet target identified by the target detection model, the emulsified oil droplet target count variable count = count + 1. When all emulsified oil droplets in the microscopic image of the sewage sample have been identified, the count value is the total number of emulsified oil droplet targets identified.
[0154] The actual volume of the emulsified oil droplet is represented by the area of the label box, and the detected volume of the emulsified oil droplet is represented by the area of the recognition box. The areas of the label box and the recognition box are calculated from the coordinates. For example, if the coordinates of a certain label box are (0.218, 0.105, 0.009, 0.015), then the area of the label box S = (0.218 - 0.009) × (0.105 - 0.015) = 0.01881. The areas of the label box and the recognition box are positively correlated with the oil droplet volume.
[0155] The color of the emulsified oil droplets is represented by grayscale and RGB vector values. The color features of different oils are learned through the feature extraction module of the object detection model. Feature extraction of the emulsified oil droplet image yields an average grayscale value of 177 and an average RGB vector value of (64, 224, 205).
[0156] During training, metrics such as precision, recall, and intersection-union ratio (IOU) are monitored to evaluate the performance of the object detection model. Multiple rounds of training are conducted, and the settings of hyperparameters such as epoch and batch size are dynamically adjusted according to the trend of the metrics to ensure that the precision, recall, and IOU values of the trained object detection model reach the expected values.
[0157] S7. Real-time sampling of the influent and effluent of the selected oily wastewater treatment device is performed. Microscopic images are taken using an optical microscope at a fixed magnification and image resolution. The trained target detection model is used for identification, and the model-predicted emulsified oil content of the oily wastewater is output. The oil content of the influent and effluent, separation efficiency, and other indicators are used to analyze the oily wastewater treatment effect of the device in real time.
[0158] When the analytical method of this embodiment is applied to the analysis of the treatment effect of different oily wastewater treatment devices and different types of oil, the oil content depends on the number, volume and color of the emulsified oil droplets.
[0159] In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number, volume, and color of emulsified oil droplets in wastewater samples with different oil contents is obtained.
[0160] In step S6, the target detection model YOLOv5x, which includes a feature extraction enhancement algorithm and a self-attention mechanism, is selected. The feature extraction enhancement algorithm uses a feature pyramid network, and the self-attention mechanism uses the Swin-transformer module. The target detection model is trained to learn the relationship between oil content and the count variable count value, the area of the bounding box, the gray level of the oil drop image, and the RGB vector value. Through multiple rounds of training, the recognition accuracy, recall rate, and intersection-union ratio of the target detection model reach more than 0.9.
[0161] In step S7, the count value of the emulsified oil droplets, the area of the recognition box, the image grayscale value, and the RGB vector value obtained from the microscopic image recognition are used to predict the emulsified oil content C in the influent of the oily wastewater treatment device through the target detection model. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.
[0162] Of course, the above description is not intended to limit the present invention, and the present invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of the present invention should also fall within the protection scope of the present invention.
Claims
1. A method for analyzing the treatment effect of oily wastewater based on image recognition, characterized in that, Includes the following steps: S1. Identify the oily wastewater treatment device and collect multiple wastewater samples of the influent and effluent from the device at different time periods. Through settling and stratification, obtain samples containing floating oil and emulsified oil. Measure the carbon content of the floating oil and the emulsified oil content of the water sample in each wastewater sample to obtain the average carbon content (n) of the oily wastewater treatment device and the average emulsified oil content (C) of the influent. 进 and the content of emulsified oil in the effluent C 出 ; S2. Determine the emulsified oil content range based on the influent and effluent emulsified oil content of each wastewater sample. Use floating oil to prepare wastewater samples with different concentration gradients within the emulsified oil content range and perform full emulsification so that the oil forms emulsified oil droplets that are evenly distributed in the water. S3. Use an optical microscope to photograph and save wastewater samples with different concentration gradients to form a microscopic image database of wastewater samples with different emulsified oil contents. S4. Perform image enhancement processing on the microscopic image of the sewage sample obtained in step S3; S5. Label the emulsified oil droplets in the microscopic image of the sewage sample enhanced in step S4 to obtain the number and volume of emulsified oil droplets in different water samples, construct the sample dataset required for training the target detection model, and divide the sample dataset into training set, validation set and test set; S6. Use the target detection model to train and learn the correlation between the number, volume and color of emulsified oil droplets in the microscopic images of sewage samples with different concentrations. S7. Real-time sampling of the influent and effluent of the oily wastewater treatment device is performed. Microscopic images are captured using an optical microscope at the same magnification and image resolution as in step S3. The target detection model trained in step S6 is used for identification, and the emulsified oil content of the oily wastewater predicted by the target detection model is output. The oily wastewater treatment effect of the oily wastewater treatment device is analyzed in real time by the emulsified oil content of the influent, the emulsified oil content of the effluent, and the separation efficiency index.
2. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 1, characterized in that, During the shooting process in step S3, the magnification and image resolution of the optical microscope are set to fixed values. In step S7, when analyzing the processing effect, the same magnification and image resolution are used for observation and shooting.
3. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 2, characterized in that, In step S4, color correction, contrast enhancement, multi-scale feature fusion, and detail enhancement algorithms are used to correct and overcome the problems of color distortion, low contrast, and unclear details in the underwater images acquired due to scattering and attenuation of light as it propagates in water.
4. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 3, characterized in that, In step S5, the emulsified oil droplets in the enhanced microscopic image of the sewage sample are labeled using the target detection dataset annotation tool.
5. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 4, characterized in that, In step S6, the number of emulsified oil droplets is represented by the counting variable count. For each emulsified oil droplet target identified by the target detection model, the emulsified oil droplet target count variable count = count + 1. When all emulsified oil droplets in the microscopic image of the sewage sample have been identified, the count value is the total number of emulsified oil droplet targets identified.
6. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 5, characterized in that, In step S6, the actual volume of the emulsified oil droplet is represented by the area of the label box, the detection volume of the emulsified oil droplet is represented by the area of the recognition box, and the areas of the label box and the recognition box are calculated by coordinates.
7. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 6, characterized in that, In step S6, the color of the emulsified oil droplets is represented by grayscale and RGB vector values, and the color features of different oils are learned by the feature extraction module of the target detection model.
8. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 7, characterized in that, In step S6, the performance of the object detection model is evaluated by monitoring the recognition accuracy, recall rate, and intersection-union ratio during the training process. Multiple rounds of training are carried out, and the hyperparameters epoch and batch_size are dynamically adjusted according to the trend of the indicators so that the recognition accuracy, recall rate, and intersection-union ratio of the trained object detection model reach the expected values.
9. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 8, characterized in that, Different oily wastewater treatment devices have different treatment processes, resulting in differences in the volume of emulsified oil distributed in the water. Different oils also show different colors in the microscopic images of wastewater samples. The type of oil is determined by the average carbon content n of the oil. When the difference in n is less than 5, the oils are considered to be of the same type.
10. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 9, characterized in that, When applied to the same set of oily wastewater treatment equipment and the same type of oil, the volume and color of the emulsified oil droplets in the influent and effluent of the oily wastewater treatment equipment are similar, and the oil content depends on the number of emulsified oil droplets.
11. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 10, characterized in that, In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents, an engineering mathematical model of the number of emulsified oil droplets x and the oil content C is established. In step S6, a lightweight target detection model is selected, and through multiple rounds of training, the recognition accuracy and recall rate of the target detection model reach above 0.
9. In step S7, the number of emulsified oil droplets obtained from the microscopic image recognition is substituted into the engineering mathematical model to calculate the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
12. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 9, characterized in that, When applied to the treatment effect analysis of different oily wastewater treatment devices and the same type of oil, the colors of the emulsified oil droplets in the influent and effluent of the oily wastewater treatment device are similar, and the oil content depends on the number and volume of the emulsified oil droplets.
13. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 12, characterized in that, In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil content and different oil treatment devices, the number of emulsified oil droplets and the volume S of each emulsified oil droplet in wastewater samples with different oil content are obtained. i The total volume S of emulsified oil droplets in the wastewater sample was calculated as follows: Where x represents the number of emulsified oil droplets in the wastewater sample, an engineering mathematical model is established for the total volume S of emulsified oil droplets and the oil content C; In step S6, a lightweight target detection model is selected, and an algorithm for summing the area of the recognition box is added. Through multiple rounds of training, the recognition accuracy, recall rate, and intersection-union ratio of the target detection model are made to reach above 0.
9. In step S7, the total volume S of the emulsified oil droplets is calculated from the count variable value and the area of the recognition box obtained from the microscopic image recognition. This volume is then substituted into the engineering mathematical model to calculate the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 And the separation efficiency η.
14. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 9, characterized in that, When applied to the same oily wastewater treatment device and the treatment effect analysis of different types of oil, the volume of emulsified oil droplets in the influent and effluent of the oily wastewater treatment device is similar, and the oil content depends on the number and color of the emulsified oil droplets.
15. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 14, characterized in that, In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number and color of emulsified oil droplets in wastewater samples with different oil contents is obtained. In step S6, a target detection model containing feature extraction enhancement algorithm is selected. The target detection model is trained to learn the relationship between oil content and the count variable count value and the gray and RGB vector values of the oil drop image. Through multiple rounds of training, the recognition accuracy and recall rate of the target detection model can reach above 0.
9. In step S7, the count value of the emulsified oil droplets obtained from microscopic image recognition, along with the image grayscale and RGB vector values, are used by the target detection model to predict the emulsified oil content C in the influent of the oily wastewater treatment device. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.
16. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 9, characterized in that, When applied to the analysis of the treatment effects of different oily wastewater treatment devices and different types of oil, the oil content depends on the number, volume, and color of the emulsified oil droplets.
17. The method for analyzing the treatment effect of oily wastewater based on image recognition according to claim 16, characterized in that, In step S5, by labeling the emulsified oil droplets in the microscopic images of wastewater samples with different oil contents and different treated oils, a database of the number, volume, and color of emulsified oil droplets in wastewater samples with different oil contents is obtained. In step S6, a target detection model that includes a feature extraction enhancement algorithm and a self-attention mechanism is selected. The target detection model is trained to learn the relationship between oil content and the count variable count value, the area of the bounding box, the gray level of the oil drop image, and the RGB vector value. Through multiple rounds of training, the recognition accuracy, recall rate, and intersection-union ratio of the target detection model reach more than 0.
9. In step S7, the count value of the emulsified oil droplets, the area of the recognition box, the image grayscale value, and the RGB vector value obtained from the microscopic image recognition are used to predict the emulsified oil content C in the influent of the oily wastewater treatment device through the target detection model. 进 1. Emulsified oil content in effluent (C) 出 The separation efficiency η was calculated.