Barrel liquid level detection method and system for field image of surface water monitoring station

By using image preprocessing and target detection models, the problem of only being able to provide early warning for one liquid level in existing technologies has been solved. This enables accurate real-time detection and proactive early warning of the liquid level in the tank, improving the operation and maintenance efficiency and equipment stability of surface water monitoring stations.

CN121577121APending Publication Date: 2026-02-27ANHUI WAYEE SCI & TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202511753053.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing technology can only provide early warning of a single liquid level and cannot perform real-time detection, leading to problems such as overflowing of waste liquid tanks due to excessively high liquid levels or affecting equipment operation due to excessively low liquid levels in pure water tanks at surface water monitoring stations.

Method used

The system employs image preprocessing, target detection, and liquid level calculation methods, including illumination compensation, downsampling, image sharpening, target detection models, and liquid level detection modules, to achieve real-time monitoring and proactive early warning of the liquid level in the tank.

Benefits of technology

It enables accurate real-time detection of the liquid level in the tank, avoiding human error, proactively issuing warnings and notifying maintenance personnel via the network, thereby reducing maintenance costs and improving management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121577121A_ABST
    Figure CN121577121A_ABST
Patent Text Reader

Abstract

The invention discloses a barrel liquid level detection method and system for surface water monitoring station field images, and belongs to the technical field of computer image processing, and the method comprises the following steps: S1, image preprocessing; s2, target detection; s3, liquid level detection; and S4, active early warning is carried out. The liquid level height of the waste liquid barrel can be continuously monitored in real time, through 24-hour uninterrupted automatic detection, the system can give an alarm immediately when the liquid level reaches a threshold value, operation and maintenance personnel are informed of replacement through a network, and the risk of waste liquid overflow is effectively avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer image processing technology, and more specifically to a method and system for detecting liquid level in barrels for use in on-site images of surface water monitoring stations. Background Technology

[0002] In the daily operation and maintenance of surface water monitoring stations, monitoring the liquid levels in waste liquid tanks and pure water tanks is a crucial step in ensuring continuous monitoring and preventing environmental pollution. If the waste liquid tank level is too high and overflows, it will cause serious pollution to the surrounding soil and water bodies, violating the core requirements of environmental monitoring. Conversely, if the pure water tank level is too low, the monitoring equipment will malfunction due to lack of water, affecting the continuity and accuracy of surface water monitoring data.

[0003] Existing technologies mainly rely on contact-based liquid level detection, which can only provide early warnings for a single liquid level and cannot perform real-time monitoring. Therefore, this paper proposes a method and system for detecting liquid levels in a container based on on-site images from surface water monitoring stations. Summary of the Invention

[0004] The technical problem to be solved by this invention is: how to solve the problem that the existing technology can only provide early warning of a liquid level and cannot perform real-time detection, and provides a method for detecting the liquid level in a tank using on-site images of surface water monitoring stations.

[0005] The present invention solves the above-mentioned technical problems through the following technical solution, and the present invention includes the following steps:

[0006] S1: Image Preprocessing

[0007] Illumination compensation, downsampling, and image sharpening were performed on the collected on-site images of the surface water monitoring station to obtain the processed on-site images of the surface water monitoring station.

[0008] S2: Object Detection

[0009] The trained target detection model was used to detect the processed surface water monitoring station images to obtain the detection results of barrel categories and the key point detection results of the corresponding barrels.

[0010] S3: Liquid Level Detection

[0011] Calculate the liquid level inside the tank based on the detection results of key points on the tank.

[0012] S4: Proactive Early Warning

[0013] The liquid level in each tank is monitored in real time. When the liquid level exceeds the preset threshold, an alarm is issued and the maintenance personnel are notified via the network for timely handling.

[0014] Furthermore, in step S1, the specific process of illumination compensation is as follows:

[0015] S11: Perform color space conversion, the specific formula is as follows:

[0016] ;

[0017] in, These are the original images, i.e., on-site images from the surface water monitoring station. This represents a color space conversion function. This indicates a channel separation operation. These represent the original luminance component, the green-red luminance component, and the blue-yellow luminance component, respectively.

