A method and device for detecting defects in oil and gas pipelines based on an improved YOLOv11 algorithm

By improving the YOLOv11 algorithm and combining it with CSP_PMSFA, FPSConv and SOEP structures, the detection of defects in oil and gas pipelines is optimized, solving the problems of low efficiency and poor accuracy of traditional manual inspection, and realizing automated and accurate pipeline defect identification and location.

CN120599356BActive Publication Date: 2026-01-30BEIJING INSTITUTE OF PETROCHEMICAL TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510700118.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2026-01-30
Estimated Expiration
2045-05-28

AI Technical Summary

Technical Problem

Existing oil and gas pipeline inspection methods rely on manual analysis, which is inefficient and easily affected by human factors, making it difficult to achieve efficient and accurate defect detection. In particular, they are prone to missed detections or misjudgments in complex backgrounds and noisy images.

Method used

An improved YOLOv11 algorithm is adopted, which replaces the C3K2 part with the CSP_PMSFA module and the SPPF part with the FPSConv module. The Small Object Enhancement Pyramid structure and the CSP-OmniKernel module are introduced in the Neck part to enhance feature extraction and small object detection capabilities. The model structure is optimized by combining residual connections and shared convolution strategies.

Benefits of technology

It has enabled automated detection of defects in oil and gas pipelines, improved detection accuracy and speed, reduced missed detections and false judgments, enhanced detection efficiency and accuracy, and reduced reliance on professional personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120599356B_ABST
    Figure CN120599356B_ABST
Patent Text Reader

Abstract

This application relates to the field of detection technology, specifically to a method and apparatus for detecting defects in oil and gas pipelines based on an improved YOLOv11 algorithm. The method includes: acquiring an ultrasonic C-scan dataset of oil and gas pipeline defects; improving the YOLOv11 network structure model, specifically by replacing the C3K2 part of the YOLOv11 network structure model with a CSP_PMSFA module; replacing the SPPF part of the YOLOv11 network structure model with an FPSConv module; improving the Neck part of the YOLOv11 network structure model based on a Small Object Enhanced Pyramid structure; training the improved YOLOv11 network model to obtain an oil and gas pipeline defect detection model; testing the oil and gas pipeline defect detection model; if the model fails the test, retraining the improved YOLOv11 network model; and performing oil and gas pipeline defect detection based on the tested oil and gas pipeline defect detection model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the detection related technical field, specifically to an oil and gas pipeline defect detection method and device based on improved YOLOv11 algorithm. BACKGROUND

[0002] During long-term use, oil and gas pipelines inevitably suffer from various natural and man-made factors, resulting in various types of defects. For example, corrosion is one of the common problems of oil and gas pipelines, which can cause the thickness of the pipeline wall to thin, thereby affecting the pressure-bearing capacity of the pipeline; cracks are also potential dangerous defects of the pipeline, which can cause sudden rupture of the pipeline; in addition, mechanical damage to the pipeline may also be caused by improper construction or external impact. If these defects cannot be discovered and treated in time, it is extremely likely to cause serious safety accidents, such as oil and gas leakage, which not only causes huge economic losses, but also can cause devastating damage to the surrounding ecological environment, and even endanger the safety of life.

[0003] Due to the importance of the safe operation of oil and gas pipelines, regular detection and maintenance of the pipelines become a key measure to ensure stable energy supply and prevent accidents. Traditional manual detection methods, such as visual inspection, Manual ultrasonic testing, etc., have the disadvantages of low efficiency, being easily affected by human factors, and resulting in inaccurate detection results. SUMMARY

[0004] Therefore, the embodiments of the present application aim to provide an oil and gas pipeline defect detection method and device based on improved YOLOv11 algorithm.

[0005] The present application provides an oil and gas pipeline defect detection method based on improved YOLOv11 algorithm, comprising:

[0006] Collecting oil and gas pipeline defect ultrasonic C-scan data set, and preprocessing and labeling the data set, dividing the processed data set into training set, test set and validation set;

[0007] Improving the YOLOv11 network structure model:

[0008] The improvement of the YOLOv11 network structure model comprises:

[0009] The C3K2 part of the YOLOv11 network structure model is replaced by a CSP_PMSFA module, the CSP_PMSFA module realizes feature sharing between different stages through a CSP layer, uses PConv convolution of different sizes to extract features of different scales, and finally fuses the feature maps through a 1x1 convolution layer and introduces a residual connection;

[0010] The SPPF part of the YOLOv11 network structure model is replaced by an FPSConv module, which uses multiple dilated rate convolutions for multi-scale feature extraction and adopts shared convolution layers to reduce the calculation and storage overheads;

[0011] Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved by an SPDConv module to enhance small target features, and a CSP-OmniKernel module is introduced into the P3 detection layer, which contains local branches, large branches and global branches for extracting local features, large-scale features and global context information.

[0012] The improved YOLOv11 network model is trained using the training set to obtain an oil and gas pipeline defect detection model.

[0013] The oil and gas pipeline defect detection model is tested using the test set, and if it fails the test, the improved YOLOv11 network model is retrained.

[0014] The oil and gas pipeline defect detection model is tested using the test set, and if it fails the test, the improved YOLOv11 network model is retrained.

[0015] In some embodiments, in the CSP_PMSFA module, the PConv convolution operates on part of the channels to reduce the amount of calculation.

