Pipeline leakage detection method based on improved YOLOv7 model

By using ShuffleNet network and Pconv module in the YOLOv7 model and combining the ESRGAN strategy to clear the image, the problem of low detection efficiency caused by the large data processing volume of the YOLOv7 model is solved, and the efficiency and accuracy of pipeline leakage detection are improved.

CN119229254APending Publication Date: 2024-12-31INNER MONGOLIA UNIV OF SCI & TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411274649.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In the pipeline leakage detection in the prior art, the data processing volume of the YOLOv7 model is large, resulting in a decrease in detection efficiency. There is little research in the field of pipeline leakage, and the leakage detection accuracy needs to be improved.

Method used

The improved YOLOv7 model is adopted, and the backbone network is replaced with the ShuffleNet network, and the Pconv module and the convolution attention module are introduced into the head network, and the image is cleared and processed in combination with the ESRGAN strategy to improve detection efficiency and accuracy.

Benefits of technology

While maintaining detection accuracy, the model can process data in a lightweight manner, improve data processing efficiency, and thus improve pipeline leakage detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119229254A_ABST
    Figure CN119229254A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of pipeline leakage detection, in particular to a pipeline leakage detection method based on an improved YOLOv7 model, and the method comprises the steps: obtaining an initial image of the surface of a leaked pipeline; performing sharpening processing on the image based on an ESRGAN strategy to obtain a current image; and inputting the current image into a pre-trained improved YOLOv7 model. According to the pipeline leakage detection method based on the improved YOLOv7 model, a backbone network in the existing YOLOv7 is replaced by the ShuffleNet network, the head network comprising the Pconv module is combined, and the attention unit is added, so that on the premise of keeping the detection precision, the data processing amount of the model is reduced, the data processing efficiency is improved, and the detection efficiency is improved. And the pipeline leakage detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pipeline leakage detection, and in particular to a pipeline leakage detection method based on an improved YOLOv7 model. Background Art

[0002] Pipeline systems are critical energy transportation and supply networks in modern industry, but pipeline leakage is a serious problem that can cause environmental damage, safety risks, and economic losses. There are five main causes of leakage: external force, human negligence, equipment failure, natural causes, and corrosion. Therefore, it is crucial to effectively detect and deal with pipeline leaks. Current detection methods include manual detection, acoustic detection, and fiber optic detection. Manual detection is low in real time and efficiency; acoustic detection is challenging in complex networks; fiber optic detection is accurate but costly and requires pre-laying.

[0003] Therefore, researchers gradually adopt deep learning methods for leak detection. Deep learning object detection algorithms can be divided into two-stage and single-stage. Two-stage, such as Faster R-CNN, is accurate but slow; single-stage, such as YOLO, processes object detection as a whole, improving real-time performance. The YOLO series is constantly improving. YOLOv5 is lightweight and flexible, and YOLOv7 is faster and more accurate, suitable for real-time detection needs.

[0004] However, there is little research on the YOLOv7 algorithm in the field of pipeline leakage, the leakage detection accuracy needs to be improved, and the model has a large amount of data processing, which leads to a decrease in data processing speed, thus affecting the detection efficiency. Summary of the invention

[0005] In view of this, the object of the present invention is to provide a pipeline leakage detection method based on an improved YOLOv7 model.

[0006] In a first aspect, an embodiment of the present invention provides a pipeline leakage detection method based on an improved YOLOv7 model, the method comprising:

[0007] Acquire an initial image of the surface of the leaking pipeline;

[0008] The image is sharpened based on the ESRGAN strategy to obtain the current image;

[0009] The current image is input into the pre-trained improved YOLOv7 model. The ShuffleNet network and convolutional attention module in the backbone network extract features from the input current image, perform feature fusion, and then transmit the features to the head network including the Pconv module to output the detection results.

[0010] In combination with the first aspect, the step of obtaining an initial image of the surface of the leaking pipeline includes:

[0011] Collect video images of the surface of the leaking pipeline;

[0012] According to the preset video frame interception rules, the video image is intercepted to obtain multiple initial images.

[0013] Combined with the first aspect, the training process of the improved YOLOv7 model is as follows:

