An industrial pipeline water leakage detection method, device, equipment and readable storage medium
By using an improved YOLOv5 model and a sliding window image processing method, cropping and preprocessing of industrial pipeline video data solves the problem of low accuracy in industrial pipeline leak detection, and improves the detection capability for small water droplets and the accuracy of leak detection.
Patent Information
- Application Number
- CN202310670818.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2043-06-07
AI Technical Summary
Existing technologies for detecting leaks in industrial pipelines have low accuracy, especially during long-distance transmission where the signal-to-noise ratio is extremely low, making it difficult to effectively detect even minor leaks.
An improved YOLOv5 model is used for leak detection. By adding a 4x downsampling layer to the neck network layer and a GAM module with self-attention mechanism to the head network layer, combined with the sliding window image processing method, the video data of industrial pipelines is cropped and preprocessed to improve the feature information extraction capability.
It improves the accuracy of leak detection in industrial pipelines, especially the ability to detect small water droplets, reduces the loss of deep semantic information and location, enhances the exchange of global feature information, and improves the accuracy of leak detection.
Smart Images

Figure CN116542965B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of industrial pipeline water leakage detection, and particularly relates to an industrial pipeline water leakage detection method, device, equipment and readable storage medium. BACKGROUND
[0002] With the development of economy and the acceleration of urbanization, water pollution is serious, unreasonable water use and other problems, which aggravate the contradiction between supply and demand of water resources. Especially, the phenomenon of industrial pipeline water leakage is very serious, the influence brought by leakage will not only cause economic loss, but also seriously damage the surrounding environment and further cause water resource loss in life, which directly affects the daily life of the people. Therefore, real-time industrial pipeline water leakage detection and positioning technology is very important.
[0003] At present, most of the traditional industrial pipeline water leakage detection technologies are based on detection sensors to detect pipeline water leakage. Due to various noise interferences in the pipeline transmission process, long-distance transmission attenuation of the leakage signal, and tiny industrial water leakage and other reasons, the actual sensor collected sensing signal is very weak, the signal-to-noise ratio is extremely low, and the accuracy of industrial pipeline water leakage detection is seriously affected. Especially, with the increase of the detection distance of the industrial pipeline, it is more difficult to extract the water leakage signal from the actual measured sensor signal. SUMMARY
[0004] In view of the problems in the prior art, the present application provides an industrial pipeline water leakage detection method, device, equipment and readable storage medium, which can improve the accuracy of industrial pipeline water leakage detection.
[0005] In order to solve the above technical problems, the present application is realized by the following technical scheme:
[0006] An industrial pipeline water leakage detection method, comprising:
[0007] acquiring video data of an industrial pipeline to be detected;
[0008] cropping each frame of image in the video data to obtain a plurality of image units corresponding to each frame of image;
[0009] inputting the plurality of image units corresponding to each frame of image into a pre-trained industrial pipeline water leakage detection model, wherein the industrial pipeline water leakage detection model outputs image units containing water leakage features; and the industrial pipeline water leakage detection model is obtained by training an improved yolov5 model using industrial pipeline images containing water leakage features.
[0010] Further, the improved yolov5 model comprises a neck network layer added with a 4-fold down-sampling layer and a head network layer added with a GAM module with a self-attention mechanism at each layer.
[0011] The training of the industrial pipeline water leakage detection model comprises:
[0012] obtaining a training data set comprising a plurality of groups of training data, each group of training data comprising an industrial pipeline image containing a water leakage feature and a water leakage feature label;
[0013] training the improved yolov5 model using the training data set to obtain the industrial pipeline water leakage detection model, wherein the 4x down-sampling layer in the neck network layer is used to enhance the extraction of water leakage feature information in the shallow network, and the GAM module with self-attention mechanism in each layer of the head network layer is used to enhance the extraction of global water leakage feature information.
[0014] Further, the 4x down-sampling layer is a 4x down-sampling FPN network.
[0015] Further, the improved yolov5 model further comprises a backbone network layer and 4 groups of 12 anchor boxes generated by k-means.
[0016] Further, the method for obtaining the training data set comprises:
[0017] obtaining video data of a water leakage industrial pipeline;
[0018] preprocessing each frame of image of the video data of the water leakage industrial pipeline, the preprocessing comprising cleaning and augmentation;
[0019] labeling each frame of image after preprocessing using a via tool.
[0020] Further, before the cropping of each frame of image in the video data, the method further comprises:
[0021] cleaning each frame of image in the video data.
[0022] Further, a sliding window image processing method is used to crop each frame of image in the video data.
[0023] An industrial pipeline water leakage detection device comprises:
[0024] an obtaining module configured to obtain video data of an industrial pipeline to be detected;
[0025] a cropping module configured to crop each frame of image in the video data to obtain a plurality of image units corresponding to each frame of image;
[0026] The detection module is used for inputting a plurality of image units corresponding to each frame of image into a pre-trained industrial pipeline leakage detection model, and the industrial pipeline leakage detection model outputs an image unit containing a leakage feature.
[0027] An apparatus includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the industrial pipeline leakage detection method when executing the computer program.
[0028] A computer readable storage medium stores a computer program, and the computer program implements the steps of the industrial pipeline leakage detection method when executed by a processor.
[0029] Compared with the prior art, the present application has at least the following beneficial effects:
[0030] The industrial pipeline leakage detection method provided by the present application obtains a plurality of image units corresponding to each frame of image by cropping each frame of image in the to-be-detected industrial pipeline video data, and inputs the plurality of image units corresponding to each frame of image into a pre-trained industrial pipeline leakage detection model, wherein the industrial pipeline leakage detection model is obtained by training an improved yolov5 model using industrial pipeline images containing leakage features. The plurality of image units are obtained by cropping each frame of image in the to-be-detected industrial pipeline video data, which highlights the feature content information of the target region image, thereby improving the precision of leakage detection. The improved yolov5 model adds a 4-fold downsampling layer in the neck network layer, that is, adds a detection output layer in the shallow information of the neck network layer of the yolov5 model, which can obtain a higher duty ratio of small target water droplet feature information, thereby improving the precision of small water droplet target detection. Each layer of the head network layer of the improved yolov5 model is added with a GAM module with a self-attention mechanism. For the features that the color of the industrial pipeline leakage liquid is not obvious and the shape is variable, the GAM module with the self-attention mechanism is added to obtain more content and position information of the image, reduce the loss of deep semantic information and position in the traditional detection, improve the ability of global feature information exchange, and further improve the detection precision of industrial leakage.
[0031] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the following preferred embodiments are described in detail below, and the accompanying drawings are described as follows. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the specific embodiments of the present application, the drawings needed to be used in the specific embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0033] Figure 1 Flow chart of the industrial pipeline water leakage detection method of the present application;
[0034] Figure 2 Improved yolov5 model structure principle diagram of the present application;
[0035] Figure 3 GAM module total principle diagram with self-attention mechanism of the present application;
[0036] Figure 4 Channel attention diagram of the GAM module;
[0037] Figure 5 Spatial attention diagram of the GAM module;
[0038] Figure 6 Slide window detection diagram in the embodiment of the present application. Specific embodiment
[0039] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the present application will be described clearly and completely in the following with reference to the drawings. Obviously, the described embodiments are some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0040] As a specific embodiment of the present application, as shown in Figure 1 An industrial pipeline water leakage detection method, specifically comprising the following steps:
[0041] S1, obtaining video data of the industrial pipeline to be detected.
[0042] Specifically, a camera is installed at the position of the industrial pipeline to be detected, which shoots the video data of the industrial pipeline to be detected in real time.
[0043] S2, cropping each frame of image in the video data to obtain a plurality of image units corresponding to each frame of image.
[0044] Preferably, as shown in Figure 6 the slide window image processing method is used to crop each frame of image in the video data, specifically:
[0045] an image size coefficient k of the sliding window is set;
[0046] each frame of image is divided into n image units according to the image size coefficient of the sliding window.
[0047] More preferably, before each frame of image in the video data is cropped, each frame of image in the video data is cleaned to filter out unclear images.
[0048] S3, inputting the image units corresponding to each frame of image into a pre-trained industrial pipeline leakage detection model, the industrial pipeline leakage detection model outputs image units containing leakage features; the industrial pipeline leakage detection model is obtained by training an improved yolov5 model using industrial pipeline images containing leakage features.
[0049] Preferably, after the image units containing leakage features are output, the image units containing leakage features are regressed to the original images corresponding thereto, that is, the industrial pipeline leakage positions are obtained. More preferably, the repeated image units containing leakage features are filtered out through Soft-Nms.
[0050] In the present application, the improved yolov5 model includes a neck network layer added with a 4-fold downsampling layer and a head network layer added with a GAM module with a self-attention mechanism at each layer; of course, the improved yolov5 model also includes a backbone network layer and an anchor box in the existing yolov5 model, the anchor box in the improved yolov5 model includes four groups of 12 anchor boxes generated by k-means, for example, the four groups of 12 anchor boxes are as follows:
[0051]
[0052] Specifically, in combination with Figure 2As shown, the backbone network layer is used to extract features of image content information. The neck network layer in the existing yolov5 model includes an 8-fold down-sampling FPN network, a 16-fold down-sampling FPN network and a 32-fold down-sampling FPN network, the neck network layer in the improved yolov5 model includes a 4-fold down-sampling FPN network, an 8-fold down-sampling FPN network, a 16-fold down-sampling FPN network and a 32-fold down-sampling FPN network, and the 4-fold down-sampling layer in the neck network layer of the improved yolov5 model is used to enhance the extraction of shallow network leakage feature information. Each layer of the head network layer in the existing yolov5 model is a Block module, each layer of the head network layer in the improved yolov5 model is added with a GAM module with a self-attention mechanism, and the GAM module with a self-attention mechanism in each layer of the head network layer in the improved yolov5 model is used to enhance the extraction of global leakage feature information.
[0053] In this embodiment, the training of the industrial pipeline leakage detection model is as follows:
[0054] A training data set is obtained, which includes a plurality of groups of training data, each group of training data including an industrial pipeline image containing leakage features and a leakage feature label.
[0055] The improved yolov5 model is trained using the training data set until the training gradient loss does not decrease, the training is stopped, the best model is saved, and the industrial pipeline leakage detection model is obtained.
[0056] Preferably, the training data set is obtained by the following method:
[0057] Video data of a leakage industrial pipeline is obtained, specifically, video data of a leakage industrial pipeline is obtained by using a camera to capture video containing an industrial pipeline leakage site;
[0058] Each frame of image of the pre-processed video data of the leakage industrial pipeline is pre-processed, the pre-processing includes cleaning and augmentation, and the pre-processed sample is expanded and increased after pre-processing;
[0059] Each frame of image after pre-processing is labeled by using a via tool, and the target position category of each frame of image after pre-processing is labeled by using a via tool, and the category is divided into two categories: normal and leakage.
[0060] For ease of understanding, the improved yolov5 model is explained in more detail as follows: Figure 4 Figure 5 The improved yolov5 model is explained in more detail as follows:
[0061] Specifically, GAM consists of two parts: a channel attention module and a spatial attention module, defined as follows: Figure 3 The input feature map F1 passes through the channel attention mechanism M. C The processed output is dot-productted with the input feature map F1 to obtain feature map F2; the output of feature map F2 after being processed by the spatial attention mechanism is dot-productted with feature map F2 to obtain feature map F3, and finally the output feature map after GAM processing is obtained.
[0062] Reference Figure 4 As shown, this is the channel attention module of GAM, which can improve the information learning ability of the target to be detected. Specifically, the dimensions of the input F1 feature map (C, W, H) are transposed to (H, W, C) dimensions. Then, the information exchange between channels is enhanced by the codec MLP, thereby improving the nonlinear fitting ability of the network. The dimensions are then transposed back to the original (C, W, H) dimension features. Finally, the feature map is normalized by the sigmoid function.
[0063] Reference Figure 5 As shown, the GAM spatial attention module focuses on learning the location information of the image target, improving the accuracy of target location. Specifically, the feature map F2 is input into the first 7*7 convolutional network, which compresses the channel information into a fused form, greatly reducing the computational load and improving network performance. Then, the output feature map is passed through a second 7*7 convolutional network to transform the channel information into the target's spatial location information, thereby improving the target localization accuracy.
[0064] The image is detected using a small sliding window image as follows:
[0065] Set the image size coefficient k for the small sliding window;
[0066] Each frame of image is divided into n image units for detection based on the image size coefficient of the sliding window;
[0067] Regress the recognition results on all image units back to the original image;
[0068] Duplicate detection content is filtered out using Soft-Nms.
[0069] The present invention also provides an industrial pipeline leakage detection device, specifically comprising:
[0070] The acquisition module is used to acquire video data of the industrial pipeline to be inspected. Preferably, the acquisition module is connected to a camera installed at the location of the industrial pipeline to be inspected, and the camera sends the real-time video data of the industrial pipeline to the acquisition module.
[0071] The cropping module is used to crop each frame of the video data to obtain several image units corresponding to each frame.
[0072] The detection module is used to input several image units corresponding to each frame of the image into a pre-trained industrial pipeline leakage detection model. The industrial pipeline leakage detection model outputs image units containing leakage features. The industrial pipeline leakage detection model is obtained by training an improved YOLOv5 model using industrial pipeline images containing leakage features.
[0073] In one embodiment of the present invention, a computer device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to achieve a corresponding method flow or corresponding function. The processor described in this embodiment of the present invention can be used to implement the operation of an industrial pipeline leakage detection method.
[0074] In one embodiment of the present invention, if an industrial pipeline leakage detection method is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data.
[0075] The computer storage medium can be any available medium or data storage device that a computer can access, including but not limited to magnetic storage (e.g., floppy disks, hard disks, magnetic tapes, magneto-optical disks (MOs)), optical storage (e.g., CDs, DVDs, BDs, HVDs), and semiconductor storage (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs)).
[0076] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0077] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0078] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0079] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0080] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection of the claims.
Claims
1. A method for detecting leaks in industrial pipelines, characterized in that, include: Acquire video data of the industrial pipeline to be inspected; Each frame of the video data is cropped to obtain several image units corresponding to each frame. Each frame of the image is input into a pre-trained industrial pipeline leak detection model, which outputs image units containing leak features. The industrial pipeline leak detection model is obtained by training an improved YOLOv5 model using industrial pipeline images containing leak features. The improved YOLOv5 model includes a neck network layer with a 4x downsampling layer and a head network layer with a GAM module with self-attention mechanism in each layer. The training of the industrial pipeline leakage detection model includes: Obtain a training dataset, which includes several sets of training data, each set of training data including industrial pipeline images containing leakage features and leakage feature labels. The improved YOLOv5 model is trained using the training dataset to obtain the industrial pipeline leakage detection model. The 4x downsampling layer in the neck network layer is used to enhance the extraction of leakage feature information in the shallow network, and each layer in the head network layer has a GAM module with self-attention mechanism to enhance the extraction of global leakage feature information. The improved YOLOv5 model also includes a backbone network layer and four sets of twelve anchor boxes generated by k-means.
2. The method for detecting leaks in industrial pipelines according to claim 1, characterized in that, The 4x downsampling layer is a 4x downsampling FPN network.
3. The method for detecting leaks in industrial pipelines according to claim 1, characterized in that, The methods for obtaining the training dataset include: Acquire video data of leaking industrial pipes; Each frame of the video data of the leaking industrial pipeline is preprocessed, including cleaning and augmentation. The via tool was used to annotate each frame of the preprocessed image.
4. The method for detecting leaks in industrial pipelines according to claim 1, characterized in that, Before cropping each frame of the video data, the method further includes: Each frame of the video data is cleaned.
5. The method for detecting leaks in industrial pipelines according to claim 1, characterized in that, The sliding window image processing method is used to crop each frame of the video data.
6. An industrial pipeline leakage detection device, characterized in that, A method for detecting leaks in industrial pipelines as described in any one of claims 1 to 5, comprising: The acquisition module is used to acquire video data of the industrial pipeline to be inspected; The cropping module is used to crop each frame of the video data to obtain several image units corresponding to each frame. The detection module is used to input several image units corresponding to each frame of the image into a pre-trained industrial pipeline leakage detection model. The industrial pipeline leakage detection model outputs image units containing leakage features. The industrial pipeline leakage detection model is obtained by training an improved YOLOv5 model using industrial pipeline images containing leakage features.
7. An apparatus comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the industrial pipeline leakage detection method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the industrial pipeline leakage detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Water leakage and oil leakage image recognition method and device based on target tracking algorithm
CN116152737A
Transformer oil leakage detection method based on improved YOLOv5
CN116205895A