Oil and gas pipeline defect detection method and device based on improved YOLOv11 algorithm
By improving the YOLOv11 algorithm and combining it with the CSP_PMSFA, FPSConv, and SOEP structures, the problem of low manual analysis efficiency in oil and gas pipeline defect detection is solved, automatic and accurate pipeline defect identification is achieved, and detection speed and accuracy are improved.
Patent Information
- Application Number
- CN202510700118.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-05-28
AI Technical Summary
The existing oil and gas pipeline defect detection methods rely on manual analysis, which is inefficient and easily affected by human factors, making it difficult to achieve efficient and accurate detection, especially in complex backgrounds and noisy images, which are prone to missed detections or misjudgments.
An improved YOLOv11 algorithm is adopted. By replacing the C3K2 part with the CSP_PMSFA module, replacing the SPPF part with the FPSConv module, and introducing the Small Object Enhance Pyramid structure and CSP-OmniKernel module in the Neck part, the feature extraction and detection capabilities are enhanced and the computation and storage overhead are reduced.
It realizes the automated detection of oil and gas pipeline defects, improves the detection accuracy and speed, reduces missed detections and misjudgments, improves the detection efficiency and accuracy, and reduces the dependence on professionals.
Smart Images

Figure CN120599356A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of detection-related technologies, and specifically to a method and device for detecting defects in oil and gas pipelines based on an improved YOLOv11 algorithm. Background Art
[0002] Over the long term, oil and gas pipelines are inevitably subject to various natural and human factors, resulting in various types of defects. For example, corrosion is a common problem in oil and gas pipelines, which can reduce the thickness of the pipeline wall, thereby affecting the pipeline's pressure-bearing capacity. Cracks are also potentially dangerous defects in pipelines, potentially causing sudden rupture. Furthermore, mechanical damage to the pipeline may occur due to improper construction or external impact. If these defects are not discovered and addressed promptly, they are likely to lead to serious safety accidents, such as oil and gas leaks. This not only causes huge economic losses, but can also cause devastating damage to the surrounding environment and even endanger personnel safety.
[0003] Given the importance of safe operation of oil and gas pipelines, regular pipeline inspection and maintenance are key measures to ensure a stable energy supply and prevent accidents. Traditional manual inspection methods, such as visual inspection and manual ultrasonic testing, are inefficient and susceptible to human factors, leading to inaccurate test results. Summary of the Invention
[0004] In view of this, the embodiments of the present application are dedicated to providing an oil and gas pipeline defect detection method and device based on an improved YOLOv11 algorithm.
[0005] This application provides an oil and gas pipeline defect detection method based on an improved YOLOv11 algorithm, comprising:
[0006] Collect ultrasonic C-scan image datasets of oil and gas pipeline defects, preprocess and annotate them, and divide the processed datasets into training, test, and validation sets.
[0007] Improve the YOLOv11 network structure model:
[0008] Among them, the improvements of the YOLOv11 network structure model include:
[0009] The C3K2 part of the YOLOv11 network structure model is replaced with the CSP_PMSFA module. The CSP_PMSFA module implements feature sharing between different stages through the CSP layer, and uses PConv convolutions of different sizes to extract features of different scales. Finally, the feature maps are fused through a 1x1 convolution layer and a residual connection is introduced.
[0010] The SPPF part of the YOLOv11 network structure model is replaced by the FPSConv module. The FPSConv module uses convolutions with multiple expansion rates to extract multi-scale features and adopts shared convolution layers to reduce computational and storage overhead.
[0011] Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved, and the small object features are enhanced through the SPDConv module. The CSP-OmniKernel module is introduced in the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches, and global branches for extracting local features, larger-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. If it fails the test, the improved YOLOv11 network model is retrained;
[0014] Oil and gas pipeline defect detection is performed based on the tested oil and gas pipeline defect detection model.
[0015] In some embodiments, in the CSP_PMSFA module, PConv convolution operates on some channels to reduce the amount of computation.
[0016] In some embodiments, the plurality of expansion ratios include: 1, 3, and 5.
[0017] In some embodiments, the large branch uses a 31×31 depth convolution kernel to find a large receptive field;
[0018] The global branch consists 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 1×1 depth convolution layer to perform local signal modulation.
[0020] This application provides an oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm, comprising:
[0021] The acquisition module is used to collect ultrasonic C-scan image datasets of oil and gas pipeline defects, preprocess and annotate the datasets, and divide the processed datasets into training, test, and validation sets;
[0022] Improvement module, used to improve the YOLOv11 network structure model:
[0023] Among them, the improvements of the YOLOv11 network structure model include:
[0024] The C3K2 part of the YOLOv11 network structure model is replaced with the CSP_PMSFA module. The CSP_PMSFA module implements feature sharing between different stages through the CSP layer, and uses PConv convolutions of different sizes to extract features of different scales. Finally, the feature maps are fused through a 1x1 convolution layer and a residual connection is introduced.
[0025] The SPPF part of the YOLOv11 network structure model is replaced by the FPSConv module. The FPSConv module uses convolutions with multiple expansion rates to extract multi-scale features and adopts shared convolution layers to reduce computational and storage overhead.
[0026] Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved, and the small object features are enhanced through the SPDConv module. The CSP-OmniKernel module is introduced in the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches, and global branches for extracting local features, larger-scale features, and global context information.
[0027] A training module is used to train the improved YOLOv11 network model using the training set to obtain an oil and gas pipeline defect detection model; test the oil and gas pipeline defect detection model using the test set, and if it fails the test, retrain the improved YOLOv11 network model;
[0028] The detection module is used to perform oil and gas pipeline defect detection based on a tested oil and gas pipeline defect detection model.
[0029] In some embodiments, in the CSP_PMSFA module, PConv convolution operates on some channels to reduce the amount of computation.
[0030] In some embodiments, the plurality of expansion ratios include: 1, 3, and 5.
[0031] In some embodiments, the large branch uses a 31×31 depth convolution kernel to find a large receptive field;
[0032] The global branch consists 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 1×1 depth convolution layer to perform local signal modulation.
[0034] The present application provides an electronic device, including:
[0035] A processor, and a memory for storing a program executable by the processor;
[0036] The processor is used to implement the above-mentioned oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm by running the program in the memory.
[0037] The present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the processor is enabled to execute the above-mentioned oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm.
[0038] The present application provides an oil and gas pipeline defect detection method based on an improved YOLOv11 algorithm, which collects an ultrasonic C-scan image dataset of oil and gas pipeline defects, preprocesses and annotates the dataset, and divides the processed dataset into a training set, a test set, and a validation set; improves the YOLOv11 network structure model: wherein the improvement of the YOLOv11 network structure model includes: replacing the C3K2 part of the YOLOv11 network structure model with a CSP_PMSFA module, the CSP_PMSFA module realizes feature sharing between different stages through the 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; replacing the SPPF part of the YOLOv11 network structure model with an FPSConv module, the FPSConv module uses convolutions with multiple expansion rates for multi-scale feature extraction, and adopts a shared convolution layer to reduce calculation and storage overhead; based on Small Object Detection. The EnhancePyramid structure is used to improve the Neck part of the YOLOv11 network structure model, and the small target features are enhanced through the SPDConv module. The CSP-OmniKernel module is introduced into the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches, and global branches for extracting local features, larger-scale features, and global context information. The improved YOLOv11 network model is trained using the training set to obtain an oil and gas pipeline defect detection model. The oil and gas pipeline defect detection model is tested using the test set, and the detection results are output. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The above and other purposes, features, and advantages of the present application will become more apparent through a more detailed description of the embodiments of the present application in conjunction with the accompanying drawings. The accompanying drawings are intended to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the drawings, the same reference numerals generally represent the same components or steps.
[0040] Figure 1 This is a flow chart of an oil and gas pipeline defect detection method based on an improved YOLOv11 algorithm provided in an embodiment of the present application.
[0041] Figure 2 This is a schematic diagram of the improved structure of the YOLOV11 algorithm of the present invention;
[0042] Figure 3 Schematic diagram of the CSP_PMSFA structure of the present invention;
[0043] Figure 4 Schematic diagram of the FPSConv structure of the present invention;
[0044] Figure 5 It is a schematic diagram of the SOEP structure of the present invention;
[0045] Figure 6 Schematic diagram of the CSP-OmniKernel structure of the present invention;
[0046] Figure 7 This is a structural diagram of an oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm provided in an embodiment of the present application.
[0047] Figure 8 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0049] Existing pipeline defect detection methods rely primarily on manual analysis and struggle to achieve efficient and accurate detection, particularly when faced with complex backgrounds and noisy images, which can easily lead to missed detections or misjudgments. To address these issues, the present invention introduces an improved version of the YOLOv11 algorithm, combining it with the characteristics of oil pipeline defects to automatically and accurately identify pipeline defects in ultrasonic C-scan images, enabling intelligent assessment of pipeline status. This algorithm not only improves the accuracy and speed of defect location but also enhances its adaptability to complex images by optimizing the model structure. This significantly reduces manual effort and improves detection efficiency and accuracy, thus providing an efficient and reliable intelligent detection solution for oil pipeline safety monitoring.
[0050] Specifically, the C3K2 part of the YOLOv11 network structure model is replaced with the CSP_PMSFA module; the SPPF part of the YOLOv11 network structure model is replaced with the FPSConv module; based on the Small Object EnhancePyramid structure, the Neck part of the YOLOv11 network structure model is improved;
[0051] CSP_PMSFA architecture: Utilizes Partial Convolution for multi-scale feature extraction, improving feature expression capabilities. FPSConv architecture: Uses multi-scale dilated convolution and introduces a parameter sharing strategy to reduce computational complexity. SOEP architecture: Utilizes SPDConv combined with small target features to enhance detection of minor defects and reduce missed detections.
[0052] In this way, the present invention realizes the automation of pipeline defect detection, reducing the subjective errors and labor intensity in the manual detection process. By intelligently assessing the pipeline status, it reduces the dependence on professional personnel and reduces operational risks. Based on the improved YOLOv11 algorithm, it can accurately identify tiny defects in ultrasonic C-scan images of oil pipeline defects, especially in complex background and noisy environments, significantly improving the accuracy of defect detection and reducing the occurrence of missed detection and misjudgment. Through automated defect identification and positioning, the present invention can complete the processing of a large number of ultrasonic C-scan images in a shorter time, greatly improving the detection speed compared to traditional manual detection methods, and providing the possibility for real-time monitoring and early warning of pipelines.
[0053] After introducing the basic principles of the present application, various non-limiting embodiments of the present application will be described in detail with reference to the accompanying drawings.
[0054] like Figure 1 、 Figure 2 As shown, the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm provided in this application includes the following contents.
[0055] Step S110: collecting an ultrasonic C-scan image dataset of oil and gas pipeline defects, preprocessing and labeling the dataset, and dividing the processed dataset into a training set, a test set, and a validation set;
[0056] Specifically, step S110 includes the following contents:
[0057] Acquire a dataset of ultrasonic C-scan images of oil and gas pipeline defects: Obtain a large number of ultrasonic C-scan images from actual oil and gas pipeline inspections. These images should cover pipeline defects of varying types, locations, and severity, such as corrosion, cracks, and deformation, to ensure the dataset's diversity and representativeness. Also, record relevant information such as pipeline operating conditions and inspection equipment parameters to better understand the defect formation context and inspection conditions.
[0058] Preprocess the dataset: The goal of preprocessing is to improve image quality, remove noise and interference, and make the image more suitable for subsequent analysis and processing.
[0059] Labeling the dataset: This process requires professionals to accurately identify and label pipeline defects in ultrasonic C-scan images, including information such as defect type, location, and size. The labeling results serve as supervisory signals for subsequent model training, guiding the model to learn the correct feature patterns and classification criteria.
[0060] Divide the processed dataset into training set, test set and validation set: randomly divide the preprocessed and labeled dataset into training set, test set and validation set according to a certain ratio (such as 8:1:1).
[0061] Step S120: Improve the YOLOv11 network structure model:
[0062] Among them, the improvements of the YOLOv11 network structure model include:
[0063] The C3K2 part of the YOLOv11 network structure model is replaced by the CSP_PMSFA module. The CSP_PMSFA module realizes feature sharing between different stages through the CSP layer, and uses PConv convolutions of different sizes to extract features of different scales. Finally, the feature maps are fused through a 1x1 convolution layer, and a residual connection is introduced. The SPPF part of the YOLOv11 network structure model is replaced by the FPSConv module. The FPSConv module uses convolutions with multiple expansion rates for multi-scale feature extraction and adopts a shared convolution layer to reduce computational and storage overhead. Based on the Small Object EnhancePyramid structure, the Neck part of the YOLOv11 network structure model is improved, and the small target features are enhanced by the SPDConv module. The CSP-OmniKernel module is introduced in the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches and global branches for extracting local features, larger-scale features and global context information.
[0064] Specifically, replace the C3K2 part with the CSP_PMSFA module
[0065] The CSP layer implements feature sharing: The CSP layer uses a cross-stage feature sharing mechanism to enable features from different stages to complement and fuse each other, thereby enhancing the model's ability to extract multi-scale features and improving the richness and expressiveness of features.
[0066] PConv convolution extracts multi-scale features: PConv convolutions of different sizes (such as 3×3, 5×5, and 7×7) are used to convolve the feature map. PConv convolutions only operate on a subset of channels, reducing the amount of computation. Convolution kernels of different sizes extract features of different scales, enabling the model to better adapt to the diversity of pipeline defects.
[0067] 1x1 convolutional layer fusion feature map: After multi-scale feature extraction, the feature maps from different scales are fused through the 1x1 convolutional layer, integrating the multi-scale features into a compact and efficient feature representation, retaining key information while reducing the number of channels in the feature map and reducing the complexity of subsequent calculations.
[0068] Introducing residual connections: Adding input features to processed features forms a residual connection. Residual connections help preserve the original information in the input features, preventing information loss or degradation in deep networks, accelerating network convergence, and improving model training efficiency and performance.
[0069] Replace the SPPF part with the FPSConv module:
[0070] Multi-scale feature extraction using convolution with multiple dilation rates: The FPSConv module uses convolution with multiple dilation rates (such as 1, 3, and 5) for feature extraction. The dilation rate determines the sampling interval of the convolution kernel on the feature map. Larger dilation rates expand the receptive field of the convolution kernel and capture a wider range of contextual information, while smaller dilation rates capture more detailed information. By combining convolution with multiple dilation rates, FPSConv can effectively extract features at different scales, enhancing the model's ability to detect complex morphologies and subtle defects.
[0071] Shared convolutional layers reduce computational and storage overhead: To improve computational efficiency and reduce storage overhead, the FPSConv module adopts a shared convolutional layer strategy. Instead of training a separate convolutional layer for each dilation rate, the module reuses the same set of convolution kernel parameters. This allows the model to extract and fuse multi-scale features without significantly increasing computational and storage costs.
[0072] Improve the Neck part based on the Small Object Enhance Pyramid structure:
[0073] The SPDConv module enhances small object features: In the Neck section, the SPDConv module is first used to enhance small object features. By dividing the input feature map into multiple regions and performing convolution operations on each region, the SPDConv module extracts features containing more small object information. These enhanced small object features are then fed into subsequent detection layers for further processing, improving the model's accuracy in detecting small object defects.
[0074] The CSP-OmniKernel module extracts multi-scale features: The CSP-OmniKernel module is introduced in the P3 detection layer. This module consists of a local branch, a large branch, and a global branch. The local branch extracts local features, focusing on image details. The large branch uses larger convolution kernels to extract larger-scale features, capturing a wider range of contextual information. The global branch captures the overall context 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 to obtain 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) and related dependent libraries have been installed, and configure the GPU acceleration environment to increase the speed of model training.
[0078] Loading the training set: Load the divided training set data into the model, including the preprocessed ultrasound C-scans and their corresponding annotations. The training set is used for model learning. The model will continuously adjust its parameters by interacting with the training set data to minimize the difference between the predicted results and the actual annotations.
[0079] Set training parameters: Based on the specific task and dataset characteristics, set appropriate training parameters such as learning rate, batch size, and number of iterations. The learning rate determines the step size for each update of the model parameters, the batch size refers to the number of samples used in each training session, and the number of iterations determines the number of times the model learns on the entire training set.
[0080] Run the training command: Use the training command provided in the official YOLOv11 source code documentation to start the model training process. During training, the model will automatically perform forward propagation to calculate the loss function between the predicted results and the true annotations, and use the backpropagation algorithm to calculate the gradient and update the model parameters. The training process will continue until the preset number of iterations is reached or other stopping conditions are met.
[0081] Monitor the training process: During training, monitor the model's training status in real time, including changes in the loss function value, adjustments to the learning rate, and training time. By observing the changing trends in the loss function value, you can determine whether the model is learning effectively and whether there are problems such as overfitting or underfitting. If you detect any abnormalities in the training process, you can promptly adjust the training parameters or take other optimization measures.
[0082] Save the trained model: After the training process is complete, save the trained oil and gas pipeline defect detection model to a specified file path. The saved model file contains the model's structural information and trained parameter values, which can be used for subsequent testing and practical applications.
[0083] Step S140: testing the oil and gas pipeline defect detection model using a test set. If the model fails the test, retraining the improved YOLOv11 network model.
[0084] Specifically, step S140 includes:
[0085] Prepare the test environment and data: Ensure that the test environment is consistent with the training environment, including the deep learning framework, dependent libraries, and GPU acceleration environment. Place the divided test data in a separate folder within the project directory. Ensure that the test data has not been used during model training to objectively evaluate model performance.
[0086] Run the test instructions: Use the test instructions provided in the official YOLOv11 source code documentation to load the test data and the trained model to test the model. During the test, the model performs forward propagation calculations on each ultrasonic C-scan image in the test set and outputs predicted pipeline defect information, including defect type, location, and size.
[0087] Generate test results and evaluate model performance: After testing, the model generates test results, typically saved as a text file or annotated image file. Based on these test results, various model performance metrics, such as accuracy, recall, precision, and F1 score, are calculated to comprehensively evaluate the model's performance in detecting oil and gas pipeline defects.
[0088] Determine if the model has passed the test: Based on preset performance indicator thresholds (such as accuracy must reach above 90%, recall must reach above 85%, etc.), determine whether the model has passed the test. If all performance indicators of the model meet the requirements, the test is considered passed and you can proceed to the next step; otherwise, the test is considered failed.
[0089] If the model fails the test, retrain the model: If the model fails the test, analyze the test results to identify any model issues, such as overfitting, underfitting, or poor performance in detecting certain types of defects. Optimize these issues by adjusting the model structure, modifying training parameters, or adding more training data. Then, retrain the improved YOLOv11 network model (returning to step S130). The retrained model is tested again (step S140) until it passes the test.
[0090] Step S150: performing oil and gas pipeline defect detection based on the tested oil and gas pipeline defect detection model.
[0091] Specifically, step S150 includes:
[0092] Model deployment: Deploy the tested oil and gas pipeline defect detection model to the actual inspection environment, such as installing it on pipeline inspection equipment or integrating it into the pipeline monitoring system. Ensure that the model functions properly in the actual operating environment and is compatible and integrated with related hardware equipment (such as ultrasonic inspection probes, data acquisition equipment, etc.) and software systems (such as data management systems, alarm systems, etc.).
[0093] Data acquisition and preprocessing: During actual inspections, ultrasonic testing equipment is used to scan oil and gas pipelines, acquiring real-time ultrasonic C-scan data. The collected data undergoes the same preprocessing as used during training, including image scaling, normalization, and noise reduction, to ensure that the data format and quality required for input into the model meet the requirements.
[0094] Pipeline defect detection: The preprocessed ultrasonic C-scan data is input into the deployed oil and gas pipeline defect detection model. The model automatically performs forward propagation calculations to quickly and accurately detect defects in the pipeline and outputs the detection results, including information such as the defect type, location, size, and corresponding confidence level.
[0095] Result Analysis and Processing: Analyze and interpret the model's output, and develop appropriate treatment measures based on the defect type and severity. For severe defects, promptly dispatch maintenance personnel to ensure safe pipeline operation. For minor defects, follow-up monitoring is conducted and their development is regularly reviewed. Furthermore, the test results and treatment measures are documented to form a pipeline defect detection report, providing a basis for pipeline maintenance and management.
[0096] Continuous Optimization: During actual application, 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 environments, continuously improving the model's detection performance and reliability, ensuring the safe and stable operation of oil and gas pipelines.
[0097] With this arrangement, the present invention realizes the automation of pipeline defect detection, reducing the subjective errors and labor intensity in the manual detection process. By intelligently assessing the pipeline status, it reduces dependence on professionals and reduces operational risks. Based on the improved YOLOv11 algorithm, it can accurately identify tiny defects in ultrasonic C-scan images of oil pipeline defects, especially in complex background and noisy environments, significantly improving the accuracy of defect detection and reducing the occurrence of missed detections and misjudgments. Through automated defect identification and positioning, the present invention can complete the processing of a large number of ultrasonic C-scan images in a shorter time, greatly improving the detection speed compared to traditional manual detection methods, and providing the possibility for real-time monitoring and early warning of pipelines.
[0098] Specifically, refer to Figure 3 The improvements to the C3K2 component include replacing it with the CSP_PMSFA module. Within the CSP_PMSFA module, the CSP layer ensures feature sharing across different stages. Specifically, the input feature map is passed through multiple convolutional layers to extract features at different scales, and these features are shared across multiple stages. By reducing redundant information and increasing feature reuse, the CSP layer not only optimizes the model's parameter utilization but also enhances its expressiveness and reasoning capabilities.
[0099] On this basis, CSP_PMSFA uses PConv convolutions of different sizes (such as 3×3, 5×5, and 7×7). Each convolution layer adopts 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 computation and improving efficiency. It only applies conventional Conv on a part of the input channels for spatial feature extraction, without processing the remaining channels. For continuous or regular memory access, we consider the first or last continuous c p Channels represent the entire feature map used for calculation, and the input and output feature maps have the same number of channels. Therefore, the FLOPs of PConv are only
[0100]
[0101] Among them, h and w are the height and width of the feature map, k is the size of the convolution kernel, and c p is the number of channels involved in the calculation, usually c p is a fraction of the total number of channels c. In typical fractions Under this condition, the FLOP of PConv is only that of conventional Conv. Since PConv only calculates part of the channels, the memory access is also reduced. The memory access is only 100% of that of ordinary Conv.
[0102]
[0103] After extracting some multi-scale features, the CSP_PMSFA module fuses feature maps from different scales through a 1x1 convolutional layer. This 1x1 convolution not only effectively adjusts the number of channels but also concatenates and fuses features from multiple scales to form a compact and efficient feature representation while preserving key information. Furthermore, the module introduces residual connections, which add the input features to the processed features. The introduction of residual connections helps preserve the original information in the input features, preventing information loss or degradation. Combined with the newly extracted multi-scale features, it enhances the model's expressiveness and learning capabilities. In this way, the module further improves the effect of feature fusion and the overall performance of the model while preserving the original input information.
[0104] Reference Figure 4 The improvement of the SPPF part is specifically to replace the SPPF module with the FPSConv module. In FPSConv, multiple expansion rates (such as 1, 3, and 5) are used to implement multi-scale convolution:
[0105]
[0106] Where d is the dilation rate, x is the input, w is the convolution kernel, and i and j are the positions of the output feature map. Dilated convolutions expand the receptive field, capturing both local details and global information. Low dilation rate convolutions capture detailed information, while high dilation rate convolutions capture broader contextual information.
[0107] To reduce the model's computational and storage overhead, FPSConv uses shared convolutional layers. This means that for different dilation rates, the module does not train a separate convolutional layer for each dilation rate, but instead reuses the same set of convolution kernel parameters. This allows the model to share the same convolution kernel weights, reducing the number of parameters required during training. This improves computational efficiency and model storage efficiency, avoiding the storage of redundant parameters.
[0108] The 1×1 convolutional layers self.cv1 and self.cv2 perform efficient channel resizing and fusion. First, the cv1 layer adjusts the number of input channels, and then the cv2 layer further processes the features fused by multi-scale convolution. The 1×1 convolutional layer converts the number of input channels to a number suitable for subsequent processing. At the same time, it effectively adjusts the channels without increasing computational overhead, preserving 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 those 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 while compressing features. The introduction of FPSConv enables the model to extract multi-scale features through convolutional layers with different expansion rates, improving its ability to capture subtle defects and complex shapes in oil and gas pipelines. This approach effectively addresses the problem of detailed information loss in traditional methods and improves the model's ability to extract features at different scales.
[0112] Reference Figure 5 、 Figure 6The specific improvements to the Neck part are: the Small Object EnhancePyramid (SOEP) structure is proposed. Small target detection often faces certain challenges in the traditional P3, P4, and P5 detection layers. This is because the small target information in the image may be lost during the downsampling process. To compensate for this, traditional methods usually improve the detection ability of small targets by adding a P2 detection layer. However, although directly adding a P2 detection layer can improve the detection effect of small targets to a certain extent, it also brings problems such as a large increase in computational complexity and complex post-processing.
[0113] Unlike traditional methods, SOEP does not directly add a P2 detection layer. Instead, it improves small object detection capabilities through a more efficient approach. First, we use the SPDConv module to enhance information related to small objects and process the features of the P2 detection layer. SPDConv divides the input feature map into four regions and performs a convolution operation on each region, extracting features containing more information about small objects. These enhanced small object features are then fed into the P3 layer for fusion, effectively avoiding the computational burden and post-processing complexity associated with directly adding a P2 layer.
[0114] In order to further optimize the extraction and integration of small target features, we introduced the CSP-OmniKernel module in the P3 detection layer. This module is based on the CSP idea and processes features of different scales through multiple branches. Given an input feature X∈R C×H×W After the features are processed by a 1×1 convolution, three branches are used to process features at different scales to enhance multi-scale representation. The results of the three branches are fused by addition and then adjusted by another 1×1 convolution. Below, we describe the internal components of each branch. CSP-OmniKernel consists of three main branches: local branch, large branch, and global branch.
[0115] In the large branch, we apply depthwise convolutions with kernel size K×K to find a large receptive field. In addition to regular depthwise convolutions, we also employ 1×K and K×1 depthwise convolutions in parallel with square convolutions to harvest contextual information about the stripe shape. To avoid the significant computational overhead introduced by large-scale kernel convolutions, we place the module at the bottleneck. To achieve better performance, we ultimately choose K=31 in the large branch. Since a 31×31 kernel cannot cover the global receptive field, we employ dual-domain processing to add global modeling capabilities to the global branch.
[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 an input feature X Global ∈R C×H×W , DCAM first Global Apply frequency channel attention (FCA) as follows:
[0117]
[0118] in and They are Fast Fourier Transformer and its inverse operation; X FCA 、W 1×1 and GAP represent the outputs of FCA, 1×1 convolutional layer, and global average pooling, respectively; represents element-wise multiplication. The output of FCA is then further processed by the spatial channel attention module (SCA).
[0119]
[0120] Among them, X DCAM is the output of DCAM. Apply frequency attention to the output features of the DCAM module, focusing on strengthening the global frequency information in the features, expressed 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 the large, global branch that captures a large receptive field, we also design a very simple but effective local branch for local signal modulation using a 1×1 deep convolutional layer. The global branch is responsible for capturing the overall context of the image, the large branch processes larger-scale features, and the local branch focuses on extracting local features. This structure enables the network to comprehensively learn features from both global and local perspectives, thereby enhancing the detection of small objects.
[0124] The backbone network extracts feature maps at different scales, from P2 to P5, to capture oil and gas pipeline defect information at varying resolutions. The SPDConv module enhances the detailed features of small-scale defects, helping detect subtle surface damage or flaws. Subsequently, the CSP_PMSFA module and the CSPOMniKernel module enhance defect feature extraction and fusion through cross-stage partial connections and feature attention mechanisms, respectively. Multi-scale convolution operations enhance the learning of global and local defect features, thereby improving the accuracy and robustness of small target pipeline defects.
[0125] In order to systematically evaluate the effectiveness of each module, a series of ablation experiments were conducted. Starting from the baseline model, CSP_PMSFA, FPSConv, and SOEP structures were gradually added to evaluate their respective roles and impact on model performance. See Table 1:
[0126] Table 1 Ablation experiment data
[0127] Baseline CSP_PMSFA FPSConv SOEP Params(M) GFlops(G) mAP0.5(%) mAP0.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 method of training the improved YOLOv11 network model using the training set to obtain an oil and gas pipeline defect detection model and testing the model using the training set includes: using the training instructions provided in the official YOLOv11 source code documentation, executing 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 a separate folder in the project directory, executing the test instructions provided in the official YOLOv11 source code documentation, and generating test results.
[0129] Exemplary devices
[0130] The device embodiments of this application can be used to execute the method embodiments of this application. For details not disclosed in the device embodiments of this application, please refer to the method embodiments of this application.
[0131] Figure 7 FIG. 1 is a block diagram of an oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm provided by an embodiment of the present application. Figure 7 As shown, the device includes:
[0132] The acquisition module 71 is used to collect the ultrasonic C-scan image dataset of oil and gas pipeline defects, preprocess and annotate the dataset, and divide the processed dataset into a training set, a test set, and a validation set;
[0133] Improvement module 72 is used to improve the YOLOv11 network structure model:
[0134] Among them, the improvements of the YOLOv11 network structure model include:
[0135] The C3K2 part of the YOLOv11 network structure model is replaced with the CSP_PMSFA module. The CSP_PMSFA module implements feature sharing between different stages through the CSP layer, and uses PConv convolutions of different sizes to extract features of different scales. Finally, the feature maps are fused through a 1x1 convolution layer and a residual connection is introduced.
[0136] The SPPF part of the YOLOv11 network structure model is replaced by the FPSConv module. The FPSConv module uses convolutions with multiple expansion rates to extract multi-scale features and adopts shared convolution layers to reduce computational and storage overhead.
[0137] Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved, and the small object features are enhanced through the SPDConv module. The CSP-OmniKernel module is introduced in the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches, and global branches for extracting local features, larger-scale features, and global context information.
[0138] The training module 73 is configured to train the improved YOLOv11 network model using the training set to obtain an oil and gas pipeline defect detection model; test the oil and gas pipeline defect detection model using the test set, and if the oil and gas pipeline defect detection model fails the test, retrain the improved YOLOv11 network model;
[0139] The detection module 74 is configured to perform oil and gas pipeline defect detection based on the tested oil and gas pipeline defect detection model.
[0140] In some embodiments, in the CSP_PMSFA module, PConv convolution operates on some channels to reduce the amount of computation.
[0141] In some embodiments, the plurality of expansion ratios include: 1, 3, and 5.
[0142] In some embodiments, the large branch uses a 31×31 depth 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 to capture global context information;
[0144] The local branch uses a 1×1 depth convolution layer to perform local signal modulation.
[0145] Below, reference Figure 8 To describe the electronic device according to the embodiment of the present application. Figure 8 A block diagram of an electronic device according to an embodiment of the present application is illustrated.
[0146] like Figure 8 As shown, electronic device 800 includes one or more processors 810 and memory 820 .
[0147] The processor 810 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 800 to perform desired functions.
[0148] The memory 820 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 810 may execute the program instructions to implement the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm of the various embodiments of the present application described above and / or other desired functions. The computer-readable storage medium may also store various contents such as category correspondences.
[0149] In one example, the electronic device 800 may further include an input device 830 and an output device 840 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0150] In addition, the input device 830 may also include, for example, a keyboard, a mouse, an interface, etc. The output device 840 may output various information to the outside, including analysis results, etc. The output device 840 may include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.
[0151] Of course, to simplify, Figure 8 Only some of the components in the electronic device related to the present application are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, the electronic device may further include any other appropriate components according to specific application scenarios.
[0152] Exemplary computer program products and computer-readable storage media
[0153] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.
[0154] The computer program product may be written in any combination of one or more programming languages to implement the program code for performing the operations of the embodiments of the present application, including object-oriented programming languages such as Java, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0155] In addition, an embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, causes the processor to execute the steps of the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.
[0156] The computer-readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, include but is not limited to a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0157] The above description has been provided for the purpose of illustration and description. Furthermore, this description is not intended 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 variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A method for detecting oil and gas pipeline defects based on an improved YOLOv11 algorithm, characterized in that: include: Collect ultrasonic C-scan image datasets of oil and gas pipeline defects, preprocess and annotate them, and divide the processed datasets into training, test, and validation sets. Improve the YOLOv11 network structure model: Among them, the improvements of the YOLOv11 network structure model include: The C3K2 part of the YOLOv11 network structure model is replaced with the CSP_PMSFA module. The CSP_PMSFA module implements feature sharing between different stages through the CSP layer, and uses PConv convolutions of different sizes to extract features of different scales. Finally, the feature maps are fused through a 1x1 convolution layer and a residual connection is introduced. The SPPF part of the YOLOv11 network structure model is replaced by the FPSConv module. The FPSConv module uses convolutions with multiple expansion rates to extract multi-scale features and adopts shared convolution layers to reduce computational and storage overhead. Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved, and the small object features are enhanced through the SPDConv module. The CSP-OmniKernel module is introduced in the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches, and global branches for extracting local features, larger-scale features, and global context information. The improved YOLOv11 network model is trained using the training set to obtain an oil and gas pipeline defect detection model; The oil and gas pipeline defect detection model is tested using the test set. If it fails the test, the improved YOLOv11 network model is retrained; Oil and gas pipeline defect detection is performed based on the tested oil and gas pipeline defect detection model.
2. The oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to claim 1 is characterized in that: In the CSP_PMSFA module, PConv convolution operates on some channels to reduce the amount of computation.
3. The oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to claim 1 is characterized in that: The multiple expansion ratios include: 1, 3 and 5.
4. The oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to claim 1 is characterized in that: The large branch uses a 31×31 deep convolution kernel to find a large receptive field; The global branch consists of a dual-domain channel attention module and a frequency-based spatial attention module to capture global context information; The local branch uses a 1×1 depth convolution layer to perform local signal modulation.
5. An oil and gas pipeline defect detection device based on an improved YOLOv11 algorithm, characterized in that: include: The acquisition module is used to collect ultrasonic C-scan image datasets of oil and gas pipeline defects, preprocess and annotate the datasets, and divide the processed datasets into training, test, and validation sets; Improvement module, used to improve the YOLOv11 network structure model: Among them, the improvements of the YOLOv11 network structure model include: The C3K2 part of the YOLOv11 network structure model is replaced with the CSP_PMSFA module. The CSP_PMSFA module implements feature sharing between different stages through the CSP layer, and uses PConv convolutions of different sizes to extract features of different scales. Finally, the feature maps are fused through a 1x1 convolution layer and a residual connection is introduced. The SPPF part of the YOLOv11 network structure model is replaced by the FPSConv module. The FPSConv module uses convolutions with multiple expansion rates to extract multi-scale features and adopts shared convolution layers to reduce computational and storage overhead. Based on the Small Object Enhance Pyramid structure, the Neck part of the YOLOv11 network structure model is improved, and the small object features are enhanced through the SPDConv module. The CSP-OmniKernel module is introduced in the P3 detection layer. The CSP-OmniKernel module contains local branches, large branches, and global branches for extracting local features, larger-scale features, and global context information. A training module is used to train the improved YOLOv11 network model using the training set to obtain an oil and gas pipeline defect detection model; test the oil and gas pipeline defect detection model using the test set, and if it fails the test, retrain the improved YOLOv11 network model; The detection module is used to perform oil and gas pipeline defect detection based on a tested oil and gas pipeline defect detection model.
6. The oil and gas pipeline defect detection device based on the improved YOLOv11 algorithm according to claim 5 is characterized in that: In the CSP_PMSFA module, PConv convolution operates on some channels to reduce the amount of computation.
7. The oil and gas pipeline defect detection device based on the improved YOLOv11 algorithm according to claim 5 is characterized in that: The multiple expansion ratios include: 1, 3 and 5.
8. The oil and gas pipeline defect detection device based on the improved YOLOv11 algorithm according to claim 5 is characterized in that: The large branch uses a 31×31 deep convolution kernel to find a large receptive field; The global branch consists of a dual-domain channel attention module and a frequency-based spatial attention module to capture global context information; The local branch uses a 1×1 depth convolution layer to perform local signal modulation.
9. An electronic device, characterized in that: include: A processor, and a memory for storing a program executable by the processor; The processor is configured to implement the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to any one of claims 1 to 4 by running the program in the memory.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, enables the processor to execute the oil and gas pipeline defect detection method based on the improved YOLOv11 algorithm according to any one of claims 1 to 4.
Citation Information
Patent Citations
Industrial product surface defect detection method based on multi-scale weaving fusion network
CN117671354A
Lightweight defect detection method based on mixed multi-scale knowledge distillation
CN118154607A
Submarine pipeline leakage segmentation model construction method and segmentation method
CN118864487A
Method for segmentation of underground drainage pipeline defects based on full convolutional neural network
US20210319265A1