Method for detecting defects in small diameter tube welding based on shape position perception and balanced sampling
By introducing a shape-position-aware fusion attention module and a weighted feature pyramid network into the detection of welding defects in small-diameter pipes, and combining it with a multi-scale target equalization sampling strategy, the problems of incomplete feature extraction and imbalanced positive samples in the detection of welding defects in small-diameter pipes are solved, and a more efficient defect detection effect is achieved.
Patent Information
- Application Number
- CN202310687369.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-06-12
AI Technical Summary
Existing methods for detecting welding defects in small-diameter pipes fail to consider the shape information and positional correlation of defects during feature extraction, resulting in low detection accuracy. Small-scale defect features are easily lost, and the number of positive samples is unbalanced, affecting the model's detection performance for small-scale targets.
We employ a shape-position-aware fusion attention module to enhance feature extraction. By combining a weighted feature pyramid network and a multi-scale target balanced sampling strategy, we enhance the correlation between global defect features and shape information through the fusion attention module, adjust the feature fusion weights using the weighted feature pyramid network, and balance the number of positive samples using the multi-scale target balanced sampling strategy.
It improves the accuracy and consistency of welding defect detection for small-diameter pipes, enhances the ability to represent small-scale defects, ensures balanced detection performance for targets of different scales, and improves the overall performance of the detection model.
Smart Images

