Petroleum pipeline leakage detection method based on improved YOLOv7

By improving the YOLOv7 neural network, combined with the Kind++ image enhancement module, SimAM attention mechanism and SPD convolution block, the existing problems of low efficiency and high cost of oil pipeline leak detection are solved, achieving high-precision, high-real-time leak detection and reducing environmental pollution and inspection costs.

CN118608448APending Publication Date: 2024-09-06CHINA PETROLEUM & CHEMICAL CORP +1
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202410435146.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-11
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing oil pipeline leakage detection methods are inefficient, susceptible to environmental noise, temperature and climate conditions, and costly. It is difficult to detect leaks in the first place, affecting oil and gas transportation and environmental safety.

Method used

Based on the improved YOLOv7 neural network, a high-precision oil pipeline leakage detection sample set is constructed by collecting and preprocessing oil pipeline leakage images and videos, and introducing the Kind++ image enhancement module, SimAM attention mechanism and SPD convolution block to improve the detection resistance. Interference and accuracy.

Benefits of technology

It achieves high-precision, high-real-time detection of oil pipeline leaks, reduces environmental pollution and inspection costs caused by crude oil leaks, and improves detection accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608448A
    Figure CN118608448A
Patent Text Reader

Abstract

The invention relates to a petroleum pipeline leakage detection method based on improved YOLOv7, and the method sequentially comprises the following steps: S1, collecting a petroleum pipeline leakage image and video, and constructing a petroleum pipeline leakage image sample set after preprocessing; s2, performing improvement based on an existing YOLOv7 neural network to form an improved YOLOv7 neural network for petroleum pipeline leakage detection; s3, inputting the petroleum pipeline leakage image sample set constructed in the step S1 into the improved YOLOv7 neural network in the step S2 for training; and S4, applying the trained model to leakage detection of the petroleum pipeline. According to the petroleum pipeline leakage detection method based on the improved YOLOv7, the requirements for high precision and high real-time performance of petroleum pipeline leakage detection can be met, environmental pollution caused by crude oil leakage can be greatly reduced, and the labor cost of routing inspection can also be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to oil pipeline leakage detection, in particular to an oil pipeline leakage detection method based on improved YOLOv7, and belongs to the technical field of intelligent fault detection in oil fields. Background Art

[0002] Pipeline transportation is currently the main means of oil and gas transportation. Compared with road transportation, railway transportation, water transportation, and air transportation, pipeline transportation has low costs, less loss, less permanent land occupation, fast construction speed, large oil and gas transportation volume, and high safety performance. Since the reform and opening up, my country's oil and gas pipelines span the east and west, run north and south, cover the whole country, and connect overseas. The total mileage has exceeded 130,000 kilometers, playing an important role in ensuring my country's energy security. However, due to the increasing service life of pipelines, pipeline aging, corrosion, cathodic protection failure, geological disasters and third-party damage, pipeline leakage accidents occur from time to time, which not only affects the normal transportation of oil and gas, but also poses a serious threat to people's lives and property safety and the ecological environment. Therefore, it is crucial to find pipeline leaks as soon as possible and take timely measures to minimize losses and impacts.

[0003] Initially, experienced field operators were used to conduct inspections along the line. This method was affected by factors such as the status of the inspectors, the length of the pipeline, and the laying environment. It was inefficient and difficult to issue early warnings in the first place. Since the 1960s, with the development of science and technology, detection methods based on acoustics, distributed fiber optic sensing, radar, and thermal infrared imaging have been proposed. However, acoustic detection methods are susceptible to interference from environmental noise, such as surrounding natural sounds or other industrial noise, which may lead to false alarms or missed alarms. Distributed optical fiber requires excavation on site, which requires a large amount of engineering and needs to be buried at a certain depth to ensure operational safety. The installation and maintenance costs are relatively high. The radar method can be used in complex terrain environments, but it is not suitable for pipelines with smaller diameters and is prone to distortion in clay environments; thermal infrared imaging is affected by ambient temperature and climatic conditions, and may fail to detect low-temperature leaks or leaks with unclear temperature changes in some cases. Thermal infrared imaging equipment is relatively expensive and requires professional personnel to operate and analyze data.