[0014] Obtaining an initial training data set, where the initial training data set includes a plurality of initial training image data;

[0015] Based on the ESRGAN strategy, all the initial training image data are clarified to obtain the first training data set;

[0016] For each image data in the first training data set, the image data is annotated and a leakage position annotation is added to obtain a training data set;

[0017] Build a data set and divide the pre-training data set into a training set and a validation set;

[0018] The initial improved YOLOv7 model is trained using the training set and verified using the validation set to obtain a trained YOLOv7 model that meets the preset requirements.

[0019] In combination with the first aspect, before the step of obtaining an initial training data set, wherein the initial training data set includes a plurality of initial training picture data, the method further includes:

[0020] Build the YOLOv7 initial model, which includes the input end, the backbone network and the head network;

[0021] Use ShuffleNetV2 network to replace the backbone network;

[0022] The ELAN structure in the head network is replaced by the ELAN-P structure containing the PConv module;

[0023] A convolutional attention module is added between the backbone network and the head network to obtain an improved YOLOv7 model.

[0024] Combined with the first aspect, before using the ShuffleNetV2 network to replace the backbone network, the following steps are also included:

[0025] Add a Max Pool module between the input and the backbone network.

[0026] In combination with the first aspect, the steps of training the initial improved YOLOv7 model using the training set include:

[0027] Use the training set to train the Max Pool module and ShuffleNetV2 network to generate feature data;

[0028] The convolutional attention module is trained using the feature data to output the target feature data;

[0029] The head network including the PConv module is trained using the target feature data to output detection prediction results.

[0030] In combination with the first aspect, for each image data in the first training data set, the step of annotating the image data, adding a defect type label and annotating the defect position to obtain the training data set includes:

[0031] Use the Labeling tool to select the pipeline leakage location in the image data;

[0032] Enhance the image of the selected area and mark it;

[0033] Store the annotated image data in the specified file format.

[0034] In a second aspect, the present application provides a pipeline leakage detection device based on an improved YOLOv7 model, the device comprising:

[0035] An acquisition module, used for acquiring an initial image of the surface of the leaking pipeline;

[0036] A processing module is used to perform image sharpening processing based on the ESRGAN strategy to obtain the current image;

[0037] The detection module is used to input the current image into the pre-trained improved YOLOv7 model. The ShuffleNet network and convolutional attention module in the backbone network extract the features of the input current image and perform feature fusion, and then transmit the features to the head network including the Pconv module to output the detection results.

[0038] In a third aspect, the present application provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the above method.

[0039] In a fourth aspect, the present application provides a readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the above method is executed.

[0040] The embodiments of the present invention bring the following beneficial effects: The embodiments of the present invention provide a pipeline leakage detection method based on an improved YOLOv7 model, the method comprising: obtaining an initial image of the surface of the leaking pipeline; clarifying the image based on the ESRGAN strategy to obtain a current image; inputting the current image into a pre-trained improved YOLOv7 model, the ShuffleNet network and the convolutional attention module in the backbone network extracting features from the input current image, performing feature fusion, and transmitting the features to a head network including a Pconv module, and outputting a detection result.

[0041] The present application provides a pipeline leakage detection method based on an improved YOLOv7 model. The ShuffleNet network replaces the backbone network in the existing YOLOv7, combines the head network including the Pconv module, and adds an attention unit. While maintaining the detection accuracy, the model can process light-weight data, improve data processing efficiency, and thus improve pipeline leakage detection efficiency.

[0042] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0045] Figure 1 A flow chart of a pipeline leakage detection method based on an improved YOLOv7 model provided in an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of the principle of the Residual-in-Residual-DeseBlock (RRDB) module in the ESRGAN strategy provided in an embodiment of the present invention;

[0047] Figure 3 A schematic diagram of group convolution in the ShuffleNetV2 network structure provided in an embodiment of the present invention;

[0048] Figure 4 A schematic diagram of the spatial downsampling principle of the ShuffleNetV2 network structure provided in an embodiment of the present invention;

[0049] Figure 5 A schematic diagram of the basic unit of the ShuffleNetV2 network structure provided in an embodiment of the present invention;