[0018] S12: Global illumination is estimated using Gaussian kernel convolution to achieve illumination component estimation. The specific formula is as follows:

[0019] ;

[0020] ;

[0021] in, For kernel coordinates, Represents the Gaussian kernel. Used to control the Gaussian kernel size. This represents the convolution operation. This represents the blurred illumination component matrix;

[0022] S13: The specific formula for performing illumination-reflection decomposition in the logarithmic domain is as follows:

[0023] ;

[0024] in, Represents the logarithmic field reflection component matrix;

[0025] Transform to a linear space and normalize:

[0026] ;

[0027] in, This indicates linear normalization. Indicates the reflected component;

[0028] S14: Perform contrast-limited histogram equalization, the specific formula is as follows:

[0029] ;

[0030] in, This indicates histogram equalization processing. This represents the equalized reflection component. This represents the histogram clipping threshold. , Indicates the size of the grid blocks. ;

[0031] S15: Adjust the dynamic range of output brightness via gamma correction.

[0032] ;

[0033] in, To correct the reflected component, ;

[0034] S16: Reconstruct the image to obtain the illumination-compensated on-site image of the surface water monitoring station. The specific formula is as follows:

[0035]

[0036] in, The image is the reconstructed image, i.e., the on-site image of the surface water monitoring station after illumination compensation. Indicates a channel merging operation; This is a color space conversion function.

[0037] Furthermore, in step S1, downsampling involves using illumination-compensated on-site images of the surface water monitoring station. Perform bilinear interpolation to scale to a fixed size.

[0038] Furthermore, in step S1, during the image downsampling process, the Laplacian operator is used to weighted fuse with the original image to enhance edge and texture features in the image, as shown in the following formula:

[0039]

[0040]

[0041]

[0042] in, Represents the discrete Laplacian convolution kernel. This represents the convolution operation. This indicates the output edge-enhanced image. This represents the mean of the Laplace calculation results. This represents the standard deviation of the Laplace calculation result. Image height, Image width, express The value is restricted to the interval [a, b], where α represents the sharpening intensity coefficient. These are the pixel values ​​of the image after initial illumination compensation processing, where x and y represent the spatial coordinates of the pixel. This represents the pixel value of the sharpened output image obtained after Laplacian edge enhancement.

[0043] Furthermore, in step S2, the target detection model comprises three parts: Backbone, Neck, and Head. The Backbone extracts multi-scale features from the image, which are then fused by the Neck. Finally, the Head generates the target category, bounding box, and key points based on the fused features. The Backbone includes sequentially connected multi-layer convolutional units and a cross-stage residual structure. The Neck is implemented based on a multi-feature pyramid. The Head receives the multi-scale fused features from the Neck and performs convolutional predictions at different resolutions to output the target detection results.

[0044] Furthermore, in step S2, the tank types include waste liquid tanks and pure water tanks, and the corresponding key points include scale key points and liquid level key points. The scale key points are used to establish a measurement benchmark, and the liquid level key points are used to indicate the actual water level height. The scale key points and liquid level key points are distributed on both sides of the scale on the tank.

[0045] Furthermore, in step S3, the specific calculation process is as follows:

[0046] S31: The least squares method is used to fit the equation of the scale line based on the key points of the scale, as follows:

[0047]

[0048] Where n is the index of the key point on the scale. This represents the coordinates of the nth scale mark. Let A be the slope and intercept of the scale line equation, A be the design matrix, and y be the target vector for linear fitting.

[0049] S32: Mapping scale line equations using key points of liquid level, as detailed below:

[0050]

[0051] in, The coordinates of the key points of the liquid level, The coordinates of the key liquid level points projected onto the fitted scale line;

[0052] S33: Calculate the liquid level height based on the coordinates of the mapped point and the equation of the scale line.

[0053]

[0054] in, This refers to the liquid level height. Represents the coordinate position of the first tick mark. This represents the coordinate position of the last tick mark, where i represents the tick index, ranging from 1 to n-1. Represents the relative interval between adjacent scale divisions; when the liquid level coordinates The liquid level is 0 when it is below the first scale coordinate, and when the liquid level coordinate is... The liquid level is 1 when it is above the last scale coordinate. When the liquid level is between two graduations, the liquid level height is calculated by multiplying the relative position relationship by the relative interval between the graduations.