[0004] Nowadays, computer vision and deep learning technologies are developing rapidly and are gradually shining in various industries such as construction, medical care, and electricity. YOLOv7 is a single-stage detection algorithm with excellent performance among the current deep learning target detection algorithms. It has the characteristics of fast speed, high accuracy, small size, and easy deployment. Summary of the invention

[0005] The purpose of the present invention is to overcome the problems existing in the prior art and provide an oil pipeline leakage detection method based on improved YOLOv7 to meet the high precision and high real-time requirements of oil pipeline leakage detection, which can not only significantly reduce the environmental pollution caused by crude oil leakage, but also reduce the labor cost of inspection.

[0006] In order to solve the above technical problems, a petroleum pipeline leakage detection method based on improved YOLOv7 of the present invention comprises the following steps in sequence:

[0007] S1, collect images and videos of oil pipeline leakage, and construct an oil pipeline leakage image sample set after preprocessing;

[0008] S2, based on the existing YOLOv7 neural network, an improved YOLOv7 neural network for oil pipeline leakage detection is formed;

[0009] S3, inputs the oil pipeline leakage image sample set constructed by S1 into the improved YOLOv7 neural network of S2 for training;

[0010] S4. Use the trained model for leak detection in oil pipelines.

[0011] Furthermore, in step S1, images and videos of oil pipeline leakage are collected by video surveillance along the pipeline and manual field photography, and oil leakage is simulated by laying a black cloth stained with oil on the pipeline to expand the data sample size.

[0012] Furthermore, in step S1, key frames are extracted from the multiple videos collected, and key frames in which the mean square error in the video is greater than a set threshold are retained; the retained key frames and the collected images are preprocessed, and the image preprocessing methods include but are not limited to rotation, adding noise and / or changing the image brightness, so as to improve the anti-interference and richness of the oil pipeline leakage detection sample set.

[0013] Furthermore, in step S1, during the noise adding process, the noise adding area must overlap with the label area to ensure that the noise simulates the effect of blocking the pipeline leakage. The left vertex coordinate of the label area is (x p ,y p ), the width and height are w and h respectively, and the left vertex coordinate of the generated noise area is (x n ,y n ), the area is s n , the specific restrictions are:

[0014]

[0015] Furthermore, in step S1, labelimg software is used to label all preprocessed images, and the locations where oil leaks occur in the images are labeled "oil", so as to construct a sample set of oil pipeline leakage images.

[0016] Furthermore, in step S2, the existing YOLOv7 neural network includes: 1-50 layers of backbone feature extraction network Backbone, 51-101 layers of feature fusion network Neck and 102-105 layers of detection head Head,

[0017] The backbone part consists of CBS module, MP module and ELAN module. The convolution kernel size of the first and third CBS modules is 3×3 and the step size is 1; the convolution kernel size of the second and fourth CBS modules is 3×3 and the step size is 2; the output of the ELAN module is the sum of three intermediate features;

[0018] The Neck part includes CBS module, MP module, ELAN module, SPPCSPC module, Concat module, and up sampling module; among them, the convolution kernel size of the CBS module is 1×1 and the step size is 1; the output of the ELAN module is the addition of 5 intermediate features;

[0019] The Head part consists of a Rep module and a Conv module, where the convolution kernel size of the Rep module is 3×3 and the step size is 1; the convolution kernel size of the Conv module is 1×1 and the step size is 1.

[0020] Furthermore, before the Backone part of the YOLOv7 neural network, a Kind++ image enhancement module is constructed to decompose the image into reflection component and illumination component for noise pollution removal and brightness enhancement respectively. The layer decomposition formula is:

[0021] Among them, L is the illumination component, R is the reflection component, and E is the pollution component. is the contaminated reflection component, Pollution components after decoupling for lighting.

[0022] Furthermore, the Kind++ image enhancement module has three parts: layer decomposition, reflection restoration, and illumination adjustment, including a CBR module, a Maxpooling module, a Deconv module, a Conv module, a Sigmoid module, a Concat module, and a multi-scale illumination attention MISA module.

