Pipe weld defect detection method based on improved yolo network

By improving the residual structures of YOLO and RepVGG networks, and combining Mosaic image enhancement and weighted cross-entropy loss function, the problems of low efficiency and insufficient accuracy in pipeline weld defect detection are solved, and efficient and accurate weld defect detection is achieved.

CN116468684BActive Publication Date: 2026-03-27SOUTHWEST PETROLEUM UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-12
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing methods for detecting defects in pipeline welds are inefficient and highly susceptible to human factors. Deep learning methods, on the other hand, suffer from decreased detection accuracy when faced with a variety of defects, failing to meet the demands for efficient detection.

Method used

An improved YOLO network was adopted, combined with the residual structure and attention mechanism of the improved RepVGG network, and the Mosaic image enhancement method was used for data preprocessing. The model was trained by weighted cross-entropy function and penalty loss function to solve the problem of imbalance of defect samples in weld images.

Benefits of technology

It improves the accuracy and speed of weld defect detection, especially performing well in weld images with large differences between the background and foreground, effectively solving the dual problem of improving detection accuracy and speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116468684B_ABST
    Figure CN116468684B_ABST
Patent Text Reader

Abstract

The application provides a pipeline weld defect detection method based on an improved yolo, which comprises the following steps: firstly, preprocessing a collected pipeline weld defect image; and constructing an improved yolo network model, wherein the specific implementation method is as follows: two improved residual network structures are used in an up-sampling feature extraction module to perform feature extraction, so that the detection accuracy and the detection speed of the network model are doubled; a regularized cross-entropy loss function is designed to improve the sample imbalance problem; finally, a data training set is used for parameter training of the model, and a test set is used for testing of the trained model. The application effectively improves the pipeline weld defect detection accuracy and the detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of pipeline weld defect detection and deep learning, and particularly relates to a pipeline weld defect detection method based on an improved YOLO network. BACKGROUND

[0002] With the wide application of pipelines in the oil and gas industries, the existing pipeline weld defect recognition method needs to be further improved. Most oil and gas pipelines are welded by straight pipes and bent pipes, and the welds generated are the high-risk parts of pipeline defects. Therefore, the detection of weld defects is an important guarantee for the safe operation of pipelines. The traditional manual evaluation method for pipeline welds is time-consuming and labor-intensive, has low efficiency, and is greatly affected by human subjective factors, and has been unable to meet the increasing needs of pipeline weld defect detection.

[0003] The pipeline weld defect detection method based on deep learning can effectively solve the problems of low efficiency and low detection rate of traditional algorithms. According to the shape and size characteristics of the solder balls, Gaussian mixture model is used to realize the recognition and classification of its defects in “BGA Solder Ball Vision Detection Algorithm and System Design [J]. Optics and Precision Engineering, 2018, Vol. 26 (9): 2190-2197”, but there is a high misjudgment rate and less data samples. In “Anisotropic diffusion based denoising on X-radiography images to detect weld defects [J]. Digital Signal Processing, 2017, Vol. 68: 112-126”, a machine vision method is used to denoise the weld image, and the gradient amplitude is used to enhance the image features, realizing the detection of weld defects, but the method has poor detection effect on weak defect features. In “X-ray weld image information detection based on lightweight YOLO [J]. Journal of Huazhong University of Science and Technology (Natural Science Edition), 2021, 49: 1-5”, a lightweight YOLO algorithm is used to introduce a variety of lightweight technologies to greatly reduce the parameter quantity and calculation quantity of the network model, while ensuring high detection accuracy, speeding up the detection speed, reducing the dependence on high-performance hardware, and realizing accurate recognition of weld X-ray images. However, it can be seen that the existing deep learning method has weak detection ability and low detection efficiency, and the model detection accuracy significantly decreases when facing multiple defects. SUMMARY

[0004] In order to overcome the defects of the existing method, a pipeline weld defect detection method based on improved yolo network is proposed, which effectively solves the shortcomings of traditional deep learning methods and improves the generalization ability and parameter diversity of the model.