[0016] In some embodiments, the multiple dilated rates include 1, 3 and 5.

[0017] In some embodiments, the large branch adopts a 31x31 depth convolution kernel to find a large receptive field.

[0018] The global branch is composed of a dual-domain channel attention module and a frequency-based spatial attention module to capture global context information.

[0019] The local branch uses a 1x1 depth convolution layer for local signal modulation.

[0020] The present application provides an oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm, comprising:

[0021] The acquisition module is used for acquiring an oil and gas pipeline defect ultrasonic C-scan data set, and pre-processing and labeling the data set, and dividing the processed data set into a training set, a test set and a validation set.

[0022] The improvement module is used for improving the YOLOv11 network structure model:

[0023] The improved YOLOv11 network structure model comprises:

[0024] The C3K2 part of the YOLOv11 network structure model is replaced by a CSP_PMSFA module, the CSP_PMSFA module realizes feature sharing between different stages through a CSP layer, uses PConv convolutions of different sizes to extract features of different scales, finally fuses feature maps through a 1x1 convolution layer, and introduces a residual connection;

[0025] The SPPF part of the YOLOv11 network structure model is replaced by an FPSConv module, the FPSConv module uses convolutions of multiple dilation rates to extract multi-scale features, and adopts a shared convolution layer to reduce calculation and storage overheads;

[0026] Based on a Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved, a SPDConv module is used to enhance small target features, and a CSP-OmniKernel module is introduced into a P3 detection layer, the CSP-OmniKernel module comprises a local branch, a large branch and a global branch, and is used to extract local features, large-scale features and global context information;

[0027] A training module is configured to train the improved YOLOv11 network model using a training set to obtain an oil and gas pipeline defect detection model, test the oil and gas pipeline defect detection model using a test set, and retrain the improved YOLOv11 network model if the test fails;

[0028] A detection module is configured to detect oil and gas pipeline defects based on the oil and gas pipeline defect detection model that passes the test.

[0029] In some embodiments, in the CSP_PMSFA module, the PConv convolution operates on part of the channels to reduce the amount of calculation.

[0030] In some embodiments, the multiple dilation rates comprise 1, 3 and 5.

[0031] In some embodiments, the large branch adopts a 31x31 depth convolution kernel to find a large receptive field.

[0032] The global branch is composed of a dual-domain channel attention module and a frequency-based spatial attention module to capture global context information.

[0033] The local branch uses a 1x1 depth convolution layer to modulate local signals.

[0034] The application provides an electronic device, comprising:

[0035] a processor, and a memory for storing a program executable by the processor;

[0036] The processor is configured to implement the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm by running the program in the memory.

[0037] The application provides a computer readable storage medium, which stores a computer program, and the computer program causes the processor to execute the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm when the computer program is run by the processor.

[0038] The oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm provided by the application comprises the following steps: collecting an oil and gas pipeline defect ultrasonic C scan image data set, and preprocessing and labeling the data set; dividing the processed data set into a training set, a test set and a verification set; improving a YOLOv11 network structure model, wherein the improvement of the YOLOv11 network structure model comprises the following steps: replacing a C3K2 part of the YOLOv11 network structure model with a CSP_PMSFA module, the CSP_PMSFA module realizes feature sharing between different stages through a CSP layer, uses PConv convolutions of different sizes to extract features of different scales, finally fuses feature maps through a 1x1 convolution layer, and introduces a residual connection; replacing a SPPF part of the YOLOv11 network structure model with a FPSConv module, the FPSConv module uses convolutions of multiple expansion rates to extract multi-scale features, and adopts a shared convolution layer to reduce calculation and storage overhead; improving a Neck part of the YOLOv11 network structure model based on a Small Object EnhancePyramid structure, enhancing small target features through a SPDConv module; and introducing a CSP-OmniKernel module into a P3 detection layer, the CSP-OmniKernel module comprises a local branch, a large branch and a global branch, and is used for extracting local features, large-scale features and global context information; training the improved YOLOv11 network model using the training set to obtain an oil and gas pipeline defect detection model; and testing the oil and gas pipeline defect detection model using the test set to output a detection result. BRIEF DESCRIPTION OF DRAWINGS

[0039] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description thereof taken in conjunction with the accompanying drawings, in which: like reference numerals in the accompanying drawings refer to identical or like components throughout the views. The drawings provided in the present application are used to provide further understanding of the present application, and form a part of the specification, and are used to explain the present application together with the present application, and do not constitute a limitation on the present application. In the drawings, the same reference numerals generally refer to the same parts or steps throughout the views.

[0040] Figure 1 is a flowchart of an oil and gas pipeline defect detection method based on an improved YOLOv11 algorithm provided by an embodiment of the present application.

[0041] Figure 2 is a schematic diagram of the improved YOLOV11 algorithm structure of the present application;

[0042] Figure 3 is a schematic diagram of the CSP_PMSFA structure of the present application;

[0043] Figure 4 is a schematic diagram of the FPSConv structure of the present application;

[0044] Figure 5 is a schematic diagram of the SOEP structure of the present application;

[0045] Figure 6 is a schematic diagram of the CSP-OmniKernel structure of the present application;

[0046] Figure 7 is a schematic diagram of an oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm provided by an embodiment of the present application.