[0023] Furthermore, the multi-scale illumination attention MISA module in the Kind++ image enhancement module performs weighted fusion of input features of four different scales with illumination restoration features, and the weight coefficient is ω m, the weights pay more attention to the areas with more serious image degradation, extract richer features to restore the color and details of the areas with more serious image degradation, and improve the clarity of the image in dim scenes.

[0024] Furthermore, a SimAM attention mechanism module is added after the 77th layer of the YOLOv7 neural network to combine channel and spatial information, infer three-dimensional attention weights for the image features in this layer, and improve the network's attention to important image features.

[0025] Furthermore, the solution expression of the three-dimensional attention weight is: Among them, e t is the energy function, is the linear transformation of the target neuron t, For other neurons x i The linear transformation of i is the index of the neuron in any channel of the current input feature map, M is the number of neurons in the current channel, and w t and b t are weights and biases, y0 and y t They are all set constants. Due to the weight sharing characteristics of convolutional neural networks, the feature maps of each channel have the same weights and biases. The image features are extracted by the backbone part of the YOLOv7 neural network from the input image.

[0026] Furthermore, an SPD convolutional block is constructed after the 101th layer of the YOLOv7 neural network. The SPD convolutional block consists of a spatial-to-depth layer and a non-strided convolutional layer;

[0027] Assuming that the size of feature map X is S×S×C1, scale is the set scale factor, representing the sub-feature map divided proportionally, the SPD layer slices the feature map sequence into:

[0028]

[0029] These sub-feature maps are concatenated along the channel dimension to obtain a size of The non-strided convolutional layer downsamples the feature map X′ through a convolution with a stride of 1 to obtain the feature map X″; the SPD convolutional block downsamples the feature map while retaining all the information in the channel, reducing the loss of fine-grained information caused by the strided convolution and pooling layers in the YOLOv7 neural network, and improving the network’s detection effect on low-resolution targets and small targets.

[0030] Furthermore, in step S3, the weights trained with the COCO dataset containing more than 500,000 object annotations are set as the initial weights for training the improved YOLOv7 neural network, the simulated annealing algorithm is used to dynamically adjust the learning rate during model training, and K-fold cross validation is used to determine the optimal model parameters to alleviate overfitting.

[0031] Furthermore, in step S3, the learning rate calculation formula in model training is:

[0032]

[0033] In the formula, k represents the number of restarts, and are the maximum and minimum values ​​of the learning rate, T cur is the current training round, T k Represents the total number of training rounds.

[0034] Furthermore, in step S4, the trained model is connected to a surveillance camera to obtain video image input and perform real-time monitoring of oil pipeline leakage.

[0035] Further, in step S4, when the brightness of the video image input by the camera is lower than the set value I min When , the Kind++ image enhancement module of the network is turned on to enhance the image and improve the clarity of the input image.

[0036] Furthermore, in step S4, the confidence score threshold of the detection target is set to Score, and only the oil pipeline leakage detection targets with confidence scores above Score are displayed to remind the monitoring management personnel.

[0037] Compared with the prior art, the present invention has achieved the following beneficial effects: 1. A sample set of oil pipeline leakage images is constructed, and key frames are extracted from multiple videos. Only key frames whose mean square error in the video is greater than a set threshold are retained, and most redundant images are removed, thereby improving the subsequent network training efficiency and saving training resources;

[0038] 2. Constructed the Kind++ image enhancement module to improve the clarity of input images in dim scenes, thereby improving the accuracy of detection;

[0039] 3. Using the SimAM attention mechanism module, the channel and spatial information are combined without increasing the network parameters, which increases the network's attention to important features and improves the feature fusion quality of the network;

[0040] 4. Use SPD convolution blocks to reduce the loss of fine-grained information caused by strided convolution and pooling layers in the network, and improve the network's detection effect on low-resolution and small targets;

[0041] 5. It can not only significantly reduce the environmental pollution caused by crude oil leakage, but also reduce the labor cost of inspection. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. The accompanying drawings are only provided for reference and explanation and are not intended to limit the present invention.

[0043] Figure 1 It is a flow chart of the oil pipeline leakage detection method based on improved YOLOv7 of the present invention;

