Water level detection method, device and system and storage medium

By dividing the water level line image into key detection images and using improved Swin Transformer and Hough transformation technology, the problem of high detection error rate of traditional water level line detection methods in the face of liquid level fluctuations or dynamic changes is solved, and efficient and accurate water level line detection is achieved.

CN119741606APending Publication Date: 2025-04-01DONGHAI STANDARD MEASUREMENT CENT OF THE STATE OCEANIC ADMINISTRATION (SHANGHAI BRANCH OF THE NAT OCEANIC MEASUREMENT STATION) +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411811146.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

When traditional water level line detection methods face fluctuations in the measured liquid level or dynamic changes in the liquid level height, it is difficult to achieve efficient detection, resulting in a high detection error rate.

Method used

The water level line detection is performed on the key detection images containing the water level line by dividing the water level line image into multiple key detection images, and using the water level line identification model based on the improved Swin Transformer and the Hough transformation algorithm.

Benefits of technology

It realizes efficient water level line detection, reduces the global water level line detection error rate, and improves the accuracy and applicability of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741606A_ABST
    Figure CN119741606A_ABST
Patent Text Reader

Abstract

The invention discloses a water line detection method, device and system, and a storage medium. The method comprises the following steps: S1, dividing a to-be-processed water line image into a plurality of key detection images; s2, performing water level line identification on the plurality of key detection images; and S3, carrying out water line detection on the key detection image containing the water line. By the adoption of the technical scheme, efficient water level detection is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing technology, and in particular relates to a water level detection method and device, a system, and a storage medium. Background Art

[0002] Water level measurement is a technology that studies the location information of the interface between two different media. In terms of disaster prevention and mitigation, water level monitoring is an important part of the flood warning system. By real-time monitoring of the water level, floods can be predicted in advance, and corresponding protective measures can be taken to reduce casualties and property losses. Secondly, in water resource management, accurate water level data helps to scientifically and rationally dispatch water resources, optimize the management of reservoirs, rivers, and irrigation systems, and ensure the stability of agricultural water use and urban water supply. In addition, water level changes can also reflect the health of ecosystems such as rivers, lakes, and wetlands, and have important reference value for environmental protection. Through water level detection, changes in the ecological environment can be discovered and responded to in a timely manner, and the balance of the natural environment can be maintained. Water level detection is of great significance in many fields. How to build a safe, stable, reliable, accurate, and highly applicable measurement system has become the research focus of scholars.

[0003] From ancient times to now, there are various ways and methods for measuring water level. At present, the main methods used are float type, ultrasonic type, pressure difference type, radar type, capacitance type, nuclear radiation type, etc. With the development of science and technology, water level measurement technology has become more and more universally applicable, with a wider range of measurement objects and more excellent safety performance. This brings great difficulties to water level measurement, especially when the measured liquid level fluctuates or the liquid level height changes dynamically over time. In these cases, traditional liquid level measurement methods have great limitations and it is difficult to achieve the expected results. Summary of the invention

[0004] The technical problem to be solved by the present invention is to improve a water level line detection method and device, system, and storage medium to achieve efficient water level line detection.

[0005] To achieve the above object, the present invention adopts the following technical solution:

[0006] A water level detection method, comprising:

[0007] Step S1, dividing the water level line image to be processed into a plurality of key detection images;

[0008] Step S2, identifying water level lines of multiple key detection images;

[0009] Step S3: Perform water level detection on the key detection image containing the water level.

[0010] Preferably, in step S2, water level recognition is performed on multiple key detection images based on an improved Swin Transformer water level recognition model.

[0011] Preferably, in step S3, water level detection is performed on the key detection image containing the water level using a Hough transform algorithm.

[0012] The present invention also provides a water level detection device, comprising:

[0013] A division module, used for dividing the water level line image to be processed into a plurality of key detection images;

[0014] An identification module, used for identifying water level lines of multiple key detection images;

[0015] The detection module is used to perform water level detection on a key detection image containing a water level.

[0016] Preferably, the recognition module recognizes water levels of multiple key detection images based on an improved Swin Transformer water level recognition model.

[0017] Preferably, the detection module uses a Hough transform algorithm to perform water level detection on a key detection image containing a water level.

[0018] The present invention also provides a water level line detection system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes a water level line detection method when executed by the processor.