[0050] Figure 6 It is a structural diagram of the ELAN module in the head network of the YOLOv7 model in the related art;

[0051] Figure 7 A structural diagram of the ELAN-P module in the YOLOv7 initial model provided in an embodiment of the present invention;

[0052] Figure 8 A structural diagram of the SPPCSPC module in the YOLOv7 initial model provided in an embodiment of the present invention;

[0053] Fig. 9 A structural diagram of the MP-2 module in the YOLOv7 initial model provided in an embodiment of the present invention;

[0054] Fig.10 A schematic diagram of the structure of a convolutional attention module provided in an embodiment of the present invention;

[0055] Fig.11 A schematic diagram of a one-dimensional global pooling operation in the vertical direction provided by an embodiment of the present invention;

[0056] Fig.12 A schematic diagram of a one-dimensional global pooling operation in the horizontal direction provided by an embodiment of the present invention;

[0057] Fig.13 An improved YOLOv7 model provided by an embodiment of the present invention;

[0058] Fig.14 A structural diagram of a pipeline leakage detection device based on an improved YOLOv7 model provided in an embodiment of the present invention;

[0059] Fig.15 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

[0060] Reference numerals:

[0061] 10-acquisition module, 20-processing module, 30-detection module;

[0062] 130 - processor, 131 - memory, 132 - bus, 133 - communication interface. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0064] To facilitate understanding of this embodiment, the application scenarios and design concepts of the embodiments of the present application are briefly introduced below.

[0065] The existing YOLOv7 model has real-time detection requirements, but the model has a large amount of data processing, which leads to a decrease in data processing speed, thus affecting the detection efficiency.

[0066] Based on this, an embodiment of the present application provides a pipeline leakage detection method based on an improved YOLOv7 model.

[0067] Example 1

[0068] This application provides a pipeline leakage detection method based on an improved YOLOv7 model. Figure 1 As shown, the method includes:

[0069] S110, acquiring an initial image of the surface of the leaking pipeline.

[0070] S120, performing a clearing process on the image based on the ESRGAN strategy to obtain a current image.

[0071] S130, input the current image into the pre-trained improved YOLOv7 model, the ShuffleNet network and the convolutional attention module in the backbone network extract the features of the input current image, perform feature fusion, and then transmit the features to the head network including the Pconv module to output the detection result.

[0072] The present application provides a pipeline leakage detection method based on , which uses an improved YOLOv7 model to quickly and accurately identify pipeline leakage. The improved YOLOv7 model replaces the backbone network in the existing YOLOv7 with the ShuffleNet network, and combines it with the head network including the Pconv module. It can lighten the model processing data volume and improve data processing efficiency while maintaining detection accuracy, thereby improving pipeline leakage detection efficiency.

[0073] In combination with the first aspect, the step of obtaining an initial image of the surface of the leaking pipeline in S110 includes:

[0074] S111, collecting video images of the surface of the leaking pipeline.

[0075] S112, intercepting the video image according to a preset video frame interception rule to obtain a plurality of initial images.

[0076] In the embodiment of the present application, a video image of the leaking pipeline is collected by a camera mechanism, and the video image is intercepted to obtain a plurality of initial images.

[0077] It is understandable that the preset video frame interception rule can be selected according to the actual situation, such as sequential frame-by-frame interception, or interception at intervals of a certain number of image frames, or jump interception, which is not limited here. In this embodiment, frame-by-frame interception is performed in the order of time development.

[0078] Combined with the first aspect, the training process of the improved YOLOv7 model is as follows:

[0079] S210, obtaining an initial training data set, where the initial training data set includes a plurality of initial training picture data.

[0080] S220: Perform clarity processing on all initial training image data based on the ESRGAN strategy to obtain a first training data set.

[0081] S230 , for each image data in the first training data set, annotate the image data, add a leakage position annotation, and obtain a pre-training data set.

[0082] S240, constructing a data set, and dividing the pre-training data set into a training set and a validation set.

[0083] S250, training the initial improved YOLOv7 model using the training set, and verifying it through the verification set, to obtain a trained YOLOv7 model that meets the preset requirements; wherein the backbone network of the initial improved model includes the ShuffleNet network, the head network includes the Pconv module, and a convolutional attention module is also included between the backbone network and the head network.