[0044] Figure 2 This is a key frame extraction flow chart of the present invention;

[0045] Figure 3 It is a schematic diagram of the present invention in improving the YOLOv7 neural network structure;

[0046] Figure 4 Schematic diagram of the kind++ image enhancement module in the present invention;

[0047] Figure 5 It is a schematic diagram of the SimAM attention mechanism in the present invention;

[0048] Figure 6 This is an example diagram of the detection results of the present invention. DETAILED DESCRIPTION

[0049] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further described below with reference to specific diagrams.

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0051] In combination with the high-precision and high-real-time requirements of oil pipeline leakage detection, this paper designs a pipeline oil leakage detection algorithm based on YOLOv7, introduces the Kind++ image enhancement module, decouples the input image into illumination component and reflection component, and performs illumination adjustment and noise removal respectively. The multi-scale illumination attention submodule is used to guide the network to pay more attention to the areas with more serious image degradation, thereby extracting richer features to restore the color and details of these areas and improve the image clarity in dim scenes; the SimAM attention mechanism module is introduced to infer the features Figure 3The dimensional attention weight makes the model pay more attention to the feature information of the deep space and channels of the oil pipeline leakage image, improving the quality of feature fusion; the SPD convolution structure is constructed to downsample the feature map while retaining the feature information in the channel, reducing the loss of fine-grained information caused by the strided convolution and pooling layers, and improving the network's detection effect on low-resolution targets and small targets.

[0052] like Figure 1 As shown, the oil pipeline leakage detection method based on the improved YOLOv7 of the present invention comprises the following steps in sequence:

[0053] S1, collect images and videos of oil pipeline leakage, and construct an oil pipeline leakage image sample set after preprocessing;

[0054] S2, based on the existing YOLOv7 neural network, an improved YOLOv7 neural network for oil pipeline leakage detection is formed;

[0055] S3, inputs the oil pipeline leakage image sample set constructed by S1 into the improved YOLOv7 neural network of S2 for training;

[0056] S4. Use the trained model for leak detection in oil pipelines.

[0057] In step S1, images and videos of oil pipeline leakage are collected by video surveillance along the pipeline and manual field photography, and oil leakage is simulated by laying a black cloth stained with oil on the pipeline to expand the data sample size.

[0058] The key frames are extracted from multiple videos. The key frame extraction flow chart is as follows: Figure 2 As shown in the figure, the key frames in the video whose mean square error is greater than the set threshold of 600 are retained; the retained key frames and the collected images are enhanced by rotating, adding noise, changing the image brightness, etc., to improve the anti-interference and richness of the oil pipeline leakage detection sample set.

[0059] During the noise addition process, the noise-adding area must overlap with the label area to ensure that the noise simulates the effect of blocking the pipeline leakage. The left vertex coordinate of the label area is (x p ,y p ), the width and height are w and h respectively, and the left vertex coordinate of the generated noise area is (x n ,y n ), the area is s n , the specific restrictions are:

[0060]

[0061] All images were annotated using labelimg software, and the areas where oil leaks occurred in the images were labeled "oil", constructing a sample set of 2,000 oil pipeline leak images.

[0062] In step S2, the existing YOLOv7 neural network includes: 1-50 layers of backbone feature extraction network Backbone, 51-101 layers of feature fusion network Neck and 102-105 layers of detection head Head;

[0063] The backbone part consists of CBS module, MP module and ELAN module. The convolution kernel size of the first and third CBS modules is 3×3 and the step size is 1; the convolution kernel size of the second and fourth CBS modules is 3×3 and the step size is 2; the output of the ELAN module is the sum of three intermediate features;

[0064] The Neck part includes CBS module, MP module, ELAN module, SPPCSPC module, Concat module, and up sampling module; among them, the convolution kernel size of the CBS module is 1×1 and the step size is 1; the output of the ELAN module is the addition of 5 intermediate features;

[0065] The Head part consists of a Rep module and a Conv module, where the convolution kernel size of the Rep module is 3×3 and the step size is 1; the convolution kernel size of the Conv module is 1×1 and the step size is 1.