[0005] In order to achieve the purpose of the application, the technical scheme provided is a pipeline weld defect detection method based on improved yolo, characterized by comprising the following steps:

[0006] Step 1: Collect oil and gas pipeline weld defect images and preprocess them, the specific processing method is:

[0007] (1) Use the improved version of the Mosaic image enhancement method, Mosaic-8, that is, randomly crop, randomly arrange, and randomly scale 8 images, then combine them into one image, and reasonably introduce some random noise to enhance the network model's ability to distinguish small target samples in the image;

[0008] (2) Adjust the enhanced image to n x n pixel size, n∈Z + ;

[0009] (3) Divide the processed defect images according to the experience of weld defect detection personnel, divide the defect types, and divide the data images into training set and test set;

[0010] Step 2: Construct a pipeline weld defect detection model based on improved yolo, the specific processing method is:

[0011] (1) Construct an improved RepVGG feature extraction network, mainly containing two improved residual structures R1 and R2, the network is composed of R1 and R2 structures connected alternately, the residual structure R1 structure is as follows:

[0012] x1=Conv m×m (x input )

[0013] x2=Conv 1×1 (x1)

[0014]

[0015] In the formula, x input represents the input image of the model, x output represents the output image of the model, Conv m×m is a convolution with size m x m, Conv 1×1 is a convolution with size 1 x 1, is a Concat operation, m∈Z + ;

[0016] The residual structure R2 is structured as follows:

[0017] x1 = Conv m×m (x input )

[0018] x2 = Conv 1×1 (x1)

[0019]

[0020] The operation formula of Concat is as follows:

[0021]

[0022] In the formula, X and Y are input feature maps and X=Y, k represents the channel number of the input feature map X, d is the channel number of the input feature map Y, i∈[1,k] and j∈[1,d];

[0023] (2) After the feature extraction, the operation of the size of 3x3 is divided into two channels, one of which is output as a 13x13 feature map after the convolution block D, wherein the calculation structure of the convolution block D is as follows:

[0024] D1 = Conv 1×1 (D input )

[0025] D output = Conv 3×3 (D1)

[0026] In the formula, D input represents the input image of the model, D output represents the output image of the model, and Conv 3×3 is a convolution operation with the size of 3x3;

[0027] The other channel is up-sampled by the zero-order interpolation method, and the calculation structure is as follows:

[0028]

[0029] In the formula, (s, t) is the floating-point coordinate value of the feature image pixel, (x, y) is the integer coordinate value closest to the floating-point coordinate, s, t∈Q + , x, y∈Z + ;

[0030] After the up-sampling operation, it is divided into two channels, one of which is output as a 26x26 feature map after the convolution block D, and the other channel is output as a 52x52 feature map after the zero-order interpolation method and the convolution D operation; finally, the final detection result is output through the non-maximum suppression algorithm.

[0031] (3) Design a weighted cross-entropy function combined with a penalty function to build a loss function to improve the imbalance of defect samples in the weld image and increase the regularization effect:

[0032] Loss = lambda * Loss BCE + alpha * norm2 2

[0033] Wherein, Loss BCE is a binary cross-entropy loss function, lambda is the ratio of defect and weld area pixels, lambda is in (0, 1), alpha 2 norm2 is a penalty function norm2, alpha is in (0, 1), and omega is in Q;

[0034] Step 3: input the training set into the detection network model constructed in step 2 for training, and select the model with the smallest loss function in the training process as the trained model;

[0035] Step 4: input the test set into the trained parameter model for weld defect detection to obtain the defect detection result.

[0036] The innovation of the present application lies in:

[0037] (1) The weld segmentation method of the present application adopts two kinds of residual structures of improved RepVGG network combined with attention mechanism to realize the double growth of network model detection accuracy and detection speed;

[0038] (2) The defect recognition method of the present application uses a weighted cross-entropy function combined with a penalty term loss function to train the recognition model;

[0039] Advantages:

[0040] (1) The present application studies the performance effect of the deep learning weld defect detection model when facing the weld image with large difference between background and foreground, and adopts two kinds of residual structures of improved RepVGG network combined with attention mechanism, so that the weld defect detection method proposed in the present application realizes the double growth of network model detection accuracy and detection speed when the weld image with large difference between background and foreground is faced;