[0047] Figure 8 is a schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0049] The existing pipeline defect detection method mainly relies on manual analysis, and it is difficult to realize efficient and accurate detection, especially when facing complex background and noise images, which is easy to miss detection or misjudgment. In order to solve these problems, the improved version of YOLOv11 algorithm is introduced, combined with the characteristics of oil pipeline defects, which can automatically and accurately identify the pipeline defects in ultrasonic C scan image, realize the intelligent evaluation of pipeline state. The algorithm not only improves the accuracy and detection speed of defect positioning, but also improves the adaptability to complex images by optimizing the structure of the model, significantly reduces the artificial consumption, improves the detection efficiency and accuracy, and provides an efficient and reliable intelligent detection solution for the safety monitoring of oil pipeline.

[0050] Specifically, the C3K2 part of the YOLOv11 network structure model is replaced with a CSP_PMSFA module; the SPPF part of the YOLOv11 network structure model is replaced with a FPSConv module; based on the Small Object EnhancePyramid structure, the Neck part of the YOLOv11 network structure model is improved;

[0051] CSP_PMSFA structure: using Partial Convolution for multi-scale feature extraction to improve feature expression ability. FPSConv structure: using multi-scale dilated convolution and introducing parameter sharing strategy to reduce calculation amount. SOEP structure: using SPDConv combined with small target features to improve the detection ability of micro defects and reduce missed detection.

[0052] In this way, the present application realizes the automation of pipeline defect detection, reduces the subjective error and labor intensity in the process of manual detection. Through intelligent evaluation of pipeline state, the dependence on professional personnel is reduced, and the operation risk is reduced. Based on the improved YOLOv11 algorithm, the micro defects in the ultrasonic C scan image of the oil pipeline defect can be accurately identified, especially in complex background and noisy environment, which significantly improves the accuracy of defect detection and reduces the occurrence of missed detection and misjudgment. Through automatic defect recognition and positioning, the present application can complete the processing of a large number of ultrasonic C scan images in a shorter time, greatly improving the detection speed compared with the traditional manual detection method, and providing the possibility for real-time monitoring and early warning of the pipeline.

[0053] After introducing the basic principle of the present application, the various non-limiting embodiments of the present application will be specifically introduced with reference to the accompanying drawings.

[0054] As shown in Figure 1 , Figure 2 The oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm provided by the present application includes the following contents.

[0055] Step S110, collect oil and gas pipeline defect ultrasonic C-scan data set, and preprocess and label the data set, and divide the processed data set into training set, test set and validation set;

[0056] Specifically, step S110 includes the following contents:

[0057] Collecting oil and gas pipeline defect ultrasonic C-scan data set: a large number of ultrasonic C-scan images are obtained from actual oil and gas pipeline detection work. These images should cover different types, different positions and different degrees of pipeline defects, such as corrosion, cracks, deformation, etc., to ensure the diversity and representativeness of the data set. At the same time, record the pipeline operating conditions, detection equipment parameters and other information related to the images, so as to better understand the formation background and detection conditions of the defects.

[0058] Preprocessing the data set: the purpose of preprocessing is to improve the image quality, remove noise and interference, and make the image more suitable for subsequent analysis and processing.

[0059] Labeling the data set: labeling work requires professional personnel to accurately identify and mark the pipeline defects in the ultrasonic C-scan images, including the type, position, size and other information of the defects. The labeling results will be used as the supervision signal for subsequent model training, guiding the model to learn the correct feature pattern and classification standard.

[0060] Divide the processed data set into training set, test set and validation set: according to a certain proportion (such as 8:1:1), randomly divide the preprocessed and labeled data set into training set, test set and validation set.

[0061] Step S120, improve the YOLOv11 network structure model:

[0062] Among them, the improvement of the YOLOv11 network structure model includes:

[0063] The C3K2 part of the YOLOv11 network structure model is replaced with a CSP_PMSFA module, the CSP_PMSFA module realizes feature sharing between different stages through a CSP layer, and uses PConv convolutions of different sizes to extract features of different scales, and finally fuses the feature maps through a 1x1 convolution layer and introduces a residual connection; the SPPF part of the YOLOv11 network structure model is replaced with a FPSConv module, the FPSConv module uses multiple dilated rate convolutions for multi-scale feature extraction, and adopts a shared convolution layer to reduce the calculation and storage overhead; based on the Small Object EnhancePyramid structure, the Neck part of the YOLOv11 network structure model is improved, the SPDConv module is used to enhance small target features; and the CSP-OmniKernel module is introduced in the P3 detection layer, the CSP-OmniKernel module includes local branches, large branches and global branches, which are used to extract local features, large-scale features and global context information;

[0064] Specifically, the C3K2 part is replaced with a CSP_PMSFA module

[0065] The CSP layer realizes feature sharing: the CSP layer realizes feature sharing through a cross-stage feature sharing mechanism, so that the features of different stages are complementary and fused with each other, enhancing the model's ability to extract multi-scale features and improving the richness and expression ability of the features.

[0066] PConv convolution extracts multi-scale features: PConv convolutions of different sizes (such as 3x3, 5x5 and 7x7) are used to perform convolution operations on the feature maps. PConv convolution only operates on part of the channels, reducing the amount of calculation, and through different size convolution kernels, different scale features are extracted, so that the model can better adapt to the diversity of pipeline defects.