[0084] After the initial improved YOLOv7 model has been built, the model is trained, verified, and optimized through a large amount of data to obtain an improved YOLOv7 model that meets the training requirements.

[0085] Step S210 obtains an initial training data set including a plurality of initial training image data. It is understandable that increasing the amount of effective training data is conducive to improving the accuracy of the model. In order to ensure that the initial training data set has sufficient diversity and coverage, initial training image data corresponding to a variety of leakage locations should be collected.

[0086] In this embodiment, in order to obtain a sufficient amount and type of leaked image data, web crawler technology is used to obtain pipeline leaked image data from multiple sources.

[0087] As another feasible method, video images may be collected for designated leaking pipelines with different leaking positions, and then image data may be obtained by intercepting the images frame by frame.

[0088] As another feasible method, it can also be image data drawn by three-dimensional software. It is understandable that due to the large demand for training data for model training, this method is usually only used to supplement training data.

[0089] Step S220 is essentially to perform a clearing process on each training data to improve the accurate expression of the training data and facilitate model recognition and data analysis. In this embodiment, an image clearing strategy based on ESRGAN is proposed. Aiming at the blur problem of video frame images collected by the pipeline leakage detection system, the principle of generative adversarial network (GAN) is used to convert low-resolution (LR) images into high-resolution (HR) images by training the generator and the discriminator to confront each other, thereby achieving the purpose of clearing processing, reducing data, and improving detection accuracy.

[0090] Specifically, Figure 2 As shown in the figure, the SRGAN strategy removes all BN layers to suppress the generation of artifacts based on SRGAN, reduces computational complexity and memory usage, introduces RRDB to replace resblock in SRGAN, and improves network performance based on more layers of dense connections. In the discriminator, the discriminant scores of real data and generated data are calculated to better distinguish them. The larger the difference (C(REAL)-E[C(FAKE)]), the higher the probability that the real data is judged as real, and the lower the probability that the generated data is judged as real. The smaller the difference (C(FAKE)-E[C(REAL)]) (the more negative it is), the lower the probability that the generated data is judged as real, and the higher the probability that the real data is judged as real.

[0091]

[0092] The symmetric objective function of the generator corresponding to the discriminator is:

[0093]

[0094] The goal of the DRa discriminator is to better distinguish between real images and generated images and improve the performance of the generative adversarial network by adjusting the difference in the discriminant scores and mapping them to the appropriate interval through the sigmoid function.

[0095] It is understandable that accurate and standard consistent labeling operations are the key to ensuring model accuracy. Therefore, in step S230, each image data is labeled to add leakage position labels to the image data, and all image data with labeled leakage positions are combined to obtain a pre-training data set.

[0096] After each image data in the pre-training data set is labeled in step S230, step S240 divides the pre-training data set into independent training sets and validation sets according to the preset, without repeated images, to ensure the generalization ability and robustness of the model and prevent overfitting during the model training process.

[0097] For example, in step S210, the number of images in the initial training data set is 3650. After the sharpening process in step S220 and the labeling process in step S230, the number of image data in the pre-training data set should not change and is still 3650. At this time, step S240 divides the training data set according to the preset ratio of 8:2, the number of image data in the training set should be 3650×0.8=2920, and the number of image data in the verification set should be 3650×0.2=730.