[0041] (2) The present application uses a weighted cross-entropy function combined with a penalty term loss function, which can effectively solve the problem of imbalance between weld area and background area; BRIEF DESCRIPTION OF DRAWINGS

[0042] Figure 1 is the specific implementation flowchart of the present application, and the residual RepVGG and the improved loss function in the figure are respectively the RepVGG feature extraction network and the loss function constructed in step 2 of the claim;

[0043] Figure 2 is the improved yolo network structure diagram of the pipeline weld defect identification method, and R1 and R2 in the figure are two residual structures R1 and R2 constructed in step 2 of the claim; DETAILED DESCRIPTION

[0044] An improved yolo-based pipeline weld defect detection method, characterized by comprising the following steps:

[0045] Step 1: Collecting oil and gas pipeline weld defect images and performing pretreatment, the specific processing method is:

[0046] (1) Using the improved version of the Mosaic image enhancement method, Mosaic-8, that is, randomly cropping, randomly arranging, and randomly scaling 8 images, then combining them into one image, and reasonably introducing some random noise to enhance the network model's ability to distinguish small target samples in the image;

[0047] (2) Adjust the enhanced image to the size of n x n pixels, n∈Z + ;

[0048] (3) Divide the processed defect images according to the experience of weld defect detection personnel, divide the defect types, and divide the data images into training set and test set;

[0049] Step 2: Constructing an improved yolo-based pipeline weld defect detection model, the specific processing method is:

[0050] (1) Constructing an improved RepVGG feature extraction network, mainly including two improved residual structures R1 and R2, the network is composed of R1 and R2 structures connected alternately, and the residual structure R1 structure is as follows:

[0051] x1=Conv m×m (x input )

[0052] x2=Conv 1×1 (x1)

[0053]

[0054] In the formula, x input represents the input image of the model, x output represents the output image of the model, Conv m×m is a convolution with size m x m, Conv 1×1 is a convolution with size 1 x 1, is a Concat operation, and m∈Z + ;

[0055] The residual structure R2 structure is:

[0056] x1 = Conv m×m (x input )

[0057] x2 = Conv 1×1 (x1)

[0058]

[0059] The operation formula of Concat is as follows:

[0060]

[0061] In the formula, X and Y are input feature maps and X=Y, k represents the channel number of the input feature map X, d is the channel number of the input feature map Y, i∈[1,k] and j∈[1,d];

[0062] (2) After the feature extraction, the operation of the size of 3x3 is divided into two channels, one of which is output as a 13x13 feature map after the convolution block D, wherein the calculation structure of the convolution block D is as follows:

[0063] D1 = Conv 1×1 (D input )

[0064] D output = Conv 3×3 (D1)

[0065] In the formula, D input represents the input image of the model, D output represents the output image of the model, Conv 3×3 is a convolution operation with the size of 3x3;

[0066] The second channel is up-sampled by the zero-order interpolation method, and the calculation structure is as follows:

[0067]

[0068] In the formula, (s, t) is the floating-point coordinate value of the feature image pixel, (x, y) is the nearest integer coordinate value from the floating-point coordinate, s, t∈Q + , x, y∈Z + ;

[0069] After the up-sampling operation, it is divided into two channels, one of which is output as a 26x26 feature map after the convolution block D, and the other channel is output as a 52x52 feature map after the zero-order interpolation method and the convolution D operation; finally, the final detection result is output through the non-maximum suppression algorithm;

[0070] (3) Design a weighted cross-entropy function combined with a penalty function to construct a loss function to improve the imbalance of defect samples in the weld image and increase the regularization effect:

[0071] Loss=λ*Loss BCE +αω 2

[0072] Wherein, Loss BCE is a binary cross-entropy loss function, λ is the ratio of defect and weld area pixels, λ∈(0,1), αω 2 is a penalty function norm 2, α∈(0,1), ω∈Q;

[0073] Step 3: input the training set into the detection network model constructed in step 2 for training, and select the model with the minimum loss function in the training process as the trained model;