[0067] 1x1 convolution layer fuses feature maps: after multi-scale feature extraction, 1x1 convolution layer is used to fuse feature maps from different scales, integrating multi-scale features into a compact and efficient feature representation, retaining key information while reducing the number of channels of the feature map and reducing the complexity of subsequent calculations.

[0068] Residual connection is introduced: the input features are added to the processed features to form a residual connection. Residual connection helps to preserve the original information in the input features, avoiding information loss or degradation in deep network, accelerating the convergence of the network and improving the training efficiency and performance of the model.

[0069] Replace the SPPF part with a FPSConv module:

[0070] Multi-expansion rate convolution for multi-scale feature extraction: The FPSConv module uses multiple expansion rates (e.g., 1, 3, and 5) for convolution to extract features. The expansion rate determines the sampling interval of the convolution kernel on the feature map. A larger expansion rate can expand the receptive field of the convolution kernel, capturing more extensive contextual information, while a smaller expansion rate can capture more detailed information. By combining multi-expansion rate convolution, FPSConv can effectively extract features of different scales, enhancing the model's ability to detect complex patterns and small defects.

[0071] Shared convolution layer reduces computational and storage overhead: To improve computational efficiency and reduce storage overhead, the FPSConv module adopts a shared convolution layer strategy. For different expansion rates, the module does not train an independent convolution layer for each expansion rate, but reuses the same set of convolution kernel parameters. In this way, the model can achieve multi-scale feature extraction and fusion without increasing too much computational and storage costs.

[0072] Improving the Neck part based on the Small Object Enhance Pyramid structure:

[0073] SPDConv module enhances small target features: In the Neck part, the SPDConv module is first used to enhance small target features. The SPDConv module divides the input feature map into multiple regions and performs convolution operations on each region, which can extract features containing more small target information. These enhanced small target features will be sent to the subsequent detection layer for further processing, improving the model's detection accuracy for small target defects.

[0074] CSP-OmniKernel module extracts multi-scale features: The CSP-OmniKernel module is introduced in the P3 detection layer, which includes local branches, large branches, and global branches. The local branches are used to extract local features, focusing on the details of the image; the large branches extract larger-scale features through larger-scale convolution kernels, capturing more extensive contextual information; the global branches are responsible for capturing the overall context information of the image, enhancing the model's understanding and utilization of global features through global modeling capabilities.

[0075] Step S130, using the training set to train the improved YOLOv11 network model, and obtaining an oil and gas pipeline defect detection model;

[0076] Specifically, step S130 includes:

[0077] Prepare the training environment: In the project directory of the server terminal, ensure that the necessary deep learning frameworks (such as PyTorch, etc.) and related dependent libraries have been installed, and the GPU acceleration environment has been configured to improve the speed of model training.

[0078] Load training set: Load the divided training set data into the model, including the preprocessed ultrasound C-scan images and their corresponding label information. The training set is used for the learning process of the model. Through interaction with the training set data, the model will continuously adjust its parameters to minimize the difference between the predicted results and the true labels.

[0079] Set training parameters: According to the characteristics of specific tasks and data sets, set appropriate training parameters such as learning rate, batch size, iteration number, etc. The learning rate determines the step size of the model parameters in each update, the batch size refers to the number of samples used in each training, and the iteration number determines the number of times the model learns on the entire training set.

[0080] Run training instructions: Use the training instructions provided by the official source code document of YOLOv11 to start the training process of the model. During the training process, the model will automatically perform forward propagation calculations to calculate the loss function value between the predicted results and the true labels, and calculate the gradient through the backpropagation algorithm to update the model parameters. The training process will continue until the preset iteration number is reached or other stopping conditions are met.

[0081] Monitor the training process: During the training process, monitor the training state of the model in real time, including the change of the loss function value, the adjustment of the learning rate, the training time, etc. By observing the trend of the loss function value, you can judge whether the model is learning effectively, whether there are problems such as overfitting or underfitting, etc. If you find that the training process is abnormal, you can adjust the training parameters or take other measures to optimize.

[0082] Save the trained model: When the training process is completed, save the trained oil and gas pipeline defect detection model to the specified file path. The saved model file contains the structure information and parameter values of the model after training, which can be used for subsequent testing and actual application.

[0083] Step S140, test the oil and gas pipeline defect detection model using the test set, and if the test fails, retrain the improved YOLOv11 network model.

[0084] Specifically, step S140 includes:

[0085] Prepare test environment and data: Ensure that the test environment is consistent with the training environment, including deep learning frameworks, dependent libraries, and GPU acceleration environments, etc. Place the divided test set data in the project directory as a separate folder to ensure that the test data is not used in the model training process to objectively evaluate the model performance.

[0086] Run the test instructions: Use the test instructions provided in the official source document of YOLOv11 to load the test set data and the trained model, and perform testing on the model. During the testing process, the model performs forward propagation calculation on each ultrasound C-scan image in the test set, and outputs the predicted pipeline defect information, including the type, location and size of the defect, etc.

[0087] Generate test results and evaluate model performance: After the test is completed, the model generates test results, usually in the form of a text file or image annotation file. According to the test results, calculate the performance indicators of the model, such as accuracy, recall rate, precision, F1 value, etc., to comprehensively evaluate the performance of the model in detecting oil and gas pipeline defects.

[0088] Determine whether the test is passed: According to the preset performance threshold (such as the accuracy needs to reach more than 90%, the recall rate needs to reach more than 85%, etc.), determine whether the model passes the test. If the performance indicators of the model meet the requirements, it is considered that the test is passed, and the next step can be entered; otherwise, it is considered that the test is not passed.