[0019] The present invention also provides a storage medium, on which a computer program is stored, and the computer program executes the water level line detection method when running.

[0020] The present invention divides the water level image to be processed into multiple key detection images; performs water level recognition on multiple key detection images; and performs water level detection on the key detection image containing the water level. The present invention uses a water level key area recognition scheme to solve the problem of high error rate of global water level detection and realize efficient water level detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0022] Figure 1 This is a flow chart of a water level detection method according to an embodiment of the present invention;

[0023] Figure 2 This is a schematic diagram of the FMP module network structure;

[0024] Figure 3 This is a schematic diagram of the CBS module network structure. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0026] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0027] Embodiment 1:

[0028] like Figure 1 As shown, an embodiment of the present invention provides a water level line detection method, comprising:

[0029] Step S1, dividing the water level line image to be processed into a plurality of key detection images;

[0030] Step S2, identifying water level lines of multiple key detection images;

[0031] Step S3: Perform water level detection on the key detection image containing the water level.

[0032] As an implementation method of an embodiment of the present invention, in step S2, water level lines are identified for multiple key detection images based on an improved SwinTransformer water level recognition model; wherein, an FMP downsampling module is designed, and the improved Swin-Transformer is used to identify whether the key detection image contains water levels, and determine whether it contains a key interval of the water level.

[0033] Furthermore, by training historical water level images, a water level recognition model based on an improved Swin Transformer is obtained. Specifically, the historical water level images are divided into multiple historical key detection images, and the improved Swin Transformer model is trained according to the historical key detection images to obtain the water level recognition model based on the improved Swin Transformer.

[0034] Furthermore, Swin Transformer is a model that applies Transformer to image classification. It is based on the idea of ​​the ViT model and innovatively introduces a sliding window mechanism, allowing the model to learn cross-window information. At the same time, through the downsampling layer, the model can process super-resolution images, save computational complexity, and focus on global and local information. The embodiment of the present invention is improved based on the tiny version of Swin Transformer "Swin-T". The water level recognition model based on the improved Swin Transformer includes: FMP module and CBS module.

[0035] FMP modules such as Figure 2 As shown in , the historical key detection image is projected to a specified dimension. First, the image is input into the convolution layer and features are compressed through max pooling to obtain the dimension. At the same time, the image is input into the CBS module with a convolution kernel of 3. The CBS module consists of a convolution module, a normalization module, and a SiLU activation function. Figure 3 As shown, the two are adjusted by FReLU activation function. FReLU is a nonlinear computer vision task activation function that can effectively improve the pixel-level spatial information modeling capability. Its expression is as follows:

[0036]

[0037] in, is a 2D Funnel shape condition that depends on the spatial context. The spatial dependency is implemented using highly optimized depthwise separable convolution operators and BN layers. The expression expansion is as follows:

[0038]

[0039] Among them, (i, j) is the pixel coordinate of the target point to be calculated, c represents the channel number, x w c,(i,j) Represented as the input pixel of the nonlinear activation function on the cth channel at position (i, j). Indicates the coefficients shared by this window under the same channel. Finally, the output obtained by adding the results of the two dimensions obtained in the previous article is obtained to obtain the final feature map. Through feature similarity identification, it is determined whether the input ROI is a local water level line image.

[0040] As an implementation of the embodiment of the present invention, in step S3, water level detection is performed on the key detection image containing the water level using a Hough transform algorithm.

[0041] Since the efficiency of the Hough transform depends on the area of ​​the selected pixels, if the Hough transform is directly applied to the image, the pixels of the image have similar values, which greatly increases the complexity of the Hough transform. Therefore, the key detection image is edged to separate the sea and sky parts, and then the Hough transform is used to extract the straight lines in the key detection image. First, the key detection image containing the water level line is subjected to Gaussian filtering to eliminate noise, then the image is gradient calculated, and then the noise is suppressed using non-maximum values. Finally, the water level line is extracted based on the straight line of the Hough transform, which includes:

[0042] The first step: eliminate noise. The derivatives of the first and second order images are explored, but noise has a great impact on the derivatives, so the first step is to use filtering to prioritize the key detection images and improve the smoothness of the image. Gaussian filtering is used, that is, weighted summation of the image matrix point by point through convolution to achieve the purpose of noise reduction.