[0074] Step 4: input the test set into the trained parameter model for weld defect detection, and obtain the defect detection result.

[0075] The effect of the method for implementing the present application is shown in the following table, which presents the excellent effect of the present application on weld defect detection, as shown in Table 1:

[0076] Table 1 Comparison of experimental results of each model

[0077]

[0078] From Table 1, the weld defect detection accuracy, precision and recall of the model of the present application are 90.20%, 85.47% and 83.31% respectively, which have obvious excellent effect compared with other models.

[0079] In summary, only the better effect of the pipeline weld defect detection scheme recommendation method is used as an example, and is not used to restrict the present application, and any related modification, equivalent replacement and improvement within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method for detecting defects in pipe welds based on an improved YOLO model, characterized in that... Includes the following steps: Step 1: Collect and preprocess images of weld defects in oil and gas pipelines. The specific processing method is as follows: (1) Adopting a modified version of the Mosaic image enhancement method—Mosaic-8, which uses 8 images to be randomly cropped, randomly arranged, and randomly scaled, and then combined into one image. At the same time, some random noise is reasonably introduced to enhance the network model's ability to distinguish small target samples in the image. (2) Adjust the enhanced image to an n×n pixel size, where n∈Z + ; (3) The processed defect images are classified into defect types according to the experience of weld defect detection personnel, and the data images are divided into training set and test set; Step 2: Construct a pipeline weld defect detection model based on an improved YOLO framework. The specific processing method is as follows: (1) Construct an improved RepVGG feature extraction network, which mainly consists of two improved residual structures R1 and R2. The network is composed of alternating connections of the two structures R1 and R2. The structure of residual structure R1 is as follows: x1=Conv m×m (x input ) x2=Conv 1×1 (x1) In the formula, x input The input image representing the model, x output The output image of the representative model, Conv m×m For a convolution of size m×m, Conv 1×1 For a convolution of size 1×1, For the Concat operation, m∈Z + ; The residual structure R2 is as follows: x1=Conv m×m (x input ) x2=Conv 1×1 (x1) The formula for using Concat is as follows: In the formula, X and Y are both input feature maps and X = Y, k represents the number of channels of input feature map X, d is the number of channels of input feature map Y, i∈[1,k], j∈[1,d]; (2) After feature extraction, the feature map is divided into two channels by a 3×3 convolution operation. One channel outputs a 13-pixel × 13-pixel feature map through convolution block D. The calculation structure of convolution block D is as follows: D1=Conv 1×1 (D input ) D output =Conv 3×3 (D1) In the formula, D input The input image representing the model, D output The output image of the representative model, Conv 3×3 This is a convolution operation with a size of 3×3; The second channel undergoes upsampling using zero-order interpolation, and its calculation structure is as follows: In the formula, (s,t) represents the floating-point coordinates of the feature map pixels, (x,y) represents the integer coordinates closest to the floating-point coordinates, and s,t∈Q + x,y∈Z + ; After upsampling, the data is divided into two channels. One channel outputs a 26-pixel × 26-pixel feature map after passing through convolutional block D. The other channel outputs a 52-pixel × 52-pixel feature map after passing through zero-order interpolation and convolutional D. Finally, the detection result is output through non-maximum suppression algorithm. (3) A weighted cross-entropy function combined with a penalty function is designed to construct a loss function, in order to improve the imbalance of defect samples in weld images and enhance the regularization effect: Loss=λ*Loss BCE +oh 2 Among them, Loss BCE Let be the binary cross-entropy loss function, λ be the ratio of pixels in the defect to pixels in the weld region, λ∈(0,1), and αω 2 Let the penalty function be norm 2, α∈(0,1), ω∈Q; Step 3: Input the training set into the detection network model built in Step 2 for training. Select the model with the smallest loss function during the training process. Step 4: Input the test set into the trained parameter model to detect weld defects and obtain the defect detection results.

Citation Information

Patent Citations

  • Welding seam image defect detection method

    CN113496480A

  • Weld defect detection method based on improved YOLOX

    CN114240821A