[0089] If the test is not passed, retrain the model: When the model does not pass the test, analyze the test results to find out the problems of the model, such as overfitting, underfitting, poor detection performance for some types of defects, etc. According to these problems, take appropriate optimization measures, such as adjusting the model structure, modifying the training parameters, increasing the training data, etc., and then retrain the improved YOLOv11 network model (return to step S130). The retrained model is tested again (step S140) until it passes the test.

[0090] Step S150, based on the oil and gas pipeline defect detection model that passes the test, to detect oil and gas pipeline defects.

[0091] Specifically, step S150 includes:

[0092] Model deployment: deploy the oil and gas pipeline defect detection model that passes the test to the actual detection environment, such as installing it on the pipeline detection device or integrating it into the pipeline monitoring system. Ensure that the model can work normally in the actual running environment, and be well compatible and connected with related hardware devices (such as ultrasonic detection probe, data acquisition device, etc.) and software systems (such as data management system, alarm system, etc.).

[0093] Data acquisition and preprocessing: in the actual detection process, scan the oil and gas pipeline through the ultrasonic detection device to obtain real-time ultrasonic C-scan image data. Perform the same preprocessing operations on the collected data as in training, including image scaling, normalization, noise reduction, etc., to ensure that the data format and quality input into the model meet the requirements.

[0094] Pipeline defect detection: input the preprocessed ultrasonic C-scan data into the deployed oil and gas pipeline defect detection model, and the model automatically performs forward propagation calculation to quickly and accurately detect defects in the pipeline and output the detection results, including the type, location, size, and corresponding confidence of the defects, etc.

[0095] Result analysis and processing: analyze and interpret the detection results output by the model, and develop appropriate treatment measures according to the type and severity of the defects. For serious defects, repair personnel should be arranged in time for maintenance to ensure the safe operation of the pipeline; for minor defects, tracking monitoring can be performed to check its development situation regularly. At the same time, the detection results and treatment measures are recorded to form a pipeline defect detection report, providing a basis for the maintenance and management of the pipeline.

[0096] Continuous optimization: in the actual application process, new pipeline defect data is continuously collected to further optimize and update the model. Through online learning or periodic retraining, the model can adapt to changes in pipeline defects and differences in detection environment, continuously improving the detection performance and reliability of the model to ensure the safe and stable operation of the oil and gas pipeline.

[0097] In this way, the present application realizes the automation of pipeline defect detection, reduces subjective errors and labor intensity in the manual detection process. Through intelligent evaluation of the pipeline state, the dependence on professional personnel is reduced, and the operation risk is reduced. Based on the improved YOLOv11 algorithm, it can accurately identify the tiny defects in the ultrasonic C-scan of the oil pipeline, especially in complex background and noisy environment, significantly improving the accuracy of defect detection and reducing the occurrence of missed detection and misjudgment. Through automated defect recognition and positioning, the present application can complete the processing of a large number of ultrasonic C-scan in a shorter time, greatly improving the detection speed compared with the traditional manual detection method, and providing the possibility for real-time monitoring and early warning of the pipeline.

[0098] Specifically, referring to Figure 3 , the improvement of the C3K2 part is specifically: using the CSP_PMSFA module instead of the C3K2 part. In the CSP_PMSFA module, the CSP layer ensures feature sharing between different stages. Specifically, the input feature map is gradually extracted through multiple convolution layers to extract features of different scales, and these features are shared in multiple stages. By reducing redundant information and improving the reuse rate of features, the CSP layer not only optimizes the parameter utilization efficiency of the model, but also enhances the expression ability and reasoning ability of the model.

[0099] On this basis, CSP_PMSFA uses different sizes of PConv convolution (such as 3x3, 5x5 and 7x7), and each convolution layer uses the idea of partial convolution when extracting features of different scales. For each convolution kernel, PConv only operates on part of the channels, thereby reducing the amount of calculation and improving efficiency. It only applies regular Conv on a part of the input channels for spatial feature extraction, without processing the remaining channels. For consecutive or regular memory access, we consider the first or last consecutive c p The input and output feature maps have the same number of channels, so the FLOP of PConv is only

[0100]

[0101] where h and w are the height and width of the feature map, k is the size of the convolution kernel, c p is the number of channels involved in the calculation, and c p is usually a part of the total number of channels c. In a typical partial ratio The FLOP of PConv is only Since PConv only calculates part of the channels, the amount of memory access is also reduced. The amount of memory access is only

[0102]

[0103] After partial multi-scale feature extraction, the CSP_PMSFA module fuses feature maps from different scales through a 1x1 convolution layer. The 1x1 convolution not only effectively adjusts the number of channels, but also fuses the concatenated features of multiple scales to form a compact and efficient feature representation while preserving key information. In addition, the module also introduces residual connection (Residual Connection) to add the input features to the processed features. The introduction of residual connection helps to preserve the original information in the input features, avoids information loss or degradation, and combines the newly extracted multi-scale features to enhance the model's expression and learning ability. In this way, the module preserves the original input information while further improving the effectiveness of feature fusion and the overall performance of the model.

[0104] Referring to Figure 4 , the improvement of the SPPF part is specifically that the FPSConv module is used to replace the SPPF module. In FPSConv, multiple dilation rates (such as 1, 3 and 5) are used to realize multi-scale convolution:

[0105]

[0106] where d is the dilation rate, x is the input, w is the convolution kernel, i, j are the positions of the output feature map. Dilated convolution can expand the receptive field, capture local details and global information. Low dilation rate convolution captures detailed information, while high dilation rate convolution can capture more extensive context information.

[0107] To reduce the computational and storage overhead of the model, FPSConv uses a shared convolution layer, which means that for different dilation rates, the module does not train an independent convolution layer for each dilation rate, but reuses the same set of convolution kernel parameters. In this way, the model can share the same convolution kernel weights, reducing the number of parameters required during training, thereby improving computational efficiency and model storage efficiency, avoiding the storage of redundant parameters.

[0108] Through the 1x1 convolution layers self.cv1 and self.cv2, the channels are efficiently adjusted and fused. First, the input channel number is adjusted through the cv1 layer, and then the features fused through multi-scale convolution are further processed through the cv2 layer. The role of the 1x1 convolution layer is to convert the input channel number to another suitable channel number for subsequent processing, while effectively adjusting the channel without increasing a large amount of computational overhead, retaining key information in the image.

[0109]

[0110] Here, w i,j is the weight of the convolution kernel, w i,j is the input, and y is the output.

[0111] Unlike traditional pooling operations (such as the pooling in the SPPF module), FPSConv uses convolution operations for feature extraction. Convolution operations can capture local features while retaining more detailed information, while pooling operations may lose some details when compressing features. The introduction of FPSConv enables the model to perform multi-scale feature extraction through convolution layers with different dilation rates, improving the ability to capture small defects and complex shapes in oil and gas pipelines. This method effectively solves the problem of loss of detailed information in traditional methods, improving the model's ability to extract features at different scales.

[0112] Referring to Figure 5 , Figure 6, the improvement of the Neck part is specifically: a Small Object Enhance Pyramid (SOEP) structure is proposed. Small object detection often faces certain challenges in traditional P3, P4, and P5 detection layers, because in the downsampling process, small target information in the image may be lost. To make up for this, traditional methods usually add a P2 detection layer to improve the detection ability of small targets. However, directly adding a P2 detection layer can improve the detection effect of small targets to some extent, but it also brings problems such as large increase in computational complexity and complex post-processing.

[0113] Unlike traditional methods, SOEP does not directly add a P2 detection layer, but rather improves small target detection ability in a more efficient way. First, we use the SPDConv module to enhance the relevant information of small targets and process the features of the P2 detection layer. SPDConv divides the input feature map into four regions and performs convolution on each region, which can extract features containing more small target information. These enhanced small target features will be sent to the P3 layer for fusion, effectively avoiding the computational burden and post-processing complexity brought by directly adding a P2 layer.

[0114] To further optimize the extraction and integration of small target features, we introduce the CSP-OmniKernel module in the P3 detection layer. Based on the CSP idea, this module processes features of different scales through multiple branches. Given the input feature X ∈ R C×H×W , the feature is processed by a 1x1 convolution and then by three branches to process features of different scales to enhance multi-scale representation. The results of the three branches are fused by addition and adjusted by another 1x1 convolution. Next, we introduce the internal components of each branch. CSP-OmniKernel contains three main branches: local branch, large branch, and global branch.

[0115] In the large branch, we apply a depth convolution with kernel size KxK to find a large receptive field. In addition to regular depth-wise convolution, we also use 1xK and Kx1 depth-wise convolution in parallel with square convolution to harvest strip-shaped context information. To avoid introducing a large amount of computational overhead due to large-scale kernel convolution, we place the module at the bottleneck position. To achieve better performance, we finally choose K=31 in the large branch. Since a 31x31 kernel cannot cover the global receptive field, we add global modeling capability in the global branch by using dual-domain processing.

[0116] The global branch consists of a dual-domain channel attention module (DCAM) and a frequency-based spatial attention module (FSAM). Next, we introduce these two modules in turn. Given the input feature X Global ∈R C×H×W , DCAM first applies frequency channel attention (FCA) on X Global , as follows:

[0117]

[0118] where and are the fast Fourier transform and its inverse operation, respectively; X FCA , W 1×1 and GAP represent the outputs of FCA, 1x1 convolution layer and global average pooling, respectively; denotes element-wise multiplication. The output of FCA is then further processed by a spatial channel attention module (SCA),

[0119]

[0120] where X DCAM is the output of DCAM. Applying frequency attention on the output feature of DCAM, the global frequency information in the feature is emphasized, denoted as,

[0121]

[0122] where X FSAM is the result of FSAM. This operation helps the network focus on the most important frequency components when processing image features.

[0123] In addition to capturing large-scale receptive fields with large and global branches, we also design a very simple but effective local branch for local signal modulation using a 1x1 depth convolution layer. The global branch is responsible for capturing the overall contextual information of the image, the large branch processes features of larger scales, while the local branch focuses on the extraction of local features. This structure enables the network to learn features from global to local, thereby enhancing the detection ability of small targets.

[0124] The feature maps of different scales from P2 to P5 are extracted through the backbone network to capture the defect information of the oil and gas pipeline at different resolutions. The SPDConv module is used to enhance the detailed features of small-scale defects and help detect tiny surface damage or flaws. Subsequently, the CSP_PMSFA module and the CSPOmniKernel module respectively strengthen the extraction and fusion of defect features through cross-stage partial connection and feature attention mechanism, and improve the learning of global and local defect features through multi-scale convolution operation, thereby improving the accuracy and robustness of small target defects of the pipeline.