[0066] Based on the existing YOLOv7 neural network, an improved YOLOv7 neural network for oil pipeline leakage detection is formed. Figure 3 As shown in the figure, first, before the Backone part of the network, the Kind++ image enhancement module is constructed. The Kind++ image enhancement module has three parts: layer decomposition, reflection restoration, and illumination adjustment, including CBR module, Maxpooling module, Deconv module, Conv module, Sigmoid module, Concat module, and multi-scale illumination attention MISA module.

[0067] like Figure 4 As shown, the image is decomposed into reflection component and illumination component for noise pollution removal and brightness enhancement respectively. The layer decomposition formula is:

[0068] Among them, L is the illumination component, R is the reflection component, and E is the pollution component. is the contaminated reflection component, The pollution components after image decomposition. At the same time, the multi-scale illumination attention MISA in the Kind++ image enhancement module weightedly fuses the input features of four different scales with the illumination restoration features, and the weight coefficient is ω m, which can be used to guide the network to pay more attention to the areas with more serious image degradation, so as to extract richer features to restore the colors and details of these areas, and improve the clarity of the image in dim scenes.

[0069] Secondly, if Figure 5 As shown in the figure, the SimAM attention mechanism module is added after the first MP module (77th layer) of the Neck part of the YOLOv7 neural network to combine channel and spatial information, infer three-dimensional attention weights for the image features in this layer, and improve the network's attention to important image features. The solution expression of the weight is:

[0070]

[0071] In the formula, e t is the energy function, and are the target neuron t and other neurons x respectively i The linear transformation of i is the index of the neuron in any channel of the current input feature map, M is the number of neurons in the current channel, and w t and b t are weights and biases, y0 and y t Set to -1 and 1. Due to the weight sharing characteristics of the convolutional neural network, the feature map of each channel has the same weight and bias, and the image features are extracted by the backbone part of the YOLOv7 neural network from the input image.

[0072] Then, the SPD convolution block is constructed after the second MP module (101th layer) of the Neck part of the YOLOv7 neural network. The SPD convolution block consists of a space-to-depth layer and a non-strided convolution layer. Assuming that the feature map X size is S×S×C1, scale is the set scale factor, representing the feature map divided proportionally, the SPD layer slices the sub-feature map sequence into:

[0073]

[0074] These sub-feature maps are concatenated along the channel dimension to obtain a size of The non-strided convolutional layer downsamples the feature map X′ through a convolution with a stride of 1 to obtain a feature map X″; the SPD convolutional block downsamples the feature map while retaining all information in the channel, reducing the loss of fine-grained information caused by the strided convolution and pooling layers in the YOLOv7 neural network, and improving the network’s detection effect on low-resolution and small targets in dim scenes.

[0075] In step S3, the oil pipeline leakage image sample set constructed in step S1 is used to train the improved YOLOv7 neural network in step S2. First, the weights trained with the COCO dataset containing more than 500,000 target annotations are set as the initial weights for the improved YOLOv7 neural network training, and the simulated annealing algorithm is used to dynamically adjust the learning rate during model training. The learning rate calculation formula is:

[0076]

[0077] In the formula, k represents the number of restarts, and are the maximum and minimum values ​​of the learning rate, T cur is the current training round, T k Represents the total number of training rounds. A 10-fold cross validation is used to determine the optimal model parameters to alleviate overfitting.

[0078] In step S4, the model trained in step S3 is connected to the surveillance camera to obtain video image input and conduct real-time monitoring of oil pipeline leakage. When the brightness of the video image input by the camera is lower than the set value of 0.1lux, the Kind++ image enhancement module of the network is turned on to enhance the image and improve the clarity of the input image; the confidence score threshold of the detection target is set to 0.5, that is, only the oil pipeline leakage detection targets with a confidence score of 0.5 or above are displayed to remind the monitoring management personnel.

[0079] Examples of test results are Figure 6 As shown by Figure 6 (a) It can be seen that when the pipeline is blocked by weeds, the proposed method can accurately detect multiple leaks; Figure 6 (b) It can be seen that when the pipeline is far away and the lighting conditions are poor due to being blocked by trees, the proposed method can accurately detect oil leaks. The final improved algorithm has an accuracy improvement of 5% compared to the original YOLOv7 algorithm.