[0098] Step S250 uses the training set to train the initial improved YOLOv7 model, and verifies it through the verification set, so as to continuously optimize the initial improved YOLOv7 model until a trained improved YOLOv7 model that meets the preset requirements is obtained. Since the backbone network of the initial improved model includes the ShuffleNet network, the head network includes the Pconv module (refer to Figure 7 The PBS module in the network can reduce the amount and complexity of data calculation, and also includes a convolutional attention module between the backbone network and the head network to reduce interference, thereby improving the recognition effect and the accuracy of the trained improved YOLOv7 model.

[0099] In combination with the first aspect, before step S210, the method further includes:

[0100] S201, build the YOLOv7 initial model, the YOLOv7 initial model includes the input end, the backbone network and the head network.

[0101] S202, use the ShuffleNetV2 network to replace the backbone network.

[0102] S203, using the ELAN-P structure including the PConv module to replace the ELAN structure in the head network.

[0103] S204, adding a convolutional attention module between the backbone network and the head network to obtain an improved YOLOv7 model.

[0104] Before actually using the initial improved YOLOv7 model, it is necessary to build the YOLOv7 initial model. Afterwards, since most of the current target detection models have high network complexity and large amount of calculation, they are not suitable for mobile networks and are difficult to achieve real-time performance. Therefore, the ShuffleNetV2 network is used to update the backbone network, and the ELAN-P structure containing the PConv module (combined with Figure 7 As shown) replaces the ELAN structure in the head network (combined with Figure 6 As shown in the figure), the amount of network parameters and the amount of calculation in the YOLOv7 model in the prior art are reduced to build a lighter initial improved YOLOv7 model.

[0105] Among them, the ShuffleNetV2 network consists of the ShuffleNet basic module (combined with Figure 4 As shown) and ShuffleNet downsampling module repeated stacking (combined Figure 5 As shown), the ShuffleNetV2 network uses Figure 3 The grouped convolution and channel shuffling operations shown in can reduce the number of model parameters and the amount of computation. In traditional convolution operations, the input and output channels are fully connected, while in Figure 4 In the grouped convolution shown, the input and output channels are divided into multiple groups (such as Figure 3 In group1, group2, group3), each group performs independent convolution operations and then merges the results.

[0106] Combination Figure 4 As shown in the figure, after the group convolution, the output channel is divided into two parts, and then the channels of the two parts are arranged alternately, so that the channel information between different groups can communicate and mix, increasing the nonlinearity and representation ability of the model. This makes the ShuffleNetV2 network have a smaller model size and lower computational complexity while maintaining high performance.

[0107] Therefore, combined with Fig.13 As shown in the structural diagram of the improved YOLOv7 model, step S202 replaces the more complex YOLOv7 default backbone network Darknet53 with a lighter ShuffleNetV2 network, making the model more suitable for mobile networks.

[0108] In combination with the first aspect, before S202, the method further includes:

[0109] Add a Max Pool module between the input and the backbone network (combined with Fig.13 conv maxpool in .

[0110] After inputting the training data (image data), the MaxPool module is first used for maximum pooling to achieve downsampling, and then the obtained feature map is input into the network structure composed of the ShuffleNetV2 basic module to extract the semantic information of different levels of the target image. Subsequently, the feature extraction channel is expanded through a 1×1 convolutional layer to further enhance the ability to extract target features. Finally, the global pooling layer fully integrates the spatial information to prevent the model from overfitting, and the fully connected layers (FC) are used for target classification.

[0111] In addition, the PConv module exploits the redundant information in the feature map and applies regular convolution (Conv) to only a subset of the input channels without affecting the rest. This design makes the PConv module computational complexity (FLOPs) lower than that of the regular Conv module. Specifically, the PConv module converts the first or last consecutive c p The channel is considered as a representative of the entire feature map, thus achieving continuous or regular memory access.

[0112] Therefore, the FLOPS of the PConv module is: Among them, h is the width, w is the height, k is the convolution kernel, and c is the channel.

[0113] By using a typical partial ratio r = 1 / 4, the floating point operations of the PConv module are 1 / 16 of those of the conventional Conv module, i.e.

[0114] The PConv module effectively improves computational efficiency and reduces unnecessary computational overhead by performing convolution operations only on valid data points. Therefore, the PConv module can significantly reduce computational requirements without sacrificing accuracy, which is crucial for model performance and efficiency in practical applications.

[0115] Based on this, step S203 uses the ELAN-P structure (such as Figure 7 As shown in the figure, the ELAN structure in the head network is replaced to reduce the network parameters and calculation amount in the YOLOv7 model in the prior art, so as to build a lighter initial improved YOLOv7 model. Figure 8 As shown, the head network also includes a SPPCSPC module (such as Figure 8 As shown), MP_AC module and MP-2 module (as shown Fig. 9 In the present application, a PBS module including a PConv module replaces several CBS modules in the original ELAN module to obtain an ELAN-P module including multiple PBSs, which is beneficial to the reduction of network parameters and calculation amount.

[0116] In addition, because the background of pipeline leakage images is relatively cluttered, the detection accuracy of the YOLOv7 model in the prior art is low. Therefore, step S240 adds a convolutional attention module between the updated backbone network and the head network, and its structure diagram is shown in the figure below. Fig.10 As shown, the feature extraction capability of pipeline leakage is further optimized, and useless information is suppressed. The concept of position information is introduced into the traditional channel attention mechanism to better capture cross-channel information, direction perception and spatial position perception, thereby improving the model's positioning and recognition accuracy of the target area, effectively capturing the correlation between different channels, and better distinguishing target objects from background interference, thereby ensuring lightweight while improving detection accuracy.

[0117] Specifically, the convolutional attention module uses a two-dimensional global pooling method to avoid compressing the global spatial information into the spatial descriptor and losing the position information. Specifically, it can be considered to be divided into two parallel stages, performing one-dimensional global pooling operations on the input feature map in the vertical direction and the horizontal direction respectively, and obtaining two direction-aware feature maps, such as Fig.11 , Fig.12 As shown, specifically, given the input, one-dimensional global pooling is performed on the channel along the horizontal and vertical directions to obtain feature maps in two directions, so the channel output can be expressed as:

[0118]

[0119] The generated feature map is transformed accordingly to make full use of the captured position information to more accurately highlight the area of ​​interest. h and z w After concat, the feature map is generated, and then the F1 operation and activation operation are performed to obtain: f = δ (F1 ([z h ,z w ]), where [,] represents z h and z w is the concatenation operation along the spatial dimension, and δ represents the non-linear activation function.

[0120] First, split f along the spatial dimension into f h ∈R C / r×H and f w ∈R C / r×W Two independent tensors, then apply 1×1 convolution F to these two tensors respectively h and F w Operation, so that its number of channels is transformed to the same as the input x, and then the transformed tensor is processed with the nonlinear activation function sigmoid to obtain:

[0121] g h =σ(F h (fh ));

[0122] g w =σ(F w (f w )).

[0123] Finally, the output formula of the convolutional attention module can be written as:

[0124]

[0125] In this embodiment, the convolutional attention module not only focuses on re-weighing the importance of different channels, but also considers the encoding of spatial information. The horizontal and vertical attention are applied to the input tensor at the same time, which can more accurately locate the exact position of the object of interest, where each element in the two attention maps reflects whether the object of interest exists in the corresponding row and column, thereby helping the entire model to better identify and locate the target.

[0126] The initial improved YOLOv7 model structure obtained based on steps S202-S204 is as follows Fig. 9 shown.

[0127] In combination with the first aspect, step S250 includes:

[0128] S252, using the training set to train the Max Pool module and the ShuffleNetV2 network to generate feature data.

[0129] S252, using the feature data to train the convolutional attention module to output target feature data.

[0130] S252, using the target feature data to train the head network including the PConv module to output the detection prediction result.

[0131] The training set is used to train the Max Pool module, the backbone network composed of the ShuffleNetV2 network, and the head network of the convolutional attention module including the Pconv module, so as to reduce the computing requirements while ensuring the detection accuracy, thereby improving the model performance and efficiency.

[0132] In combination with the first aspect, step S230 includes:

[0133] S231, using a Labeling tool to select the pipeline leakage position in the image data.

[0134] S232, performing image enhancement processing on the framed area and marking it.

[0135] S233, storing the annotated image data in a set file format.

[0136] In the second aspect, the present application provides a pipeline leakage detection method based on an improved YOLOv7 model, combined with Fig.14 As shown, the device includes: an acquisition module 10, a processing module 20 and a detection module 30.

[0137] The acquisition module 10 is used to acquire an initial image of the surface of the leaking pipeline.

[0138] The processing module 20 is used to perform image sharpening processing based on the ESRGAN strategy to obtain a current image.

[0139] The detection module 30 is used to input the current image into the pre-trained improved YOLOv7 model. The ShuffleNet network and convolutional attention module in the backbone network extract features of the input current image and perform feature fusion, and then transmit the features to the head network including the Pconv module to output the detection results.

[0140] In a third aspect, the present application provides an electronic device, Fig.15 As shown, the electronic device includes a memory 131 and a processor 130. The memory 131 is used to store computer programs, and the processor 130 runs the computer programs to enable the electronic device to perform the above method.

[0141] Furthermore, combined with Fig.15 The electronic device shown further includes a bus 132 and a communication interface 133 , and the processor 130 , the communication interface 133 and the memory 131 are connected via the bus 132 .

[0142] The memory 131 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 132 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.14 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0143] The processor 130 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 130. The above processor 130 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the above embodiment in combination with its hardware.

[0144] In a fourth aspect, an embodiment of the present application provides a readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the above method is executed.

[0145] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0146] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0147] If the function is implemented in the form of 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, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0148] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0149] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A pipeline leakage detection method based on an improved YOLOv7 model, characterized in that: The method comprises: Acquire an initial image of the surface of the leaking pipeline; The image is sharpened based on the ESRGAN strategy to obtain a current image; The current image is input into the pre-trained improved YOLOv7 model, and the ShuffleNet network and convolutional attention module in the backbone network extract features of the input current image and perform feature fusion, and then transmit the features to the head network including the Pconv module to output the detection result.