[0125] To systematically evaluate the effectiveness of each module, a series of ablation experiments were conducted, starting from the baseline model, gradually adding the CSP_PMSFA, FPSConv and SOEP structures to evaluate their respective roles and impact on model performance, as shown in Table 1:

[0126] Table 1 Ablation experiment data table

[0127] Baseline CSP_PMSFA FPSConv SOEP Params (M) GFlops (G) mAP 0.5 (%) mAP 0.5:0.95 (%) √ 2.6 6.3 74.1 41.4 √ √ 2.6 7.6 76.4 42.0 √ √ √ 2.8 7.6 77.0 42.8 √ √ √ √ 3.2 13.6 77.7 44.6

[0128] In some embodiments, the improved YOLOv11 network model is trained using the training set to obtain an oil and gas pipeline defect detection model and tested using the training set. It includes: using the training instructions provided by the official source code document of YOLOv11 to run the training instructions in the project directory of the server terminal to obtain the oil and gas pipeline defect model; placing the test set in the project directory as a separate folder, and running the test specification provided by the official source code document of YOLOv11 to generate the test results.

[0129] Exemplary apparatus

[0130] The device embodiments of the present application can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0131] Figure 7 Fig. 1 shows a block diagram of an oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm according to an embodiment of the present application. As shown in Fig. 1, the device includes: Figure 7

[0132] The acquisition module 71 is configured to acquire an oil and gas pipeline defect ultrasonic C-scan data set, and pre-process and label the data set. The processed data set is divided into a training set, a test set and a validation set.

[0133] The improvement module 72 is configured to improve the YOLOv11 network structure model.

[0134] The improvement of the YOLOv11 network structure model includes: ​

[0135] The C3K2 part of the YOLOv11 network structure model is replaced with the CSP_PMSFA module. The CSP_PMSFA module realizes feature sharing between different stages through the CSP layer, extracts features of different scales using PConv convolutions of different sizes, and finally fuses the feature maps through a 1x1 convolutional layer and introduces residual connections.

[0136] The SPPF part of the YOLOv11 network structure model is replaced with the FPSConv module. The FPSConv module uses convolutions with multiple dilation rates for multi-scale feature extraction and adopts shared convolutional layers to reduce computation and storage overhead.

[0137] Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved by enhancing small object features through the SPDConv module; and a CSP-OmniKernel module is introduced into the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches and global branches, which are used to extract local features, large-scale features and global contextual information.

[0138] Training module 73 is used to train the improved YOLOv11 network model using the training set to obtain the oil and gas pipeline defect detection model; and to test the oil and gas pipeline defect detection model using the test set. If the test fails, the improved YOLOv11 network model is retrained.

[0139] The detection module 74 is used to detect defects in oil and gas pipelines based on a tested oil and gas pipeline defect detection model.

[0140] In some embodiments, in the CSP_PMSFA module, PConv convolution operates on a subset of channels to reduce computational load.

[0141] In some embodiments, the plurality of expansion rates include: 1, 3, and 5.

[0142] In some embodiments, the large branch employs a 31×31 depthwise convolution kernel to find a large receptive field;

[0143] The global branch consists of a dual-domain channel attention module and a frequency-based spatial attention module, used to capture global context information;

[0144] The local branch uses a 1×1 depth convolutional layer for local signal modulation.

[0145] Below, for reference Figure 8 This describes an electronic device according to embodiments of the present application.Figure 8 FIG. 1 illustrates a block diagram of an electronic device according to an embodiment of the present application.

[0146] As shown in FIG. 8, the electronic device 800 includes one or more processors 810 and a memory 820. Figure 8

[0147] The processor 810 can be a central processing unit (CPU) or other form of processing unit having data processing and / or instruction execution capabilities, and can control other components in the electronic device 800 to perform desired functions.

[0148] The memory 820 can include one or more computer program products that can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory, for example, can include random access memory (RAM), cache memory, and / or the like. The non-volatile memory, for example, can include read-only memory (ROM), hard disk, flash memory, and / or the like. One or more computer program instructions can be stored on the computer-readable storage media, and the processor 810 can execute the program instructions to implement the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm of various embodiments of the present application described above and / or other desired functions. Various contents such as the category correspondence relationship and the like can also be stored in the computer-readable storage media.

[0149] In one example, the electronic device 800 can further include an input device 830 and an output device 840, which are interconnected through a bus system and / or other forms of connection mechanism (not shown).

[0150] In addition, the input device 830 can further include, for example, a keyboard, a mouse, an interface, and the like. The output device 840 can output various information including analysis results and the like to the outside. The output device 840 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0151] Of course, in order to simplify, Figure 8 only some of the components related to the present application among the components in the electronic device are shown, and components such as buses, input / output interfaces, and the like are omitted. In addition, the electronic device can further include any other appropriate components according to specific application cases.

[0152] Exemplary computer program product and computer readable storage medium

[0153] ​In addition to the above method and device, embodiments of the present application can also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the improved YOLOv11 algorithm-based oil and gas pipeline defect detection method according to various embodiments of the present application described in the above “Exemplary Method” section of the present specification.

