Intelligent identification method for multi-type unknown water samples based on physicochemical characteristics
Patent Information
- Application Number
- CN202610929987.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-25
- Publication Date
- 2026-10-16
AI Technical Summary
(1)多针对单一类型水样(如仅专注于自来水检测或污水检测),未系统梳理自来水、污水、海水之间的核心理化参数差异,更未考虑各类水样混合后的特征变化规律,导致面对混合水样时易出现误判、漏判问题
(1)设计视觉粗分与理化精分的分层递进式水样鉴定框架:采用RGB颜色空间、Canny边缘检测的图像视觉技术,先将未知水样快速粗分为A类(洁净类)、B类(污染类)两大层级;再针对不同层级水样匹配专属检测参数与鉴定逻辑;
Smart Images

Figure CN122929256A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of water sample detection technology based on computer vision, and particularly relates to an intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics. Background Technology
[0002] Water resource security is a core issue concerning people's health, ecological environment protection, and sustainable industrial development. Accurate identification of tap water, sewage, seawater, and various mixed water samples is a prerequisite for water quality monitoring, pollution prevention and control, emergency response, and rational resource utilization. Existing water sample identification technologies have many bottlenecks and cannot meet the core needs of rapid, accurate, and multi-scenario adaptability in practical applications.
[0003] Current water sample identification techniques mainly suffer from the following problems: (1) Existing technologies often target single types of water samples (such as focusing only on tap water or sewage testing), without systematically analyzing the differences in core physicochemical parameters between tap water, sewage, and seawater, and without considering the characteristic changes after mixing various types of water samples. This leads to misjudgment and missed judgment when dealing with mixed water samples. At the same time, existing technologies often rely on single physicochemical parameters (such as turbidity and pH value) for judgment, which is difficult to meet the identification needs in complex water environments. (2) Existing identification methods are inefficient and cannot meet the rapid response needs of scenarios such as emergency monitoring. Traditional water quality monitoring processes require manual sampling, tedious laboratory analysis, and data entry, which can take several hours or even days, resulting in significant data lag. Even some existing intelligent identification models often employ complex algorithms, which place high demands on equipment performance, making lightweight deployment difficult and unsuitable for scenarios such as rapid on-site detection and portable monitoring, thus limiting their practicality. (3) Industry development and practical applications have placed higher demands on water sample identification technology. With the increasing efforts in ecological and environmental protection, the growing demand for urban and rural water supply security, and the development of industries such as seawater desalination and wastewater treatment and reuse, the requirements for the efficiency, accuracy, and scenario adaptability of identification of tap water, sewage, seawater, and mixed water samples are constantly increasing. The limitations of existing technologies have become a bottleneck restricting the intelligent and refined development of water quality monitoring, and there is an urgent need for an intelligent identification technology that can take into account multiple types of water samples, is fast and accurate, and is lightweight to fill the gap. Summary of the Invention
[0004] To address the above problems, this invention proposes an intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics, comprising the following steps: S1. Place the unknown water sample in a transparent test tube and capture the water sample image with a camera in front of a white background. After image enhancement of the captured water sample image, identify the image color according to the RGB color space theory to determine the transparency feature, and use the Canny edge detection method to identify the image edge feature to determine the oil separation or suspended matter feature. If the water sample color is white and the water sample is determined to have no oil separation or suspended matter, the sample is classified as Class A; otherwise, it is classified as Class B. S2, for Class A water samples, extract chloride ion concentration parameters to determine whether the sample is tap water, seawater, or a mixture of tap water and seawater; S3, for Class B water samples, extracts pH and conductivity parameters to jointly define typical industrial wastewater; For water samples that do not belong to typical industrial wastewater, additional measurements are taken of turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration. The rapid feature matching model for atypical industrial wastewater is used to identify whether the sample belongs to aquaculture wastewater, landfill leachate, industrial wastewater, or a mixed water sample. S4, for water samples with low confidence in the rapid feature matching model identification results, redefine the water sample category by measuring its biochemical oxygen demand and chemical oxygen demand.
[0005] Preferably, in step S1, image acquisition is performed on the water sample to be tested in the transparent test tube under the conditions of a white background and supplemental lighting from directly above. The acquired water sample image is then enhanced using a homomorphic filtering method. The specific process is as follows: The original image is converted into a digital signal, represented as the product of the illumination and reflection components, to obtain the digital image signal. ; Convert the character image to the frequency domain using Fourier transform: ; In the formula, Indicates to After taking the logarithm of the coordinate position, perform a Fourier transform on the pixel. Indicates to The coordinate position is obtained by performing a Fourier transform on the logarithmic illumination component. Indicates to The coordinate position is obtained by taking the logarithmic reflection component and performing a Fourier transform; Mapped to the frequency domain The pixel at the coordinate position is processed by a high-pass filter to obtain the filtered result. ; The image is converted back from the frequency domain to the time domain using the inverse Fourier transform, yielding the corresponding time-domain transformation result. ; Restore the function by taking the logarithm of both sides simultaneously using the exponential function: ; In the formula, This represents a mathematical operation that restores the natural logarithm. express The result of homomorphic filtering on the pixels at the location.
[0006] Preferably, the step of determining image color based on RGB color space theory specifically involves: A pixel is classified as white if it simultaneously meets the following conditions: ; ; ; ; ; ; Count the number of pixels (Cont) in the image, and count the number of pixels (Cont_w) that are identified as white. If the condition is met... ; The image color is then determined to be white.
[0007] Preferably, the specific process of identifying image edge features and determining oil separation or suspended matter features using the Canny edge detection method is as follows: Applying a Gaussian function to smooth the detected image, represented in convolution form, is as follows: ; In the formula, Indicates The result of Gaussian filtering on the pixels at the given location. Represents the Gaussian function. express The result of homomorphic filtering on the pixels at the location; Calculate all pixels using the Canny operator The gradient magnitude at that point, This means that the following formula is satisfied: ; In the formula, express The position of the pixel in its x The square of the first-order difference in the direction, express The position of the pixel in its y The square of the first-order difference in the direction; The gradient has a direction angle that satisfies the following relationship. ; In the formula, express The direction angle of the position express The position of the pixel in its x First-order difference in direction, express The position of the pixel in its y First-order difference in direction; Iterate through all pixels in the gradient image, comparing each pixel with itself and its corresponding pixel. Two pixels in the direction; set pixels whose gradient magnitude is not greater than that of the two pixels in their neighborhood to zero; After calculation by the Canny operator, the image shows edge features, which indicates that the water sample to be tested has oil separation or suspended matter.
[0008] Preferably, in step S2, the specific determination threshold includes: Tap water threshold: chloride ion concentration ≤250mg / L; Seawater threshold: Chloride ion concentration ≥19350 mg / L; Threshold for mixed tap water and seawater samples: 250 mg / L < chloride ion concentration < 19350 mg / L.
[0009] Preferably, in step S3, for Class B water samples, pH and conductivity parameters are extracted to jointly define typical industrial wastewater, specifically as follows: Insert the pH meter probe into the water sample of type B, stir the water sample, and record the pH value after the reading stabilizes. Each group of samples is tested twice in parallel, and the average value is calculated. Insert the conductivity meter probe into the Class B water sample to be tested, ensuring the probe is completely submerged and does not touch the bottom of the sample bottle. After the reading stabilizes, record the conductivity value. Each group of samples is tested twice in parallel, and the average value is calculated. The pH threshold is defined as pH < 6.0 or pH > 9.0, and the conductivity threshold is conductivity ≥ 2000. If a Class B water sample meets both the pH threshold and conductivity threshold criteria, it is determined that the Class B water sample belongs to typical industrial wastewater.
[0010] Preferably, the rapid feature matching model for atypical industrial wastewater is constructed using a lightweight support vector machine. The inputs are normalized parameters including pH threshold, conductivity, turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration. The outputs are the water sample category and its confidence level. A grid search method is used to determine the penalty coefficient C and the kernel function parameter γ, and the search range for the penalty coefficient C is set to
[10] . -3 10 3 The search range for the kernel function parameter γ is
[10] . -4 10 4 ].
[0011] Preferably, in step S4, for water samples in category B where the confidence level of the rapid feature matching model identification result is less than 90%, the biochemical oxygen demand (BOD5) and chemical oxygen demand (COD) are measured, and a sub-category determination standard is defined for classifying the water sample as aquaculture wastewater, landfill leachate, industrial wastewater, or a mixed water sample: If the following conditions are met simultaneously, the water sample to be tested is determined to be aquaculture wastewater: ; If the following conditions are met simultaneously, the water sample to be tested is determined to be landfill leachate: ; If the following conditions are met simultaneously, the water sample to be tested is determined to be atypical industrial wastewater: ; In other cases, the water sample to be tested is determined to be a mixed water sample.
[0012] Compared with the prior art, the present invention has the following innovative features: (1) Design a hierarchical and progressive water sample identification framework based on visual coarse classification and physical and chemical fine classification: Using RGB color space and Canny edge detection image vision technology, unknown water samples are first quickly and coarsely classified into two major levels: Class A (clean) and Class B (polluted); then, specific detection parameters and identification logic are matched for water samples of different levels. (2) Selection of specific physicochemical parameters and customized threshold criteria for different water sample types: For Class A water samples, only chloride ion concentration is extracted, and specific distinction thresholds for tap water / seawater / mixed seawater are established; For Class B water samples, industrial wastewater is first screened by pH and conductivity. For water samples that do not belong to typical industrial wastewater, the rapid feature matching model of atypical industrial wastewater is used to identify whether they belong to aquaculture wastewater, landfill leachate, industrial wastewater or mixed water samples. If the model is suitable and the reliability is low, the biochemical oxygen demand (BOD5) and chemical oxygen demand (COD) are measured and the sub-categories are confirmed. (3) Construct an integrated intelligent identification system covering all types of unknown water samples: For the first time, one-stop identification of various types of unknown water samples such as tap water, seawater, tap water-seawater mixture, aquaculture wastewater, industrial wastewater, and polluted mixed water samples is realized.
[0013] The beneficial effects brought about by the innovation of this invention include: Improve water sample identification efficiency: Adopt the visual preprocessing method of RGB color space + Canny edge detection to quickly classify unknown water samples into Class A (clean) and Class B (polluted). There is no need to carry out full-item physicochemical testing on all water samples directly, reducing redundant testing steps, shortening the identification cycle, and realizing rapid initial screening of unknown water samples.
[0014] Wide applicability and high accuracy: It can complete the identification of various complex and unknown water samples, including tap water, seawater, tap water-seawater mixtures, aquaculture wastewater, industrial wastewater, and polluted mixed water samples, in a one-stop manner, making it applicable to a wider range of scenarios. Class A water samples are judged based on chloride ion concentration, while Class B water samples are judged by a combination of pH, conductivity, turbidity, total dissolved solids, chloride ion concentration, ammonia nitrogen concentration, BOD5, and COD parameters, avoiding misjudgments caused by generalized testing, and achieving refined and highly accurate classification of various types of water samples.
[0015] Reduce the overall cost of water sample testing: The layered and progressive testing logic reduces unnecessary consumption of physicochemical reagents, frequency of instrument testing, and manpower investment. At the same time, it only uses conventional cameras, test tubes, and conventional water quality testing equipment, resulting in lower testing costs and better economic efficiency. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the overall technical route of the present invention.
[0017] Figure 2 This is a schematic diagram illustrating the theoretical values for the RGB color space.
[0018] Figure 3 This is a schematic diagram of the gradient direction angle quantization process.
[0019] Figure 4 This is a schematic diagram of the pixel combination process within a 3×3 neighborhood.
[0020] Figure 5 The image shows the simulation results of suspended matter characteristics in a water sample. Detailed Implementation
[0021] To overcome the bottlenecks of existing water sample identification technologies in terms of multi-type adaptability, identification accuracy, detection speed, and practicality, and to meet the practical needs of environmental emergency monitoring, urban and rural water supply safety, seawater utilization, and sewage treatment, this invention fills the technological gap in intelligent identification of multiple types of unknown water samples and promotes the transformation of water quality monitoring technology towards intelligence, efficiency, and precision. The main process is as follows: Figure 1 As shown: S1. The unknown water sample is placed in a transparent test tube, with a supplementary light positioned directly above it. An image of the water sample is captured by a camera against a white background. Digital image processing methods are used to initially classify the water sample into two categories: Category A (tap water / seawater / tap water + seawater) and Category B (sewage / mixed water sample). The digital image processing methods include image enhancement, RGB thresholding, and the Canny edge detection algorithm.
[0022] S2 extracts chloride ion concentration parameters for Class A water samples. A threshold criterion is defined to distinguish between three different water samples: tap water, seawater, and a mixture of tap water and seawater.
[0023] S3, for Class B water samples, extracts pH and conductivity parameters to jointly define typical industrial wastewater. For water samples that do not belong to typical industrial wastewater, additional parameters including turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration are measured. Through a rapid feature matching model for atypical industrial wastewater, it is identified that the sample belongs to aquaculture wastewater, landfill leachate, industrial wastewater, or a mixed water sample.
[0024] S4, for water samples with low confidence in the rapid feature matching model identification results for atypical industrial wastewater, measures their biochemical oxygen demand (BOD5) and chemical oxygen demand (COD) and defines the sub-categories of the water samples as aquaculture wastewater, industrial wastewater, or mixed water samples.
[0025] The specific implementation process of the present invention will be described in detail below with reference to specific embodiments.
[0026] S1. Acquire image information of unknown water samples and perform preliminary classification of the water samples using image processing methods. S1-1 The water sample to be tested is placed inside a transparent test tube. A supplementary lighting device is placed directly above the transparent test tube to compensate for the illumination of the water sample area inside the transparent test tube. The transparent test tube containing the water sample to be tested is then placed in front of a preset position against a white background. An image acquisition device is used to capture the image of the water sample inside the transparent test tube, thereby acquiring the water sample image.
[0027] S1-2 Image enhancement is performed on the acquired water sample images using homomorphic filtering. After the image is transformed to the frequency domain via Fourier transform, normal light sources in the image are represented by illumination components, which, due to their stability, can be considered low-frequency signals. Reflected light sources, however, are different; reflected light is affected by the environment and changes rapidly and irregularly, thus they can be considered high-frequency signals. A high-pass filter is used in the frequency domain to linearly reduce low-frequency components and increase high-frequency components, preserving details in bright areas while enhancing details in dark areas. This filters out interference noise and enhances image contrast. The specific steps are as follows: The original image is converted into a digital signal, represented as the product of the illumination and reflection components, i.e.: ; In the formula, Indicates pixel coordinate position, Represents digital image signals, Represented as irradiation component, This represents the reflection component.
[0028] The image is transformed to the frequency domain using Fourier transform, where a high-pass linear filter can be used. Since the above equation is in product form, the variables cannot be directly manipulated; therefore, the logarithm of both sides is taken. ; In the formula, Indicates to Take the logarithm of the pixel coordinates. Indicates to The logarithm of the illumination component at the coordinate position is taken. Indicates to Take the logarithm of the reflection component at the coordinate position. Perform a Fourier transform. ; In the formula, Indicates to After taking the logarithm of the coordinate position, perform a Fourier transform on the pixel. Indicates to The coordinate position is obtained by performing a Fourier transform on the logarithmic illumination component. Indicates to The coordinate position is taken as the logarithmic reflection component and then subjected to Fourier transform. Will Defined as High-pass filtering increases high-frequency components while relatively reducing low-frequency components, thus equalizing brightness and enhancing image contrast. ; In the formula, This indicates mapping to the frequency domain. The pixels at the coordinate positions are processed by a high-pass filter. This represents the result after filtering.
[0029] The image is converted back from the frequency domain to the time domain using the inverse Fourier transform. ; In the formula, This indicates that an inverse Fourier transform is performed on the filtered result. This indicates the corresponding time-domain transformation result.
[0030] The process is restored by taking the logarithm of both sides of the exponential function. ; In the formula, This represents a mathematical operation that restores the natural logarithm. express The result of homomorphic filtering on the pixels at the location.
[0031] Preferably, based on engineering experience and small sample test results, the main parameters of the high-pass filter are selected as follows: low-frequency gain is 0.5; high-frequency gain is 3.5; sharpening coefficient is 2; and cutoff frequency is 1500.
[0032] S1-3 Define the transparency characteristics of the water sample to be tested based on digital image processing methods. The specific steps are as follows: (1) The theoretical basis for defining the transparency characteristics of the water sample to be tested is that since the image acquisition adopts supplementary lighting and the background is white, the higher the transparency of the water sample, the closer the image of the water sample to be tested is to pure white. (2) Define the criteria for white pixels based on the RGB color space theory. The RGB color space theory represents pixels by mixing and adding the three primary colors: red, green, and blue. The values of R, G, and B are all in the range of [0, 255]. Therefore, R, G, and B each have 256 color levels, meaning that each pixel has 256 color levels. Possible colors, such as Figure 2 As shown.
[0033] A pixel is classified as a white pixel if it simultaneously meets the following conditions.
[0034] ; ; ; ; ; .
[0035] (3) Define the criteria for determining if an image is white. Count the number of pixels in the image (denoted by Cont), and count the number of pixels judged as white (denoted by Cont_w). If the criteria are met... ; The image color is then determined to be white.
[0036] S1-4 Define the oil-liquid separation or suspended solids characteristics of the water sample to be tested based on digital image processing methods. The specific steps are as follows: (1) Define the theoretical basis for judging the oil-liquid separation or suspended matter characteristics of the water sample to be tested. The oil-liquid separation or suspended matter characteristics are manifested as pixel gradient descent in digital image processing, indicating the edge features of the image. (2) The edge features of the image are identified using the Canny edge detection method, as follows: The image being detected is smoothed using a Gaussian function, which can be represented in convolutional form as follows. ; In the formula, Indicates The result of Gaussian filtering on the pixels at the given location. Represents the Gaussian function. express The result of homomorphic filtering on the pixels at the location.
[0037] Calculate all pixels using the Canny operator The gradient magnitude at that point, This means that the following formula is satisfied. ; In the formula, express The position of the pixel in its x The square of the first-order difference in the direction, express The position of the pixel in its y The square of the first-order difference in the direction.
[0038] The gradient has a direction angle that satisfies the following relationship. ;
[0039] In the formula, express The direction angle of the position express The position of the pixel in its x First-order difference in direction, express The position of the pixel in its y First-order difference in direction.
[0040] Because the gradient directions are different, Quantification, such as Figure 3 As shown.
[0041] The four sectors labeled 0, 1, 2, and 3 correspond one-to-one with the four possible pixel combinations in a 3×3 neighborhood, such as... Figure 4 As shown.
[0042] All pixels in the gradient image need to be traversed, comparing the pixel itself with its own pixel value. Two pixels in the direction. Pixels whose gradient magnitude is no greater than that of their two neighboring pixels are set to zero. Simulation results. Figure 5 As shown.
[0043] (3) Define the criteria for judging the characteristics of oil-liquid separation or suspended matter in the water sample to be tested. After the Canny operator is used to calculate the image, if there are edge features, it can be judged that the water sample to be tested has oil-liquid separation or suspended matter.
[0044] S1-5 defines the classification criteria for water sample images to be tested as Class A (clean, including tap water, seawater, and tap water + seawater) and Class B (polluted, including sewage and sewage / mixed water samples). Samples that meet the criteria of S1-3 (water sample color discrimination result is white) and S1-4 (determination that there is no oil separation or suspended matter phenomenon in the water sample) are classified as Class A, and others are classified as Class B.
[0045] S2. Further classification of Class A water samples S2-1 determines the chloride ion concentration in a water sample using ion chromatography.
[0046] Place the water sample to be tested into a clean sample bottle, label the sample information, put it into the autosampler of the ion chromatograph, start the detection program, and perform parallel detection on the water sample twice. The instrument automatically completes the injection, separation and signal detection, and records the chloride ion peak height (or peak area) data of each detection. At the same time, a blank test is performed to ensure that the blank value meets the instrument detection requirements. The relative deviation of the parallel samples is ≤10%, otherwise, the test is repeated.
[0047] The average peak height (or peak area) of two parallel tests of the water sample is extracted and substituted into the chloride ion concentration standard curve. The corresponding initial chloride ion concentration is then calculated using a linear equation. If the water sample was diluted before testing, the initial concentration value needs to be corrected according to the dilution factor to calculate the actual chloride ion concentration in the water sample; if it was not diluted, the initial concentration value is the actual chloride ion concentration of the water sample.
[0048] S2-2 Defines threshold discrimination criteria for tap water, seawater, and tap water + seawater based on the chloride ion concentration values measured in water samples.
[0049] The threshold for tap water is a chloride ion concentration of ≤250mg / L. Based on the chloride limit requirements in GB 5749-2022 "Standards for Drinking Water Quality" and combined with actual test data, the chloride ion concentration in tap water is usually below 250mg / L, and in most cases does not exceed 40mg / L. Therefore, ≤250mg / L is used as the threshold for tap water. Seawater threshold: Chloride ion concentration ≥19350mg / L. Based on the average chloride ion concentration detection data of seawater, the chloride ion concentration of seawater is usually stable at around 19350mg / L. Even if diluted by a small amount of fresh water, its concentration is still much higher than that of mixed water samples. Therefore, ≥19350mg / L is used as the judgment threshold for seawater. Threshold for mixed tap water and seawater samples: 250 mg / L < chloride ion concentration < 19350 mg / L. The mixed water sample is made by mixing tap water and seawater, and its chloride ion concentration is between that of tap water and seawater. Therefore, this concentration range is used as the threshold for judging mixed water samples.
[0050] S3. Further classification of Class B water samples S3-1 Extract the pH and conductivity parameters of Class B water samples and jointly define the judgment criteria for typical industrial wastewater. The specific steps are as follows: (1) Clean the pH meter probe, dry the residual water with filter paper, insert it into the water sample to be tested in category B, stir the water sample gently, and record the pH value after the reading stabilizes (about 30s). Each group of samples is tested twice in parallel and the average value is calculated. The parallel test deviation is required to be ≤0.05. Otherwise, the test is repeated. (2) Clean the conductivity meter probe thoroughly, absorb any residual moisture with filter paper, and insert it into the Class B water sample to be tested. Ensure the probe is completely submerged and does not touch the bottom of the sample bottle. After the reading stabilizes, record the conductivity value (unit: Each group of samples was tested twice in parallel, and the average value was calculated. The parallel test deviation was ≤1%, otherwise the test was repeated. (3) pH threshold: Typical industrial wastewater contains acid and alkali pollutants, and the pH value deviates from the neutral range. The threshold is determined to be pH < 6.0 or pH > 9.0.
[0051] Conductivity threshold: Typical industrial wastewater contains a large amount of electrolytes (such as salts, acids, and alkalis), and its conductivity is much higher than that of natural water bodies. Based on actual test data, the threshold is determined to be conductivity ≥ 2000. .
[0052] The Class B water sample meets both the pH threshold and conductivity threshold criteria, and is therefore determined to be typical industrial wastewater.
[0053] S3-2 For water samples that are not typical industrial wastewater, supplementary testing should be performed on parameters including turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration. The specific steps are as follows: Turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration were collected, with chloride ion concentration values collected using the S2-1 method.
[0054] (1) During the turbidity measurement process, clean the cuvette of the turbidity meter, dry the residual water on the outer wall of the cuvette with filter paper, pour the water sample to be tested up to the scale line, put it into the sample cell of the turbidity meter and cover the cell. After the reading stabilizes (about 20s), record the turbidity value (unit: NTU). Each group of samples is tested twice in parallel, and the average value is calculated. The parallel test deviation is required to be ≤2NTU, otherwise the test is repeated.
[0055] (2) To determine the total dissolved solids, clean the TDS meter probe, dry the residual water with filter paper, insert it into the water sample to be tested, ensure that the probe is completely submerged and does not touch the bottom of the sample bottle, gently stir the water sample, and after the reading stabilizes (about 30s), record the total dissolved solids value (unit: mg / L). Each group of samples is tested twice in parallel, and the average value is calculated. The parallel test deviation is ≤5%, otherwise the test is repeated.
[0056] (3) The process of determining ammonia nitrogen concentration is carried out by Nessler's reagent spectrophotometry. Take an appropriate amount of water sample to be tested and place it in a colorimetric tube. Add the corresponding volume of Nessler's reagent, shake well and let stand for 10 minutes. Place the colorimetric tube in a spectrophotometer and measure the absorbance at a wavelength of 420 nm with distilled water as a blank control. Calculate the ammonia nitrogen concentration (unit: mg / L) according to the standard curve. Each group of samples is tested twice in parallel and the average value is calculated. The parallel test deviation is required to be ≤5%. Otherwise, the test is repeated.
[0057] S3-3 constructs a fast feature matching model for atypical industrial wastewater based on the Lightweight Support Vector Machine (LightSVM) algorithm. The specific steps are as follows: Min-Max normalization was used to map the parameters pH threshold, conductivity, turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration to the [0,1] interval, eliminating the difference in the dimensions of the parameters.
[0058] Lightweight Support Vector Machine (LightSVM) was selected as the core classification algorithm and trained on normalized feature library data. The algorithm parameters were optimized by using a grid search method to determine the penalty coefficient C and kernel function parameter γ, and the search range of the penalty coefficient C was set to
[10] . -3 10 3 The search range for the kernel function parameter γ is
[10] . -4 10 4 This simplifies kernel function calculations, reduces the number of model parameters, and achieves algorithm lightweighting.
[0059] The normalized feature library data is divided into training, validation, and test sets in a 7:2:1 ratio. The training set is input into a lightweight classification algorithm, and the model is trained by combining the feature matching results. The core objectives are classification accuracy and recognition speed. If the validation set accuracy does not improve for 5 consecutive rounds, training is stopped to avoid model overfitting.
[0060] The trained model is validated using a validation set to evaluate its classification accuracy, recall, F1 score, and recognition speed. If the validation results are not up to standard (classification accuracy < 95%, recognition time > 1s), the algorithm parameters are readjusted.
[0061] S3-4 The water sample to be tested, which does not belong to typical industrial wastewater, is used with a fast feature matching model for atypical industrial wastewater to obtain the water sample category result and its confidence level. The specific steps are as follows: A lightweight feature matching algorithm is used to quickly match samples, and a classification algorithm is used to output the water sample category. At the same time, the measured values of various physicochemical parameters, feature ratio results, and identification confidence scores are output (confidence scores ≥90% are valid identification results, and <90% prompts "further testing is required"). An identification report is generated, clearly indicating the water sample category, detection parameters, identification results, and confidence scores, so as to achieve rapid and accurate identification of unknown water samples.
[0062] S4. Further determination of atypical industrial wastewater S4-1 Determination of Biochemical Oxygen Demand (BOD5): Take an appropriate amount of water sample to be tested and perform serial dilution according to the estimated concentration, so that the BOD5 value of the diluted water sample is within the range of 5~30 mg / L; add an appropriate amount of inoculum (without toxic interference) to the diluted water sample, shake well, and then inject it into two culture bottles, fill them completely and seal them to avoid the generation of air bubbles. Immediately measure the dissolved oxygen content in one bottle, and place the other bottle in a constant temperature incubator at 20℃±1℃ and incubate in the dark for 5 days. After the incubation, measure its dissolved oxygen content. Each group of samples is tested in parallel twice, and the average BOD5 value is calculated.
[0063] S4-2 Determination of Chemical Oxygen Demand (COD): The potassium dichromate titration method was used. 10.00 mL of the water sample to be tested (dilute if the concentration is too high) was placed in an Erlenmeyer flask. 5.00 mL of potassium dichromate standard solution and several boiling chips were added, followed by slow addition of 15 mL of sulfuric acid-silver sulfate catalyst. The mixture was shaken well and heated under reflux for 2 hours. After cooling to room temperature, the inner wall of the condenser was rinsed with water. Three drops of ferroin indicator were added, and the solution was titrated with ferrous ammonium sulfate standard solution until the solution changed from yellow to blue-green and then to reddish-brown. The volume consumed was recorded. Each sample was tested in parallel twice, and the average COD value was calculated.
[0064] S4-3 and refer to the chloride ion concentration value (expressed as CL, unit is mg / L) determined in S3-2.
[0065] S4-4 If the following conditions are met simultaneously, the water sample to be tested is determined to be aquaculture wastewater. .
[0066] If the following conditions are met simultaneously, the water sample to be tested can be determined to be landfill leachate. .
[0067] If the following conditions are met simultaneously, the water sample to be tested can be determined to be atypical industrial wastewater. .
[0068] In other cases, the water sample to be tested is determined to be a mixed water sample.
[0069] The method was tested under laboratory conditions with 10 groups of random samples, and the results are shown in Table 1.
[0070] Table 1. Results of water sample testing
[0071] Traditional biochemical culture for identifying a single water sample requires 5 days, plus 2 hours for experimental preparation and other parameter measurements. This method, applied to the aforementioned 10 groups of samples, takes an average of only 25.65 hours, saving 79.02% of time and cost. The method has a 90% success rate in validation, with only occasional errors in the classification of industrial wastewater and mixed wastewater. As the number of samples accumulates, the accuracy and confidence level of the model output will further improve.
[0072] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0073] While the specific embodiments of the present invention have been described above, they are not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A method for intelligent identification of multiple types of unknown water samples based on physicochemical characteristics, characterized in that, Includes the following steps: S1. Place the unknown water sample in a transparent test tube and capture the water sample image with a camera in front of a white background. After image enhancement of the captured water sample image, identify the image color according to the RGB color space theory to determine the transparency feature, and use the Canny edge detection method to identify the image edge feature to determine the oil separation or suspended matter feature. If the water sample color is white and the water sample is determined to have no oil separation or suspended matter, the sample is classified as Class A; otherwise, it is classified as Class B. S2, for Class A water samples, extract chloride ion concentration parameters to determine whether the sample is tap water, seawater, or a mixture of tap water and seawater; S3, for Class B water samples, extracts pH and conductivity parameters to jointly define typical industrial wastewater; For water samples that do not belong to typical industrial wastewater, additional measurements are taken of turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration. The rapid feature matching model for atypical industrial wastewater is used to identify whether the sample belongs to aquaculture wastewater, landfill leachate, industrial wastewater, or a mixed water sample. S4, for water samples with low confidence in the rapid feature matching model identification results, redefine the water sample category by measuring its biochemical oxygen demand and chemical oxygen demand.
2. The intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics as described in claim 1, characterized in that: In step S1, image acquisition is performed on the water sample to be tested in the transparent test tube, provided that the white background and supplemental lighting from directly above are met. The acquired water sample image is then enhanced using a homomorphic filtering method. The specific process is as follows: The original image is converted into a digital signal, represented as the product of the illumination and reflection components, to obtain the digital image signal. ; Convert the character image to the frequency domain using Fourier transform: ; In the formula, Indicates to After taking the logarithm of the coordinate position, perform a Fourier transform on the pixel. Indicates to The coordinate position is obtained by performing a Fourier transform on the logarithmic illumination component. Indicates to The coordinate position is obtained by taking the logarithmic reflection component and performing a Fourier transform; Mapped to the frequency domain The pixel at the coordinate position is processed by a high-pass filter to obtain the filtered result. ; The image is converted back from the frequency domain to the time domain using the inverse Fourier transform, yielding the corresponding time-domain transformation result. ; Restore the function by taking the logarithm of both sides simultaneously using the exponential function: ; In the formula, This represents a mathematical operation that restores the natural logarithm. express The result of homomorphic filtering on the pixels at the location.
3. The intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics as described in claim 1, characterized in that: The method of determining image color based on RGB color space theory is as follows: A pixel is classified as white if it simultaneously meets the following conditions: ; ; ; ; ; ; Count the number of pixels (Cont) in the image, and count the number of pixels (Cont_w) that are identified as white. If the condition is met... ; The image color is then determined to be white.
4. The intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics as described in claim 1, characterized in that: The specific process of using the Canny edge detection method to identify image edge features and determine oil separation or suspended matter features is as follows: Applying a Gaussian function to smooth the detected image, represented in convolution form, is as follows: ; In the formula, Indicates The result of Gaussian filtering on the pixels at the given location. Represents the Gaussian function. express The result of homomorphic filtering on the pixels at the location; Calculate all pixels using the Canny operator The gradient magnitude at that point, This means that the following formula is satisfied: ; In the formula, express The position of the pixel in its x The square of the first-order difference in the direction, express The position of the pixel in its y The square of the first-order difference in the direction; The gradient has a direction angle that satisfies the following relationship. ; In the formula, express The direction angle of the position express The position of the pixel in its x First-order difference in direction, express The position of the pixel in its y First-order difference in direction; Iterate through all pixels in the gradient image, comparing each pixel with itself and its corresponding pixel. Two pixels in the direction; set pixels whose gradient magnitude is not greater than that of the two pixels in their neighborhood to zero; After calculation by the Canny operator, the image shows edge features, which indicates that the water sample to be tested has oil separation or suspended matter.
5. The intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics as described in claim 1, characterized in that: In S2, the specific threshold values include: Tap water threshold: chloride ion concentration ≤250mg / L; Seawater threshold: Chloride ion concentration ≥19350 mg / L; Threshold for mixed tap water and seawater samples: 250 mg / L < chloride ion concentration < 19350 mg / L.
6. The intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics as described in claim 1, characterized in that: In S3, for Class B water samples, pH and conductivity parameters are extracted to jointly define typical industrial wastewater, specifically as follows: Insert the pH meter probe into the water sample of type B, stir the water sample, and record the pH value after the reading stabilizes. Each group of samples is tested twice in parallel, and the average value is calculated. Insert the conductivity meter probe into the Class B water sample to be tested, ensuring the probe is completely submerged and does not touch the bottom of the sample bottle. After the reading stabilizes, record the conductivity value. Each group of samples is tested twice in parallel, and the average value is calculated. The pH threshold is defined as pH < 6.0 or pH > 9.0, and the conductivity threshold is conductivity ≥ 2000. If a Class B water sample meets both the pH threshold and conductivity threshold criteria, it is determined that the Class B water sample belongs to typical industrial wastewater.
7. The intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics as described in claim 1, characterized in that: The rapid feature matching model for atypical industrial wastewater is constructed using a lightweight support vector machine. The inputs are normalized parameters including pH threshold, conductivity, turbidity, total dissolved solids, chloride ion concentration, and ammonia nitrogen concentration. The outputs are the water sample category and its confidence level. A grid search method is used to determine the penalty coefficient C and the kernel function parameter γ, with the search range for the penalty coefficient C set to [10]. -3 10 3 The search range for the kernel function parameter γ is [10]. -4 10 4 ].
8. The intelligent identification method for multiple types of unknown water samples based on physicochemical characteristics as described in claim 1, characterized in that: In step S4, for water samples in category B where the confidence level of the rapid feature matching model identification result is less than 90%, their biochemical oxygen demand (BOD5) and chemical oxygen demand (COD) are measured, and a sub-category determination criterion is defined for classifying the water sample as aquaculture wastewater, industrial wastewater, or a mixed water sample: If the following conditions are met simultaneously, the water sample to be tested is determined to be aquaculture wastewater: ; If the following conditions are met simultaneously, the water sample to be tested is determined to be landfill leachate: ; If the following conditions are met simultaneously, the water sample to be tested is determined to be atypical industrial wastewater: ; In other cases, the water sample to be tested is determined to be a mixed water sample.