2. The method according to claim 1, characterized in that The steps to obtain an initial image of the leaking pipeline surface include: Collect video images of the leaking pipeline surface; According to a preset video frame capture rule, the video image is captured to obtain a plurality of initial images.

3. The method according to claim 1, characterized in that The training process of the improved YOLOv7 model is as follows: Acquire an initial training data set, wherein the initial training data set includes a plurality of initial training picture data; Based on the ESRGAN strategy, all the initial training image data are processed for clarity to obtain a first training data set; For each image data in the first training data set, annotate the image data, add leakage position annotation, and obtain a pre-training data set; Constructing a data set, dividing the pre-training data set into a training set and a validation set; The initial improved YOLOv7 model is trained using the training set and verified using the verification set to obtain a trained YOLOv7 model that meets preset requirements.

4. The method according to claim 3, characterized in that Before the step of obtaining an initial training data set, wherein the initial training data set includes a plurality of initial training picture data, the step further includes: Building a YOLOv7 initial model, wherein the YOLOv7 initial model includes an input end, a backbone network, and a head network; Use the ShuffleNetV2 network to replace the backbone network; The ELAN structure in the head network is replaced by the ELAN-P structure containing the PConv module; A convolutional attention module is added between the backbone network and the head network to obtain an improved YOLOv7 model.