[0043] Step 2: Gradient calculation. The partial derivative of the image grayscale is calculated by using the Sobel template, that is, the following template is used for calculation in the x and y directions:

[0044]

[0045] After template processing, the gradient value and direction of the image can be calculated:

[0046]

[0047] The direction takes values ​​every 45°, i.e. 0°, 45°, 90°, 135°.

[0048] Step 3: Non-maximum suppression. First, use the gradient to calculate a part of the image, and use the maximum value of this gradient as the threshold for comparison. The image pixels below the threshold are suppressed, that is, the possibility of becoming image edge points is excluded, and the gray value corresponding to the local threshold is used as the candidate edge. This step is the most important in Canny detection, which excludes many non-edge points.

[0049] Step 4: Hysteresis threshold. This step is mainly to finally screen and determine the many candidate edge points in the previous step. If only a single threshold is used for screening, a lot of useful information may be missed or some noise may be retained. Canny improves it by setting two thresholds, high and low. When the value of a pixel in the image exceeds the high threshold, it must be an edge pixel; if its pixel value is lower than the low threshold, it is excluded from the possibility of becoming an edge point; if its pixel value is between the low and high thresholds, it is used as a connected pixel.

[0050] Step 5: Extract water level line results based on Hough transform straight line.

[0051] The embodiment of the present invention is based on the Swin-Transformer framework, designs the FMP downsampling layer to be embedded in the original model, and improves the feature extraction capability of the original model; and realizes water level detection based on the fusion of key area recognition technology and Hough transform technology.

[0052] Embodiment 2:

[0053] The embodiment of the present invention further provides a water level detection device, comprising:

[0054] A division module, used for dividing the water level line image to be processed into a plurality of key detection images;

[0055] An identification module, used for identifying water level lines of multiple key detection images;

[0056] The detection module is used to perform water level detection on a key detection image containing a water level.

[0057] As an implementation manner of the embodiment of the present invention, the recognition module performs water level recognition on multiple key detection images based on the improved Swin Transformer water level recognition model.

[0058] As an implementation method of the embodiment of the present invention, the detection module uses a Hough transform algorithm to perform water level line detection on a key detection image containing a water level line.

[0059] Embodiment 3:

[0060] An embodiment of the present invention further provides a water level line detection system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes a water level line detection method when executed by the processor.

[0061] Embodiment 4:

[0062] An embodiment of the present invention further provides a storage medium, on which a computer program is stored, and the computer program executes the water level line detection method when running.

[0063] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.

Claims

1. A water level detection method, characterized in that: include: Step S1, dividing the water level line image to be processed into a plurality of key detection images; Step S2, identifying water level lines of multiple key detection images; Step S3: Perform water level detection on the key detection image containing the water level.

2. The water level detection method according to claim 1, characterized in that: In step S2, water level recognition is performed on multiple key detection images based on the improved SwinTransformer water level recognition model.

3. The water level detection method according to claim 2, characterized in that: In step S3, water level detection is performed on the key detection image containing the water level using a Hough transform algorithm.

4. A water level detection device, characterized in that: include: A division module, used for dividing the water level line image to be processed into a plurality of key detection images; An identification module, used for identifying water level lines of multiple key detection images; The detection module is used to perform water level detection on a key detection image containing a water level.

5. The water level detection device according to claim 4, characterized in that: The recognition module recognizes water levels of multiple key detection images based on the improved SwinTransformer water level recognition model.

6. The water level detection device according to claim 5, characterized in that: The detection module uses the Hough transform algorithm to perform water level detection on the key detection image containing the water level.

7. A water level detection system, characterized in that: include: A memory and a processor, wherein the memory stores a computer program executed by the processor, and when the computer program is executed by the processor, the water level line detection method according to any one of claims 1 to 3 is executed.

8. A storage medium, characterized in that: The storage medium stores a computer program, and the computer program executes the water level line detection method according to any one of claims 1 to 3 when running.

Citation Information

Patent Citations

  • Water level measuring method and device, electronic equipment and storage medium

    CN116206161A

  • Water gauge water level identification method based on target detection

    CN116309780A

  • Water body segmentation and water line extraction system and method based on machine vision

    CN117132527A

  • Method of obtaining an attention matrix for use in a transformer-based model, non-transitory computer readable storage medium and apparatus

    US20240378861A1