[0154] The computer program product can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++, etc., and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server.

[0155] In addition, embodiments of the present application can also be a computer readable storage medium, which stores computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the improved YOLOv11 algorithm-based oil and gas pipeline defect detection method according to various embodiments of the present application described in the above “Exemplary Method” section of the present specification.

[0156] The computer readable storage medium can take the form of one or more combinations of any of the following: a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0157] The above description has been given for the purposes of illustration and description. In addition, this description does not intend to limit the embodiments of the present application to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain modifications, permutations, additions, and sub-combinations thereof.

Claims

1. An oil and gas pipeline defect detection method based on an improved YOLOv11 algorithm, characterized in that, The method comprises the following steps: Collecting an ultrasonic C-scan data set of oil and gas pipeline defects, preprocessing and labeling the data set, and dividing the processed data set into a training set, a test set and a validation set; Improving a YOLOv11 network structure model, wherein the improvement of the YOLOv11 network structure model comprises: Replacing a C3K2 part of the YOLOv11 network structure model with a CSP_PMSFA module, wherein the CSP_PMSFA module realizes feature sharing between different stages through a CSP layer, uses PConv convolution of different sizes to extract features of different scales, finally fuses feature maps through a 1x1 convolution layer, and introduces a residual connection, and the PConv convolution operates on part of the channels in the CSP_PMSFA module; Replacing an SPPF part of the YOLOv11 network structure model with an FPSConv module, wherein the FPSConv module uses multiple dilated rate convolutions for multi-scale feature extraction, and adopts a shared convolution layer to reduce calculation and storage overheads; Improving a Neck part of the YOLOv11 network structure model based on a SmallObjectEnhancePyramid structure, enhancing small target features through an SPDConv module, and introducing a CSP-OmniKernel module into a P3 detection layer, wherein the CSP-OmniKernel module comprises a local branch, a large branch and a global branch, is used for extracting local features, large-scale features and global context information, the large branch adopts a 31x31 deep convolution kernel, the global branch is composed of a dual-domain channel attention module and a frequency-based spatial attention module, and the local branch uses a 1x1 deep convolution layer for local signal modulation; Training the improved YOLOv11 network model using the training set to obtain an oil and gas pipeline defect detection model; Testing the oil and gas pipeline defect detection model using the test set, and retraining the improved YOLOv11 network model if the test fails; Detecting oil and gas pipeline defects based on the oil and gas pipeline defect detection model that passes the test. The multiple dilated rates comprise 1, 3 and 5.

2. The oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to claim 1, characterized in that, The local branch uses a 1x1 deep convolution layer for local signal modulation. The method comprises the following steps:

3. An oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm, characterized by, A collecting module is configured to collect an ultrasonic C-scan data set of oil and gas pipeline defects, preprocess and label the data set, and divide the processed data set into a training set, a test set and a validation set; An improving module is configured to improve a YOLOv11 network structure model, wherein the improvement of the YOLOv11 network structure model comprises: Replacing a C3K2 part of the YOLOv11 network structure model with a CSP_PMSFA module, wherein the CSP_PMSFA module realizes feature sharing between different stages through a CSP layer, uses PConv convolution of different sizes to extract features of different scales, finally fuses feature maps through a 1x1 convolution layer, and introduces a residual connection, and the PConv convolution operates on part of the channels in the CSP_PMSFA module; ​ The C3K2 part of the YOLOv11 network structure model is replaced by a CSP_PMSFA module, the CSP_PMSFA module realizes feature sharing between different stages through a CSP layer, uses PConv convolutions of different sizes to extract features of different scales, finally fuses feature maps through a 1x1 convolution layer, and introduces a residual connection, in the CSP_PMSFA module, the PConv convolution operates on part of the channels; The SPPF part of the YOLOv11 network structure model is replaced by an FPSConv module, the FPSConv module uses multiple dilated rate convolutions for multi-scale feature extraction, and adopts a shared convolution layer to reduce the calculation and storage overheads; Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved, small target features are enhanced through an SPDConv module, and a CSP-OmniKernel module is introduced into the P3 detection layer, the CSP-OmniKernel module includes a local branch, a large branch and a global branch, and is used for extracting local features, large-scale features and global context information, the large branch adopts a 31x31 deep convolution kernel, the global branch is composed of a dual-domain channel attention module and a frequency-based spatial attention module, and the local branch uses a 1x1 deep convolution layer for local signal modulation; A training module is configured to train the improved YOLOv11 network model using a training set to obtain an oil and gas pipeline defect detection model, and test the oil and gas pipeline defect detection model using a test set, and if the test fails, retrain the improved YOLOv11 network model; A detection module is configured to detect oil and gas pipeline defects based on the oil and gas pipeline defect detection model that passes the test.

4. The oil and gas pipeline defect detection device based on the improved YOLOv11 algorithm according to claim 3, characterized in that, The multiple dilated rates include 1, 3 and 5.

5. An electronic device, comprising: It comprises: a processor and a memory for storing programs executable by the processor; The processor is configured to implement the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm by running the programs in the memory.

6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program causes the processor to execute the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm when the computer program is run by the processor.

Citation Information

Patent Citations

  • Lightweight defect detection method based on mixed multi-scale knowledge distillation

    CN118154607A

  • Submarine pipeline leakage segmentation model construction method and segmentation method

    CN118864487A