[0055] This invention also provides a tank liquid level detection system for surface water monitoring station field images, which uses the above-described method to detect the liquid level height of each tank in the surface water monitoring station field images, including:

[0056] The image preprocessing module is used to perform illumination compensation, downsampling, and image sharpening operations on the collected on-site images of the surface water monitoring station to obtain the processed on-site images of the surface water monitoring station.

[0057] The target detection module is used to detect the processed on-site images of the surface water monitoring station using a trained target detection model, and to obtain the detection results of the barrel category and the key point detection results of the corresponding barrel in the image.

[0058] The liquid level detection module is used to calculate the liquid level height inside the tank based on the detection results of key points on the tank.

[0059] The active early warning module is used to monitor the liquid level in each tank in real time. When the liquid level exceeds the preset threshold, an alarm is issued and the operation and maintenance personnel are notified via the network for timely handling.

[0060] The present invention has the following advantages over the prior art:

[0061] 1. Precise and Real-time: Based on advanced image processing technology, it can measure liquid level height in real time without contact, avoiding human error and ensuring objective and accurate data.

[0062] 2. Proactive early warning: By linking preset thresholds with automatic alarms, the system transforms passive detection into proactive early warning, providing maintenance personnel with sufficient response time and eliminating the risk of waste liquid spillage at the source.

[0063] 3. Remote and efficient: With the help of the network, remote monitoring and notification are achieved, and maintenance personnel can grasp the overall situation without being on-site, which greatly improves management efficiency and reduces maintenance costs. Attached Figure Description

[0064] Figure 1 This is a flowchart illustrating the method for detecting the liquid level in a tank using on-site images of a surface water monitoring station, as described in an embodiment of the present invention.

[0065] Figure 2 This is a schematic diagram of the target detection model in an embodiment of the present invention. Detailed Implementation

[0066] The embodiments of the present invention are described in detail below. These embodiments are implemented based on the technical solution of the present invention, and provide detailed implementation methods and specific operation processes. However, the scope of protection of the present invention is not limited to the following embodiments.

[0067] like Figure 1 As shown, this embodiment provides a technical solution: a method for detecting the liquid level in a tank using on-site images of a surface water monitoring station, comprising the following steps:

[0068] 1. Image preprocessing

[0069] 1.1 Illumination Compensation

[0070] Surface water monitoring stations are easily affected by day and night lighting conditions, leading to loss of detail in dark areas and overexposure in bright areas, severely impacting detection accuracy. To address this issue, a lighting compensation method based on Retinex theory is employed, decomposing the image into reflection and illumination components to achieve adaptive compensation for uneven lighting and reduce the influence of actual environmental light sources.

[0071] (1) Perform color space conversion

[0072]

[0073] in, For the original image, This represents a color space conversion function. This indicates a channel separation operation. These represent the original luminance component, the green-red luminance component, and the blue-yellow luminance component, respectively.

[0074] (2) Illumination component estimation

[0075] Global illumination is estimated using Gaussian kernel convolution.

[0076]

[0077]

[0078] in, For kernel coordinates, Represents the Gaussian kernel. Used to control the Gaussian kernel size. This represents the convolution operation. This represents the blurred illumination component matrix;

[0079] (3) Extraction of reflection components

[0080] Light-reflection decomposition in the logarithmic domain:

[0081]

[0082] in, Represents the logarithmic field reflection component matrix;

[0083] Transform to a linear space and normalize:

[0084]

[0085] in, This indicates linear normalization. Indicates the reflected component;

[0086] (4) Contrast-limited histogram equalization

[0087]

[0088] in, This indicates histogram equalization processing. This represents the equalized reflection component. This represents the histogram clipping threshold. , Indicates the size of the grid blocks. ;

[0089] (5) Gamma correction

[0090] Adjust the dynamic range of output brightness

[0091]

[0092] in, To correct the reflected component, ;

[0093] (6) Image reconstruction

[0094]