[0080] This detection method is applied to Jiangsu Oilfield Xu 5, Zhen 20, Zhen 67, Cao 50, Yong 25-4, Yong 7-8, Fu 5-3, Fu 145, Zhou 41-8, Zhou 41-8, Chen 2 Ping 2, Chen 2-14, Sha 19-35 and other gathering and transportation pipelines. The field test application has achieved good results. The detection image of the crude oil leakage target is output to achieve a crude oil leakage detection rate of 100%, and the recognition area accuracy is greater than 85%.

[0081] The above is only a preferred embodiment of the present invention, which shows and describes the basic principles and main features of the present invention and the advantages of the present invention, but does not limit the scope of patent protection of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. In addition to the above embodiments, the present invention may have other implementation modes without departing from the spirit and scope of the present invention. The present invention may also have various changes and improvements, and all technical solutions formed by equivalent substitution or equivalent transformation fall within the scope of protection required by the present invention. The scope of protection required by the present invention is defined by the attached claims and their equivalents. The technical features not described in the present invention can be realized by or using existing technologies, which will not be repeated here.

Claims

1. A method for detecting oil pipeline leakage based on improved YOLOv7, characterized in that: The steps are as follows: S1, collect images and videos of oil pipeline leakage, and construct an oil pipeline leakage image sample set after preprocessing; S2, based on the existing YOLOv7 neural network, an improved YOLOv7 neural network for oil pipeline leakage detection is formed; S3, inputs the oil pipeline leakage image sample set constructed by S1 into the improved YOLOv7 neural network of S2 for training; S4. Use the trained model for leak detection in oil pipelines.

2. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 1 is characterized in that: In step S1, images and videos of oil pipeline leakage are collected by video surveillance along the pipeline and manual field photography, and oil leakage is simulated by laying a black cloth stained with oil on the pipeline to expand the data sample size.

3. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 2 is characterized in that: In step S1, key frames are extracted from the multiple videos collected, and key frames in which the mean square error in the video is greater than a set threshold are retained; the retained key frames and the collected images are subjected to image preprocessing, and the image preprocessing methods include but are not limited to rotation, adding noise and / or changing the image brightness, so as to improve the anti-interference and richness of the oil pipeline leakage detection sample set.

4. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 3 is characterized in that: In step S1, during the noise adding process, the noise adding area must overlap with the label area to ensure that the noise simulates the effect of blocking the pipeline leakage. The left vertex coordinate of the label area is (x p ,y p ), the width and height are w and h respectively, and the left vertex coordinate of the generated noise area is (x n ,y n ), the area is s n , the specific restrictions are: 。 5. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 3 is characterized in that: In step S1, labelimg software is used to label all preprocessed images, and the locations where oil leaks occur in the images are labeled "oil" to construct a sample set of oil pipeline leakage images.

6. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 2 is characterized in that: In step S2, the existing YOLOv7 neural network includes: 1-50 layers of backbone feature extraction network Backbone, 51-101 layers of feature fusion network Neck and 102-105 layers of detection head Head. The backbone part consists of CBS module, MP module and ELAN module. The convolution kernel size of the first and third CBS modules is 3×3 and the step size is 1; the convolution kernel size of the second and fourth CBS modules is 3×3 and the step size is 2; the output of the ELAN module is the sum of three intermediate features; The Neck part includes CBS module, MP module, ELAN module, SPPCSPC module, Concat module, and up sampling module; among them, the convolution kernel size of the CBS module is 1×1 and the step size is 1; the output of the ELAN module is the addition of 5 intermediate features; The Head part consists of a Rep module and a Conv module, where the convolution kernel size of the Rep module is 3×3 and the step size is 1; the convolution kernel size of the Conv module is 1×1 and the step size is 1.

7. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 2 is characterized in that: Before the Backone part of the YOLOv7 neural network, the Kind++ image enhancement module is built to decompose the image into reflection component and illumination component for noise pollution removal and brightness enhancement respectively. The layer decomposition formula is: Among them, L is the illumination component, R is the reflection component, and E is the pollution component. is the contaminated reflection component, Pollution components after decoupling for lighting.

8. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 7 is characterized in that: The Kind++ image enhancement module has three parts: layer decomposition, reflection restoration, and illumination adjustment, including a CBR module, a Maxpooling module, a Deconv module, a Conv module, a Sigmoid module, a Concat module, and a multi-scale illumination attention MISA module.

9. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 8 is characterized in that: The multi-scale illumination attention MISA module in the Kind++ image enhancement module performs weighted fusion of input features of four different scales with illumination restoration features, and the weight coefficient is ω m , the weights pay more attention to the areas with more serious image degradation, extract richer features to restore the color and details of the areas with more serious image degradation, and improve the clarity of the image in dim scenes.

10. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 6 is characterized in that: The SimAM attention mechanism module is added after the 77th layer of the YOLOv7 neural network to combine channel and spatial information, infer three-dimensional attention weights for the image features in this layer, and improve the network's attention to important image features.

11. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 10, characterized in that: The solution expression of the three-dimensional attention weight is: Among them, e t is the energy function, is the linear transformation of the target neuron t, For other neurons x i The linear transformation of i is the index of the neuron in any channel of the current input feature map, M is the number of neurons in the current channel, and w t and b t are weights and biases, y0 and y t They are all set constants. Due to the weight sharing characteristics of convolutional neural networks, the feature maps of each channel have the same weights and biases. The image features are extracted by the backbone part of the YOLOv7 neural network from the input image.

12. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 6, characterized in that: The SPD convolution block is constructed after the 101th layer of the YOLOv7 neural network. The SPD convolution block consists of a spatial-to-depth layer and a non-strided convolution layer. Assuming that the size of feature map X is S×S×C1, scale is the set scale factor, representing the sub-feature map divided proportionally, the SPD layer slices the feature map sequence into: These sub-feature maps are concatenated along the channel dimension to obtain a size of The non-strided convolutional layer downsamples the feature map X′ through a convolution with a stride of 1 to obtain the feature map X″; the SPD convolutional block downsamples the feature map while retaining all the information in the channel, reducing the loss of fine-grained information caused by the strided convolution and pooling layers in the YOLOv7 neural network, and improving the network’s detection effect on low-resolution targets and small targets.

13. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 1, characterized in that: In step S3, the weights trained on the COCO dataset containing more than 500,000 object annotations are set as the initial weights for training the improved YOLOv7 neural network. The simulated annealing algorithm is used to dynamically adjust the learning rate during model training, and K-fold cross validation is used to determine the optimal model parameters to alleviate overfitting.

14. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 13, characterized in that: In step S3, the learning rate calculation formula in model training is: In the formula, k represents the number of restarts, and are the maximum and minimum values ​​of the learning rate, T cur is the current training round, T k Represents the total number of training rounds.

15. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 13, characterized in that: In step S4, the trained model is connected to a surveillance camera to obtain video image input and perform real-time monitoring of oil pipeline leakage.

16. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 15, characterized in that: In step S4, when the brightness of the video image input by the camera is lower than the set value I min When , the Kind++ image enhancement module of the network is turned on to enhance the image and improve the clarity of the input image.

17. The oil pipeline leakage detection method based on improved YOLOv7 according to claim 11, characterized in that: In step S4, the confidence score threshold of the detection target is set to Score, and only the oil pipeline leakage detection targets with confidence scores above Score are displayed to remind the monitoring management personnel.

Citation Information

Cited By

  • Pipeline leakage point detection method and device, storage medium and electronic equipment

    CN119359718A

  • Unmanned aerial vehicle aerial photography petroleum leakage intelligent detection method and system fused with MobileNetV4 lightweight network

    CN120388155A

  • An unmanned aerial vehicle aerial oil leakage intelligent detection method and system fusing a MobileNetV4 lightweight network

    CN120388155B

  • TDGA-YOLO-based cryogenic propellant leakage detection positioning method and device

    CN120635420A

  • Petroleum leakage detection method, detection system and detection robot based on spatial visual feature detection

    CN121305028A