Figure CN116721080B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of welding defect detection technology, specifically a method for detecting welding defects in small-diameter pipes based on shape and position perception and balanced sampling. Background Technology
[0002] For the inspection of welding defects in small-diameter pipes, non-destructive testing (NDT) techniques are typically employed. Common NDT methods include ultrasonic testing and X-ray inspection. Ultrasonic testing determines the presence of internal defects by utilizing the different propagation characteristics of sound waves in different materials. X-ray inspection, on the other hand, identifies defects in the weld area by performing target detection on weld images acquired by a specialized imaging system. However, due to the typically small radius of curvature and wall thickness of small-diameter pipes, ultrasonic testing is often ineffective. Therefore, in industrial production, X-ray inspection is predominantly used for detecting welding defects in small-diameter pipes.
[0003] The maturity of computer vision processing technology has greatly aided welding defect detection. The process involves preprocessing digitized X-ray images, then manually extracting defect features using computer vision technology, and finally feeding these manually extracted features into a classifier for defect detection. While this method offers significant advantages over manual image evaluation, it still requires human assistance. Furthermore, welding defects are diverse in type, size, and shape, and their location information is complex, making manual defect extraction inefficient and unable to achieve fully automated defect detection. With the rapid development of deep learning, welding defect detection tasks can be handled using deep learning methods. Deep learning eliminates the need for manually designing defect features or complex intermediate steps required by traditional machine learning methods. Instead, it directly feeds the preprocessed images into a convolutional network for training. The convolutional network automatically extracts defect features and classifies and locates defects, greatly improving efficiency.
[0004] For deep learning-based detection of welding defects in small-diameter pipes, existing detection models still have the following problems: 1) Detection of welding defects in small-diameter pipes is a specific domain-specific task. Different types of defects have significantly different shapes, and some defects have a wide extension area and are mostly small-scale. During feature extraction, if the shape information of the defect and the correlation between different positions of the same defect feature are not considered, the same defect feature may be segmented into several parts, thus affecting the detection accuracy; 2) As the network deepens, after continuous downsampling, the features of small-scale defects in the deep feature map may be lost or even completely disappear, causing inconsistencies between feature maps at different levels, resulting in poor expressive power of small-scale defects; 3) In target detection tasks, the maximum IoU sampling strategy is usually adopted, which leads to most of the selected positive samples being for large-scale targets, while there are fewer positive samples for small-scale targets. This results in an imbalance in the number of positive samples for targets of different scales in the same image, making the model's detection performance for small-scale targets poor.
[0005] To address the aforementioned problems, this invention proposes a method for detecting welding defects in small-diameter pipes based on shape and position perception and balanced application. Summary of the Invention
[0006] To address the shortcomings of existing technologies, the technical problem this invention aims to solve is to provide a method for detecting welding defects in small-diameter pipes based on shape and position perception and balanced sampling.
[0007] The technical solution adopted by the present invention to solve the aforementioned technical problem is as follows:
[0008] A method for detecting welding defects in small-diameter pipes based on shape position awareness and balanced sampling, characterized in that the method includes the following steps:
[0009] Step 1: Obtain welding images of small-diameter pipes;
[0010] The second step involves constructing a defect detection model. This model utilizes the ResNeXt101 network to extract features from small-diameter pipe welding images. A shape- and position-aware fusion attention module is embedded between adjacent convolutional stages of the ResNeXt101 network to enhance its attention to global defect features and shape information. This shape- and position-aware fusion attention module is divided into two branches: position information awareness and shape information awareness. In the position information awareness branch, a 3×3 convolution operation is performed on the input feature map X to obtain feature maps X1, X2, and X3. Feature map X1 is reconstructed and transposed to obtain feature map M1, and feature maps X2 and X3 are reconstructed to obtain feature maps M2 and M3, respectively. Feature maps M1 and M2 are multiplied and then normalized to obtain the position information. The input feature map S is multiplied by the location-associated feature map S to obtain feature map S'. After reconstruction, feature map S' is added to the input feature map X to obtain location-aware feature map Y1. In the shape-aware branch, the input feature map X is max-pooled and average-pooled in the channel dimension to obtain feature maps Z1 and Z2. Feature maps Z1 and Z2 are concatenated in the channel dimension and passed through a fully connected layer, and then segmented in the channel dimension to obtain feature maps Z1' and Z2'. Feature maps Z1' and Z2' are added element-wise and then activated to obtain feature map K. Feature map K is multiplied by the input feature map X to obtain shape-aware feature map Y2. Finally, location-aware feature map Y1 and shape-aware feature map Y2 are added to obtain the output feature map of the shape and location-aware fusion attention module.
[0011] The feature maps C2-C5 output from the second to fifth convolutional stages of the ResNeXt101 network are input into the weighted feature pyramid network to obtain fused weighted feature maps H3-H5. Feature maps C2-C5 are then fused with the fused weighted feature maps H3-H5 to obtain feature maps P2-P5. Feature maps P2-P5 are input into the region generation network for the first prediction to obtain candidate boxes. The candidate boxes undergo balanced sampling of positive and negative samples in the detection head module and are then used for a second prediction to obtain the defect category and location information.
[0012] The third step is to train the defect detection model using the sample set generated by the detection head module, and then use the trained defect detection model for small-diameter pipe welding defect detection.
[0013] Furthermore, the weighted feature pyramid network includes a fusion weight calculation module and a feature fusion module; in the fusion weight calculation module, feature map C i+1 After upsampling, it is compared with feature map C iThe concatenated feature maps are then subjected to a 3×3 convolution operation, followed by downsampling to obtain the fused weighted feature map H. i+1 i = 2, 3, 4;
[0014] Feature maps C2-C5 and fusion weight feature maps H3-H5 are fused in the feature fusion module. Feature map C5 is input into the feature fusion module to obtain feature map P5. Feature map P5 is multiplied by H5, upsampled, and then added to feature map P4 after a 1×1 convolution operation. Feature map P4 is multiplied by H4, upsampled, and then added to feature map P3 after a 1×1 convolution operation. Feature map P3 is multiplied by H3, upsampled, and then added to feature map P2 after a 1×1 convolution operation.
[0015] Furthermore, all candidate boxes are marked as negative samples, and the intersection-union ratio (IU) between each candidate box and the ground truth box is calculated. All ground truth boxes are traversed, and multiple candidate boxes with high IU rankings are selected from the candidate box set corresponding to the ground truth boxes as positive samples of that ground truth box. Positive samples with IU ratios less than the positive sample screening threshold are set as ignored samples, and negative samples with IU ratios greater than the negative sample screening threshold are set as ignored samples. All remaining positive and negative samples form a sample set to complete the balanced sampling of positive and negative samples.
[0016] Compared with the prior art, the beneficial effects of the present invention are:
[0017] 1. For welding defects with a wide extension area, existing feature extraction processes may segment the wide-extended defect into several parts due to a lack of attention to the global features of the defect, thus affecting the accuracy of detection. To address this issue, this invention proposes a fused attention based shape and position perception (FASP) module. When extracting features in the backbone network, the FASP module uses weighted summation of features at all positions in the feature map, enhancing the correlation between different positional information of a single defect feature, better preserving the global feature information of the defect, and integrating features from all channels to enhance the shape information of the defect, ensuring the integrity of feature extraction for such defects with a wide extension area.
[0018] 2. The Weighted Feature Pyramid Network (WFPN) of this invention adds a fusion weight calculation module to the traditional feature pyramid network to obtain the fusion weights between adjacent feature maps. Conventional feature pyramids directly upsample deep feature maps and then add them to shallow feature maps. Since small-diameter pipe welding defects are mostly small-scale defects, and these small-scale defects may experience feature loss or even complete disappearance in deep feature maps as the number of downsampling times increases during feature extraction in the backbone network, this can lead to the loss of defect information in deep feature maps interfering with information in the same area of shallow feature maps during feature fusion, increasing the training difficulty of the model. However, by using fusion weights, the weights of deep feature maps can be flexibly adjusted during feature fusion, thereby solving the feature inconsistency problem caused by the loss of small-area target defect feature information in deep feature maps. When the target features of a certain region are preserved relatively completely, the weight of this region is close to 1. In this case, the feature fusion of this region is equivalent to ordinary FPN feature fusion. If some regions in the deep feature map have lost feature information, the weight of these regions will be reduced, which effectively reduces the interference of inconsistent features in some regions of the feature map on training and reduces the difficulty of model training.
[0019] 3. Positive and negative sample sampling is a crucial step in object detection tasks. The maximum IoU sampling strategy is commonly used, ensuring that each ground truth bounding box has a corresponding candidate bounding box. However, this strategy has an unavoidable problem: when large targets (weld beads, strip-shaped foreign objects, etc.) coexist with small targets (circular defects, circular foreign objects, linear defects, etc.) in an image, the larger target, due to its size, receives more candidate bounding boxes as positive samples; while the smaller target, due to its smaller size, receives only a few candidate bounding boxes. This results in an imbalance in the number of positive samples across different scales within the same image, leading to poor model performance in detecting small-scale defects. To address this issue, this invention proposes a multi-scale target balanced sampling (MTBS) strategy. This strategy first selects the same number of positive samples for all targets, then performs a secondary screening based on a threshold to filter out high-quality negative samples and low-quality positive samples. This multi-scale target balanced sampling strategy ensures a relatively balanced number of positive samples across different scales of targets. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of the defect detection model of the present invention;
[0021] Figure 2 This is a schematic diagram of the FASP module of the present invention;
[0022] Figure 3 This is a schematic diagram of the location information sensing branch in the FASP module of the present invention;
[0023] Figure 4 This is a schematic diagram of the shape information sensing branch in the FASP module of the present invention;
[0024] Figure 5 This is a schematic diagram of the WFPN network structure of the present invention;
[0025] Figure 6(a) is a schematic diagram of the fusion weight calculation module in the WFPN network of the present invention;
[0026] Figure 6(b) is a flowchart of the fusion weight calculation module in the WFPN network of the present invention;
[0027] Figure 7 This is a schematic diagram of the positive and negative sample allocation results in the detection head module of the present invention;
[0028] Figure 8(a) shows the results of detecting incomplete penetration defects using the baseline model and the detection model composed of the baseline model and the FASP module of the present invention.
[0029] Figure 8(b) shows the results of detecting non-fusion defects using the baseline model and the detection model composed of the baseline model and the FASP module of the present invention.
[0030] Figure 9(a) shows the results of detecting circular defects using the baseline model and the detection model composed of the baseline model and the WFPN network of the present invention.
[0031] Figure 9(b) shows the results of detecting circular foreign objects using the baseline model and the detection model composed of the baseline model and the WFPN network of the present invention.
[0032] Figure 10(a) shows the results of detecting weld bead defects using the baseline model and the detection model composed of the baseline model and the MTBS strategy of the present invention.
[0033] Figure 10(b) shows the results of detecting incomplete penetration defects using the baseline model and the detection model composed of the baseline model and the MTBS strategy of the present invention.
[0034] Figure 11(a) shows the results of detecting strip-shaped foreign objects using the baseline model and the defect detection model of the present invention;
[0035] Figure 11(b) shows the results of detecting weld bead defects using the baseline model and the defect detection model of the present invention. Detailed Implementation
[0036] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments, but this is not intended to limit the scope of protection of this application.
[0037] This invention relates to a method for detecting welding defects in small-diameter pipes based on shape position perception and balanced sampling (hereinafter referred to as the method), comprising the following steps:
[0038] Step 1: Obtain welding images of small-diameter pipes labeled with OBB (Oriented Bounding Boxes) and construct a dataset;
[0039] The second step is to build a defect detection model based on deep learning networks.
[0040] like Figure 1 As shown, the defect detection model has a two-stage network structure. The first stage includes a ResNeXt101 network, a weighted feature pyramid network, and a region generation network (RPN); the second stage includes a detection head module. The first stage uses the ResNeXt101 network as the backbone network to extract features from small-diameter pipe welding images. During feature extraction, a shape- and position-aware fusion attention module enhances the backbone network's focus on global defect features and shape information, improving the expressive power of defect features. The feature maps C2-C5 output from the second to fifth convolutional stages are input into the weighted feature pyramid network to obtain fused weighted feature maps H3-H5. Feature maps C2-C5 are then fused with the fused weighted feature maps H3-H5 to obtain feature maps P2-P5. Feature maps P2-P5 are input into the region generation network for the first prediction, obtaining candidate boxes that may contain the target. The candidate boxes are then input into the detection head module in the second stage. The detection head module uses a multi-scale target equalization sampling strategy to allocate positive and negative samples and performs a second prediction to obtain the defect category and location information.
[0041] The ResNeXt101 network consists of five convolutional stages, Conv1 to Conv5, and the detailed structure is shown in Table 1. A FASP module is embedded between two adjacent convolutional stages in the ResNeXt101 network.
[0042] Table 1 ResNeXt101 Network Structure
[0043]
[0044]
[0045] like Figure 2As shown, when using the ResNeXt101 network to extract features, the FASP module enhances features from two aspects: position information perception and shape information perception. That is, the FASP module includes two branches: position information perception and shape information perception. The input feature map of the FASP module is processed by the position information perception branch and the shape information perception branch respectively to obtain the position information perception feature map Y1 and the shape information perception feature map Y2. Then, the position information perception feature map Y1 and the shape information perception feature map Y2 are added together to obtain the output feature map Y of the FASP module.
[0046] like Figure 3 As shown, in the location information perception branch, the input feature map X is first subjected to a 3×3 convolution operation using Equation (1) to obtain feature maps X1, X2 and X3. The size of these three feature maps is the same as that of the input feature map, which is C×H×W, where C, H and W are the number of channels, height and width, respectively.
[0047] X i =T conv3 (X), i = 1, 2, 3 (1)
[0048] Among them, T conv3 This represents a convolution operation of size 3×3;
[0049] Then, feature map X1 is reshaped and transposed to obtain feature map M1, and feature maps X2 and X3 are reshaped to obtain feature maps M2 and M3, respectively. The size of feature map M1 is N×C, and the size of feature maps M2 and M3 is C×N, where N = H×W. Feature maps M1 and M2 are multiplied and then normalized to obtain a position-related feature map S of size N×N. The values of each position in position-related feature map S are:
[0050]
[0051] Among them, s jk This represents the k-th position in feature map M1. For the j-th position in feature map M2 The impact;
[0052] Finally, feature map M3 is multiplied with location-related feature map S to obtain feature map S'; feature map S' is reconstructed to a size of C×H×W, and then added to input feature map X to obtain location information perception feature map Y1, which is the output feature map of the location information perception branch.
[0053]
[0054] like Figure 4As shown, in the shape information perception branch, the input feature map X is first subjected to max pooling and average pooling in the channel dimension using equations (4) and (5) to obtain feature maps Z1 and Z2.
[0055] Z1 = Maxpool(X) (4)
[0056] Z2=Avgpool(X) (5)
[0057] Where Maxpool and Avgpool represent the max pooling operation and the average pooling operation, respectively;
[0058] Then, feature maps Z1 and Z2 are concatenated along the channel dimension. The concatenated feature maps are then passed through a fully connected layer and further segmented along the channel dimension to obtain feature maps Z1' and Z2'.
[0059] Z′ i =W([Z1,Z2])+b,i=1,2 (6)
[0060] Where [] represents splicing, and W and b represent the parameters of the fully connected layer;
[0061] Finally, feature maps Z1' and Z2' are added element-wise and then activated to obtain feature map K; feature map K is then multiplied with input feature map X to obtain shape information perception feature map Y2, which is the output feature map of the shape information perception branch.
[0062] Y2=softmax(Z1'+Z2')·X (7)
[0063] In the formula, softmax represents the activation operation.
[0064] like Figure 5 As shown, the weighted feature pyramid network includes a fusion weight calculation module (FWM) and a feature fusion module (WFFM). The output feature maps C2-C5 from the second to fifth convolutional stages of the ResNeXt101 network are input into the fusion weight calculation module to obtain fusion weight feature maps H3-H5; as shown in Figures 6(a) and (b), in the fusion weight calculation module, feature map C... i+1 First, the size is increased by upsampling, and then compared with the feature map C. i After concatenation, a 3×3 convolution operation is performed to obtain a feature map with 1 channel. This feature map is then downsampled to obtain a feature map C. i Fusion weight feature map H with consistent size i+1 During convolution, sigmoid is used as the activation function to ensure that the resulting fusion weights are between 0 and 1, so that feature fusion can be performed subsequently based on these weights. The expression for the fusion weight calculation module is as follows:
[0065] H i+1 =D(T) conv3 ([U(C i+1 ),C i ]),i=2,3,4 (8)
[0066] Where U represents upsampling operation and D represents downsampling operation;
[0067] Feature maps C2-C5 and fusion weight feature maps H3-H5 are input into the feature fusion module for feature fusion. Feature map C5 input into the feature fusion module becomes feature map P5. Feature map P5 is multiplied by H5, upsampled, and then added to feature map C4 after a 1×1 convolution operation to obtain feature map P4. Feature map P4 is multiplied by H4, upsampled, and then added to feature map C3 after a 1×1 convolution operation to obtain feature map P3. Feature map P3 is multiplied by H3, upsampled, and then added to feature map C2 after a 1×1 convolution operation to obtain feature map P2. The expression of the feature fusion module is:
[0068] P i =U(P i+1 ·H i+1 )+T conv1 (C i ), i = 2, 3, 4 (9)
[0069] Feature maps P2 to P5 are the output feature maps of the weighted feature pyramid network. The feature maps P2 to P5 are input into the Region Generation Network (RPN) for the first prediction to generate candidate boxes.
[0070] Candidate boxes obtained from the region generation network are fed into the detection head module. The detection head module employs a multi-scale target equalization sampling strategy to allocate positive and negative samples, ensuring a balance in the number of positive samples at different scales within the same input image. Simultaneously, it uses the detection head of the Dynamic R-CNN model for a second prediction to obtain the defect category and location information. The detection head module first calculates the Intersection over Union (IoU) between each candidate box and the ground truth box, marking all candidate boxes as negative samples. Then, it iterates through all ground truth boxes, selecting multiple candidate boxes with high IoU rankings from the candidate box set corresponding to each ground truth box as positive samples for that ground truth box. Positive samples with IoU below a positive sample selection threshold are ignored. Similarly, negative samples with IoU above a negative sample selection threshold are ignored. The remaining positive and negative samples form the training sample set, completing the positive and negative sample allocation. See [link to documentation]. Figure 7 .
[0071] The third step is to train the defect detection model using the sample set and then use the trained defect detection model for small-diameter pipe welding defect detection.
[0072] Example 1
[0073] To verify the effectiveness of the defect detection model of this invention, an experimental dataset was used for testing. The Dynamic R-CNN model was selected as the baseline model, which is an improved version of Faster R-CNN with improved sample allocation strategy and loss function. Figures 8(a) and (b) show the test results of the baseline model and the detection model composed of the baseline model and the FASP module of this invention for detecting incomplete penetration and lack of fusion defects, respectively. As can be seen from the figures, for incomplete penetration defects, although the baseline model can detect the defect, the detection location is not very accurate, and there are false detections, misidentifying incomplete penetration defects as strip-shaped foreign objects. For lack of fusion defects, the baseline model does not correctly detect the defect, instead detecting it as a circular defect and a circular foreign object. However, the detection model composed of the baseline model and the FASP module of this invention can correctly detect both incomplete penetration and lack of fusion defects, and achieves a higher classification score, thus verifying the effectiveness of the FASP module of this invention.
[0074] Figures 9(a) and (b) show the test results of the baseline model and the detection model composed of the baseline model and the WFPN network of this invention, respectively, for detecting two types of small-scale defects: circular defects and circular foreign objects. As can be seen from the figures, the baseline model exhibits both false positives and false negatives for these two types of defects. This is because, using the traditional FPN feature pyramid network, the lost feature information in the deep feature maps interferes with the feature extraction of the shallow feature maps, leading to false negatives and false negatives during detection. In contrast, the detection model composed of the baseline model and the WFPN network of this invention can accurately detect both types of defects. The WFPN network, through weight fusion, can effectively suppress the interference of small-scale defect features lost in the deep feature maps on the shallow feature maps, better preserving the feature information of small-scale defects and improving the representation ability of small-scale defect features. This verifies the effectiveness of the WFPN network in detecting small-scale defects.
[0075] Figures 10(a) and (b) show the test results of the baseline model and the detection model composed of the baseline model and the MTBS strategy of the present invention, respectively, when detecting defects with large scale differences in the input image. Figure 10(a) shows a weld bead with a circular defect, and Figure 10(b) shows two incomplete weld defects. As can be seen from the figures, the baseline model can correctly detect large-scale defects when detecting such images, but it will miss small-scale defects. The detection model composed of the baseline model and the MTBS strategy of the present invention can accurately detect defects of different scales in the image. This is because the MTBS strategy assigns a certain number of positive samples to each ground truth bounding box for matching and participation in model training, which can ensure that the model can accurately detect defects of different scales.
[0076] Figures 11(a) to (b) show the test results of the baseline model and the defect detection model of the present invention for detecting two types of defects: strip-shaped foreign objects and weld beads, respectively. As can be seen from the figures, the baseline model misses some weld bead defects, while the defect detection model of the present invention can correctly detect the defects in the image, and the location and score are relatively high.
[0077] Ablation experiments were conducted on the FASP module, WFPN network, and MTBS strategy compared to the baseline model. The test results are shown in Table 2.
[0078] Table 2 Test results (%) of each module combined with the baseline model
[0079]
[0080] The test results above show that the baseline model suffers from severe false negatives. The defect detection model of this invention first adds a shape- and position-aware fusion attention module to the backbone network. Then, it improves the FPN network and positive / negative sample allocation strategy in the Dynamic R-CNN model, proposing a WFPN network and an MTBS strategy. Compared to individual modules, the MTBS strategy shows the best improvement in recall, while the WFPN network shows the best improvement in precision, exceeding the baseline model by 4.4% and 3.8%, respectively. When the three improvements are combined in pairs into the baseline model, the model's detection performance is further enhanced. The combination of the FASP module and the MTBS strategy provides the greatest improvement in detection performance, achieving an mAP of 78.3%, which is 4.5% higher than the baseline model and 1.6% higher than the best result of a single improvement. The recall reaches 86.1%, which is 5.3% higher than the baseline model and 0.9% higher than the best result of a single improvement. When all three modules are added to the baseline model, the model achieves the best detection performance, with an mAP of 78.7%.
[0081] Any aspects not covered in this invention are applicable to existing technologies.
Claims
1. A method for detecting welding defects in small-diameter pipes based on shape position perception and balanced sampling, characterized in that, The method includes the following steps: Step 1: Obtain welding images of small-diameter pipes; The second step involves constructing a defect detection model. This model utilizes the ResNeXt101 network to extract features from small-diameter pipe welding images. A shape- and position-aware fusion attention module is embedded between adjacent convolutional stages of the ResNeXt101 network to enhance its attention to global defect features and shape information. This shape- and position-aware fusion attention module is divided into two branches: position information awareness and shape information awareness. In the position information awareness branch, a 3×3 convolution operation is performed on the input feature map X to obtain feature maps X1, X2, and X3. Feature map X1 is reconstructed and transposed to obtain feature map M1, and feature maps X2 and X3 are reconstructed to obtain feature maps M2 and M3, respectively. Feature maps M1 and M2 are multiplied and then normalized to obtain the position information. The input feature map S is multiplied by the location-associated feature map S to obtain feature map S'. After reconstruction, feature map S' is added to the input feature map X to obtain location-aware feature map Y1. In the shape-aware branch, the input feature map X is max-pooled and average-pooled in the channel dimension to obtain feature maps Z1 and Z2. Feature maps Z1 and Z2 are concatenated in the channel dimension and passed through a fully connected layer, and then segmented in the channel dimension to obtain feature maps Z1' and Z2'. Feature maps Z1' and Z2' are added element-wise and then activated to obtain feature map K. Feature map K is multiplied by the input feature map X to obtain shape-aware feature map Y2. Finally, location-aware feature map Y1 and shape-aware feature map Y2 are added to obtain the output feature map of the shape and location-aware fusion attention module. The feature maps C2-C5 output from the second to fifth convolutional stages of the ResNeXt101 network are input into the weighted feature pyramid network to obtain fused weighted feature maps H3-H5. Feature maps C2-C5 are then fused with the fused weighted feature maps H3-H5 to obtain feature maps P2-P5. Feature maps P2-P5 are input into the region generation network for the first prediction to obtain candidate boxes. The candidate boxes undergo balanced sampling of positive and negative samples in the detection head module and are then used for a second prediction to obtain the defect category and location information. The third step is to train the defect detection model using the sample set generated by the detection head module, and then use the trained defect detection model for small-diameter pipe welding defect detection.
2. The method for detecting welding defects in small-diameter pipes based on shape position perception and balanced sampling according to claim 1, characterized in that, The weighted feature pyramid network includes a fusion weight calculation module and a feature fusion module; In the fusion weight calculation module, feature map C i+1 After upsampling, it is compared with feature map C i The concatenated feature maps are then subjected to a 3×3 convolution operation, followed by downsampling to obtain the fused weighted feature map H. i+1 i = 2, 3, 4; Feature maps C2-C5 and fusion weight feature maps H3-H5 are fused in the feature fusion module. Feature map C5 is input into the feature fusion module to obtain feature map P5. Feature map P5 is multiplied by H5, upsampled, and then added to feature map P4 after a 1×1 convolution operation. Feature map P4 is multiplied by H4, upsampled, and then added to feature map P3 after a 1×1 convolution operation. Feature map P3 is multiplied by H3, upsampled, and then added to feature map P2 after a 1×1 convolution operation.
3. The method for detecting welding defects in small-diameter pipes based on shape position perception and balanced sampling according to claim 1 or 2, characterized in that, All candidate boxes are marked as negative samples. At the same time, the intersection-union ratio (IU) of each candidate box and the ground truth box is calculated. All ground truth boxes are traversed, and multiple candidate boxes with high IU rankings are selected from the candidate box set corresponding to the ground truth boxes as positive samples of the ground truth boxes. Positive samples with IU ratios less than the positive sample screening threshold are set as ignored samples, and negative samples with IU ratios greater than the negative sample screening threshold are set as ignored samples. All remaining positive and negative samples form a sample set to complete the balanced sampling of positive and negative samples.
Citation Information
Patent Citations
Ridgelet bi-frame system-based SAR image airfield runway extraction method
CN101777181A
Mura defect detection method based on sample learning and human visual characteristics
CN106650770A