[0095] in, The image is the reconstructed image, i.e., the on-site image of the surface water monitoring station after illumination compensation. This indicates a channel merging operation, which takes three single-channel matrices and combines them into a three-channel LAB color space image; This is a color space conversion function that converts the input LAB color space image back to a BGR color space image.

[0096] 1.2 Downsampling

[0097] Image after illumination compensation Perform bilinear interpolation to scale to a fixed size (e.g., 640×640) to improve the speed of subsequent model inference and reduce hardware resource consumption.

[0098] 1.3 Image Sharpening

[0099] During image downsampling, some high-frequency details (especially fine edges) may be lost or weakened. Using the Laplacian operator to weighted fuse with the original image can enhance edge and texture features in the image and improve the accuracy of key point detection.

[0100]

[0101]

[0102]

[0103] in, Represents the discrete Laplacian convolution kernel. This represents the convolution operation. This indicates the output edge-enhanced image. This represents the mean of the Laplace calculation results. This represents the standard deviation of the Laplace calculation result. Image height, Image width, express The value is restricted to the interval [a, b], where α represents the sharpening intensity coefficient. These are the pixel values ​​of the image after initial illumination compensation processing, where x and y represent the spatial coordinates of the pixel. This represents the pixel value of the sharpened output image obtained after Laplacian edge enhancement.

[0104] 2. Target Detection

[0105] Based on object detection, key points such as the barrel's border, category, and liquid level scale are identified.

[0106] like Figure 2 As shown, the object detection model structure consists of three parts: Backbone, Neck, and Head.

[0107] Backbone: As the feature extraction part of the model, it consists of multiple layers of convolutional units connected sequentially with cross-stage residual structures.

[0108] The preprocessed surface water monitoring station images are sequentially processed through multiple convolutional normalized activation units (CBS) and cross-stage partial residual blocks (CSP ResNet Block) to achieve multi-level feature extraction and semantic expression enhancement. The final output is integrated with multi-scale contextual information by the spatial pyramid pooling module (SPPF) to form a high-level feature map with strong semantic expression and multi-scale perception capabilities, providing input for subsequent feature fusion layers.

[0109] The CBS module comprises convolutional layers, batch normalization layers, and a SiLU activation function for basic feature extraction. The CSP ResNet Block module introduces some cross-stage residual connections within the feature flow to improve gradient propagation efficiency and reduce computational redundancy. The SPPF module expands the receptive field through multi-scale pooling parallel operations, enhancing the global representation capability of features. This backbone network can extract key visual features that best represent barrels, scales, liquid surfaces, and colors from complex monitoring site images, providing basic feature support for subsequent target classification and localization.

[0110] Neck: Based on the Multiple Feature Pyramid (FPN-PAN), it effectively aggregates multi-scale features from the Backbone and significantly improves the spatial detail resolution and semantic representation strength of the fused features through a cross-level bidirectional feature interaction mechanism (top-down semantic propagation and bottom-up detail feedback).

[0111] During the fusion process, features from different layers are fully transferred through feature concatenation and residual connections, further enhancing feature consistency and spatial representation integrity. After processing by this module, the output multi-scale fused feature map can still maintain clear boundaries and significant semantic features of the target structure in complex backgrounds, providing high-quality input for subsequent detection head predictions.

[0112] Head: Receives multi-scale fusion features from Neck, performs convolutional predictions at different resolutions, and outputs target detection results, namely 3 types of detection heads, corresponding to target category, bounding box and key points respectively.

[0113] In this testing process:

[0114] Bucket category determination: Based on the specific color characteristics of the scale, waste liquid buckets and pure water buckets are distinguished.

[0115] Key point detection: Scale key points are used to establish measurement benchmarks; liquid level key points are used to indicate the actual water level height. To improve the accuracy of liquid level recognition and prevent the liquid level point and scale from coinciding and affecting the recognition results, the scale points (scale key points) and liquid level points (liquid level key points) are distributed on both sides of the scale when labeling data.

[0116] 3. Image post-processing

[0117] The liquid level is calculated based on the extracted key points. To reduce outliers at individual scale points, multi-point linear fitting is used, and the key liquid level points are mapped onto the scale lines. The liquid level is then calculated based on their relative positions.