5. The method according to claim 3, characterized in that: Before the step of replacing the backbone network with the ShuffleNetV2 network, the method further includes: A Max Pool module is added between the input end and the backbone network.

6. The method according to claim 5, characterized in that The step of training the initial improved YOLOv7 model using the training set comprises: Using the training set to train the Max Pool module and the ShuffleNetV2 network to generate feature data; Using the feature data to train the convolutional attention module to generate target feature data; The head network including the PConv module is trained using target feature data to output detection prediction results.

7. The method according to claim 6, characterized in that For each image data in the first training data set, the step of annotating the image data, adding a defect type label and annotating the defect position to obtain the training data set includes: Using a Labeling tool to select the pipeline leakage position in the image data; Enhance the image of the selected area and mark it; The annotated image data is stored in a set file format.

8. A pipeline leakage detection device based on an improved YOLOv7 model, characterized in that: The device comprises: An acquisition module, used for acquiring an initial image of the surface of the leaking pipeline; A processing module, used for performing a clearing process on the image based on the ESRGAN strategy to obtain a current image; The detection module is used to input the current image into the pre-trained improved YOLOv7 model. The ShuffleNet network and the convolutional attention module in the backbone network extract the features of the input current image and perform feature fusion, and then transmit the features to the head network including the Pconv module to output the detection result.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the method according to any one of claims 1 to 7 is executed.

Citation Information

Cited By

  • Tunnel disease image deblurring method and device and medium

    CN119494945A

  • A tunnel disease image deblurring method, device and medium

    CN119494945B