[0118] The specific steps are as follows:

[0119] (1) Fitting the scale line equation

[0120] The least squares method was used to fit the equation of the scale line based on the coordinates of the key points of the scale, as follows:

[0121]

[0122] Where n is the index of the key point on the scale. This represents the coordinates of the nth scale mark. Let A be the slope and intercept of the scale line equation, A be the design matrix, which represents the data of the predictor variables (independent variables) and defines the structure of the linear model, and y be the target vector for linear fitting.

[0123] (2) Mapping scale line equations using key liquid level points:

[0124]

[0125] in, The coordinates of the key points of the liquid level, The coordinates of the key liquid level points projected onto the fitted scale line;

[0126] (3) Calculate the liquid level

[0127] Calculate the liquid level height based on the coordinates of the mapping point and the equation of the scale line.

[0128]

[0129] in, This refers to the liquid level height. Represents the coordinate position of the first tick mark. This represents the coordinate position of the last tick mark, where i represents the tick index, ranging from 1 to n-1. Represents the relative interval between adjacent scale divisions. When the liquid level coordinates... The liquid level is 0 when it is below the first scale coordinate, and when the liquid level coordinate is... The liquid level is 1 when it is above the last scale coordinate. When the liquid level is between two graduations, the liquid level height is calculated by multiplying the relative position relationship by the relative interval between the graduations.

[0130] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for detecting the level of a bucket of liquid from an on-site image of a surface water monitoring station, characterized in that, The method comprises the following steps: S1: image preprocessing The collected surface water monitoring station field image is subjected to illumination compensation, downsampling and image sharpening operations to obtain a processed surface water monitoring station field image; S2: target detection The processed surface water monitoring station field image is detected by using a trained target detection model to obtain a barrel category detection result and a key point detection result of the corresponding barrel in the image; S3: liquid level detection The liquid level height in the barrel is calculated according to the key point detection result of the barrel; S4: active early warning The liquid level height in each barrel is monitored in real time, and an alarm is issued when the liquid level height exceeds a preset threshold, and an operation and maintenance personnel is notified through a network for timely processing.

2. The bucket fluid level detection method for in-situ images of a surface water monitoring station according to claim 1, characterized in that, In the step S1, the specific process of illumination compensation is as follows: S11: color space conversion is performed, and the specific formula is as follows: ; wherein, is the original image, i.e. the on-site image of the surface water monitoring station, represents a color space conversion function, represents a channel separation operation, respectively represent the original luminance component, the green-red chrominance component and the blue-yellow chrominance component; S12: global illumination is estimated by Gaussian kernel convolution to realize illumination component estimation, and the specific formula is as follows: ; ; wherein, is the in-core coordinate, denotes a Gaussian kernel, for controlling the scale of the Gaussian kernel, denotes a convolution operation, denotes the blurred illumination component matrix; S13: illumination-reflectance decomposition is performed in the logarithmic domain, and the specific formula is as follows: ; wherein, represents the log-domain reflection component matrix; Transform to linear space and normalize: ; wherein represents a linear normalization process, represents a reflection component; S14: contrast limited histogram equalization is performed, and the specific formula is as follows: ; wherein, represents a histogram equalization process, represents an equalized reflection component, represents a histogram clipping threshold, , represents a patch grid size, ; S15: the output brightness dynamic range is adjusted by gamma correction: ; wherein to correct the back reflection component, ; S16: the image is reconstructed to obtain an illumination compensated surface water monitoring station field image, and the specific formula is as follows: ; wherein, is the reconstructed image, i.e. the illumination compensated on-site image of the surface water monitoring station, denotes a channel merge operation; is a color space conversion function.

3. The bucket fluid level detection method for in-situ images of a surface water monitoring station according to claim 2, characterized in that, In said step S1, the down-sampling is performed on the light- compensated in-situ image of the surface water monitoring station Bilinear interpolation scaling to fixed size is performed.

4. The bucket fluid level detection method for in-situ images of a surface water monitoring station according to claim 3, characterized in that, In the step S1, during the image downsampling process, a Laplacian operator is used to fuse with the original image to enhance the edge and texture features in the image, and the specific formula is as follows: ; ; ; wherein, denotes a discrete Laplacian convolution kernel, denotes a convolution operation, denotes an output edge enhanced image, denotes a mean value of Laplacian calculation results, denotes a standard deviation of Laplacian calculation results, is an image height, is an image width, denotes a value of is limited in the interval [a, b], and a denotes a sharpening intensity coefficient, is a pixel value of an image after pre-illumination compensation post-processing, and x, y represent spatial coordinates of a pixel point, denotes a pixel value of a sharpening output image obtained after Laplacian edge enhancement.

5. The bucket fluid level detection method for in-situ images of surface water monitoring stations according to claim 1, characterized in that, In the step S2, the target detection model comprises three parts of Backbone, Neck and Head, multi-scale features of an image are extracted through the Backbone part, feature fusion is performed through the Neck part, and finally the Head part generates a target category, a bounding box and key points based on the fused features, wherein the Backbone part comprises sequentially connected multi-layer convolution units and a cross-stage residual structure, the Neck part is realized based on a multi-feature pyramid, and the Head part receives multi-scale fused features from the Neck part, performs convolution prediction at different resolutions respectively, and outputs target detection results.

6. The bucket fluid level detection method for in-situ images of a surface water monitoring station according to claim 5, characterized in that, In the step S2, the barrel category comprises a waste liquid barrel and a pure water barrel, and the corresponding key points comprise scale key points and liquid level key points, wherein the scale key points are used to establish a measurement reference, and the liquid level key points are used to represent an actual water level height, and the scale key points and the liquid level key points are distributed on both sides of the scale on the barrel.

7. The bucket fluid level detection method for in-situ images of surface water monitoring stations according to claim 1, characterized in that, In the step S3, the specific calculation process is as follows: S31: a scale line equation is fitted according to the scale key points by using a least square method, and the specific formula is as follows: ; Wherein, n is the scale key point serial number, The coordinates of the nth scale key point are represented, The slope and intercept of the scale line equation, A is the design matrix, and y is the target vector of linear fitting. S32: the scale line equation is mapped by using the liquid level key points, and the specific formula is as follows: ; wherein, is the liquid level key point coordinate, is the coordinate of the liquid level key point projected onto the fitted scale line; S33: the liquid level height is calculated according to the mapping point coordinates and the scale line equation: ; wherein, is the liquid level height, represents the coordinate position of the first scale, represents the coordinate position of the last scale, i represents the scale index, ranging from 1 to n-1, represents the relative interval of adjacent scales; when the liquid level coordinate is lower than the first scale coordinate, the liquid level is 0, when the liquid level coordinate is higher than the last scale coordinate, the liquid level height is 1, when the liquid level coordinate is between 2 scales, the liquid level height is calculated according to the relative position relationship multiplied by the scale relative interval.

8. A tank level detection system for on-site images of surface water monitoring stations, characterized by, The method of any one of claims 1-7 is used for liquid level height detection of each barrel in a surface water monitoring station field image, comprising: An image preprocessing module is configured to perform illumination compensation, downsampling and image sharpening operations on the collected surface water monitoring station field image to obtain a processed surface water monitoring station field image; The target detection module is configured to utilize the trained target detection model to detect the processed in-situ image of the surface water monitoring station, and obtain a barrel category detection result and a key point detection result of a corresponding barrel in the image. The liquid level detection module is configured to calculate a liquid level height in the barrel according to the key point detection result of the barrel. The active early warning module is configured to monitor the liquid level height in each barrel in real time, and issue an alarm when the liquid level height exceeds a preset threshold, and notify an operation and maintenance personnel through a network for timely processing.

Citation Information

Patent Citations

  • Measuring cylinder liquid level identification method and device

    CN112132131A

  • Oil cup liquid level detection method for oil transportation station inspection robot

    CN114119471A

  • Magnetic turning plate liquid level reading method and device based on machine vision and readable medium

    CN115546539A

  • Improved YoV4-Tiny-based chemical reaction kettle liquid level identification method

    CN117726828A

  • Ship water gauge identification method, system and equipment based on deep learning

    CN119625754A