A welding seam defect detection method based on adaptive dynamic alignment fusion
Patent Information
- Application Number
- CN202611054446.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-09-18
AI Technical Summary
由于不同来源特征在通道维度、语义信息和空间细节响应方面存在差异,直接融合可能引入背景纹理、金属反光等冗余信息,影响小尺度缺陷和弱边缘缺陷的检测稳定性
通过在焊缝缺陷检测网络的特征融合节点中采用自适应动态对齐融合模块,使两个待融合特征在融合前完成通道对齐,降低不同来源特征之间的通道差异。
Smart Images

Figure CN122780271A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of industrial visual inspection, weld quality inspection, and target detection network technology, specifically to a weld defect detection method based on adaptive dynamic alignment fusion, which can be used for the automatic detection of targets such as cracks, porosity, spatter, and weld areas in weld images. Background Technology
[0002] Weld defect detection is a crucial aspect of welding quality control. During welding, defects such as cracks, porosity, spatter, slag inclusions, and incomplete penetration may occur. If these defects are not detected promptly, they can affect the structural strength and service safety of welded components. Therefore, accurate location and identification of defect areas in weld images is of paramount importance.
[0003] Among existing weld defect detection methods, manual visual inspection and traditional image processing methods still have certain limitations. Manual visual inspection relies on the experience of the inspectors, and it is difficult to guarantee detection efficiency and consistency. Traditional image processing methods usually require setting thresholds or rules based on features such as grayscale, edges, and textures. When the weld surface has complex textures, uneven lighting, obvious metal reflection, or large differences in defect morphology, it is easy to miss or misdetect.
[0004] In recent years, deep learning-based target detection networks have been increasingly applied to weld defect detection tasks. These methods can automatically extract image features through neural networks and output the category and location information of the defect target. Target detection networks, represented by the YOLO series, feature high detection speed and end-to-end output, making them suitable for industrial vision inspection scenarios.
[0005] However, weld defects typically exhibit characteristics such as large scale variations, weak edges, irregular shapes, and strong background interference. Existing detection networks often employ direct stitching or simple weighting methods to fuse features from different levels and paths when performing multi-scale feature fusion. Because features from different sources differ in channel dimension, semantic information, and spatial detail response, direct fusion may introduce redundant information such as background texture and metallic reflection, affecting the detection stability of small-scale and weak-edge defects.
[0006] Therefore, it is necessary to provide a weld defect detection method that improves the channel alignment and adaptive fusion capabilities between features from different sources in the feature fusion nodes of the target detection network, thereby enhancing the stability and applicability of weld defect detection. Summary of the Invention
[0007] The purpose of this invention is to provide a weld defect detection method based on adaptive dynamic alignment and fusion, so as to improve the alignment and fusion capability between features from different sources during the weld defect detection process and reduce the interference of complex weld background on defect features.
[0008] To achieve the above objectives, this invention provides a weld defect detection method based on adaptive dynamic alignment fusion. The method includes: inputting a weld image to be detected; preprocessing the weld image; inputting the preprocessed weld image into a weld defect detection network; extracting multi-layer weld image features through the weld defect detection network; constructing a multi-scale feature transfer path based on the multi-layer weld image features; in the feature fusion node of the multi-scale feature transfer path, using an adaptive dynamic alignment fusion module to fuse two features to be fused; forming multi-scale detection features based on the fused features output by the adaptive dynamic alignment fusion module; and outputting weld defect detection results based on the multi-scale detection features.
[0009] The weld defect detection network includes a backbone network, a neck network, and a detection head. The backbone network is used to extract multi-layer weld image features, the neck network is used to construct multi-scale feature transfer paths and perform feature fusion, and the detection head is used to output weld defect detection results.
[0010] The adaptive dynamic alignment and fusion module includes a channel alignment unit, a channel splicing unit, a dynamic weight generation unit, a weight splitting unit, a branch weighting unit, a learnable parameter fusion unit, and an output convolution unit. The adaptive dynamic alignment and fusion module is used to sequentially perform channel alignment, channel splicing, dynamic weight generation, weight splitting, branch weighting, and learnable parameter fusion on two features to be fused, and output the fused features through a 1×1 convolution.
[0011] In one embodiment, the weld defect detection network adopts a YOLO-ADA structure, which is based on YOLO26n, introduces an adaptive dynamic alignment fusion module, and uses an ADown structure in some downsampling nodes.
[0012] Compared with the prior art, the beneficial effects of the present invention are as follows: By employing an adaptive dynamic alignment fusion module in the feature fusion node of the weld defect detection network, the two features to be fused are aligned before fusion, thereby reducing the channel differences between features from different sources.
[0013] Meanwhile, dynamic weights are generated based on the concatenated features, and the dynamic weights are split and applied to the two aligned features respectively, so that features from different sources can be adaptively weighted and fused according to the input content.
[0014] Furthermore, by adjusting the fusion contribution of the two branches through channel-level learnable fusion parameters, spatial detail information and semantic response information can participate more fully in weld defect detection, which helps to improve the stability of weld defect detection in complex backgrounds. Attached Figure Description
[0015] Figure 1 This is a schematic flowchart of a weld defect detection method according to one embodiment of the present invention; Figure 2 This is a schematic diagram of the adaptive dynamic alignment and fusion module in one embodiment of the present invention. Detailed Implementation
[0016] The present invention will be further described below with reference to embodiments. It should be understood that the following embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention.
[0017] like Figure 1 As shown, in one embodiment, the present invention provides a weld defect detection method based on adaptive dynamic alignment fusion. The detection process of this method starts from the input of the weld image to be detected and ends with the output of the weld defect detection result, specifically including the following steps.
[0018] S1, Input the image of the weld to be inspected. The image of the weld to be inspected can be an image of the weld area acquired by an industrial camera, vision inspection equipment, or other image acquisition device.
[0019] S2, perform weld image preprocessing on the weld image to be detected. The preprocessing may include size adjustment, normalization, format conversion, etc., to ensure that the weld image meets the input requirements of the weld defect detection network.
[0020] S3, input the preprocessed weld image into the weld defect detection network. The weld defect detection network includes a backbone network, a neck network, and a detection head.
[0021] S4, extract multi-layer weld image features through the weld defect detection network. Specifically, the backbone network extracts features from the input image to obtain weld image features at different levels.
[0022] S5, construct a multi-scale feature transfer path based on the multi-layer weld seam image features. The multi-scale feature transfer path is used to transfer semantic information and spatial detail information between features of different scales.
[0023] S6, an adaptive dynamic alignment fusion module is used for feature fusion in the feature fusion node. The adaptive dynamic alignment fusion module is used to perform channel alignment, channel concatenation, dynamic weight generation, weight splitting, branch weighting, and learnable parameter fusion on two features to be fused.
[0024] S7. Multi-scale detection features are formed based on the fusion features output by the adaptive dynamic alignment fusion module.
[0025] S8, output weld defect detection results based on the multi-scale detection features. The weld defect detection results include weld defect category information and location information.
[0026] In one implementation, the adaptive dynamic alignment and fusion module in S6 can be expanded into the following steps: S6-1, Channel Alignment. Perform 1×1 convolutions on the two features to be fused, so that the two features have the same number of channels.
[0027] S6-2, Channel splicing. The two features after channel alignment are spliced along the channel dimension to obtain the spliced feature.
[0028] S6-3, Dynamic Weight Generation. The concatenated features are processed by a 3×3 convolution and activated by a Sigmoid function to generate an overall dynamic weight tensor.
[0029] S6-4, Weight Decomposition. The overall dynamic weight tensor is decomposed along the channel dimension into a first branch dynamic weight tensor and a second branch dynamic weight tensor.
[0030] S6-5, Branch Weighting. The first alignment feature is weighted using the dynamic weight tensor of the first branch, and the second alignment feature is weighted using the dynamic weight tensor of the second branch.
[0031] S6-6 allows for the learning of parameters to fuse the data and output the fused features via a 1×1 convolution. Channel-level learnable fusion parameters adjust the fusion contribution of the two branches. The adjusted features from the two branches are then added element-wise and output as fused features via a 1×1 convolution.
[0032] like Figure 2 As shown, in one embodiment, the adaptive dynamic alignment fusion module includes stage 1 input features, stage 2 alignment stage, stage 3 dynamic weight generation, stage 4 branch processing, and stage 5 output fusion.
[0033] In the Phase 1 input features, the input to the adaptive dynamic alignment fusion module consists of two features to be fused, denoted as the first input feature X1 and the second input feature X2. The dimensions of the first input feature X1 are (C1, H, W), and the dimensions of the second input feature X2 are (C2, H, W); where C1 and C2 represent the number of channels of the first and second input features, respectively, and H and W represent the height and width of the feature map, respectively.
[0034] In the alignment stage (stage 2), the first input feature X1 is channel-aligned using a 1×1 convolution to obtain the first alignment feature F1; the second input feature X2 is channel-aligned using a 1×1 convolution to obtain the second alignment feature F2. Both the first alignment feature F1 and the second alignment feature F2 have a size of (C...). a (,H,W), where Ca This indicates the number of channels after channel alignment.
[0035] In stage 3, dynamic weight generation, the first alignment feature F1 and the second alignment feature F2 are concatenated along the channel dimension. The concatenated features are then subjected to 3×3 convolution and sigmoid activation to generate the overall dynamic weight tensor A0. The size of the overall dynamic weight tensor A0 is (2C). a (,H,W). Subsequently, the overall dynamic weight tensor A0 is split along the channel dimension into a first branch dynamic weight tensor A1 and a second branch dynamic weight tensor A2, both of which have a size (C). a ,H,W).
[0036] In the fourth branch of the process, the dynamic weight tensor A1 in the first branch is multiplied element-wise with the first aligned feature F1 to obtain the first weighted feature F1′; the dynamic weight tensor A2 in the second branch is multiplied element-wise with the second aligned feature F2 to obtain the second weighted feature F2′. Then, the fusion contribution of the first weighted feature F1′ is adjusted by the first fusion parameter α1, and the fusion contribution of the second weighted feature F2′ is adjusted by the second fusion parameter α2. Both the first fusion parameter α1 and the second fusion parameter α2 are channel-level learnable parameters with dimensions (1, C). a ,1,1).
[0037] In stage 5 output fusion, the first weighted feature F1′ adjusted by the first fusion parameter α1 and the second weighted feature F2′ adjusted by the second fusion parameter α2 are added element-wise, and then convolved with a 1×1 to obtain the fused output feature Y. The size of the fused output feature Y is (C a ,H,W).
[0038] In one implementation, the first fusion parameter α1 and the second fusion parameter α2 can be set as trainable parameters, with an initial value of 0.5. To improve the stability of the fusion process, amplitude constraints can be applied to the first fusion parameter α1 and the second fusion parameter α2 before the fusion calculation.
[0039] In one embodiment, the weld defect detection network uses YOLO26n as its base network, introduces the adaptive dynamic alignment fusion module into its feature fusion nodes, and may employ an ADown downsampling structure in some downsampling nodes, thereby forming the YOLO-ADA detection network. It should be noted that YOLO26n, ADown, and YOLO-ADA are merely one embodiment of the present invention; the core of the present invention lies in the setting of the adaptive dynamic alignment fusion module in the feature fusion nodes and its feature fusion process.
Claims
1. A weld defect detection method based on adaptive dynamic alignment fusion, characterized in that, Includes the following steps: S1, Input the image of the weld to be inspected; S2, perform weld image preprocessing on the weld image to be detected; S3, input the preprocessed weld image into the weld defect detection network; S4, extract multi-layer weld image features through the weld defect detection network; S5, Construct a multi-scale feature transfer path based on the multi-layer weld seam image features; S6, In the feature fusion node of the multi-scale feature transfer path, an adaptive dynamic alignment fusion module is used to fuse two features to be fused. S7, Multi-scale detection features are formed based on the fusion features output by the adaptive dynamic alignment fusion module; S8, output weld defect detection results based on the multi-scale detection features, the weld defect detection results including weld defect category information and location information; In S6, the adaptive dynamic alignment and fusion module sequentially performs channel alignment, channel splicing, dynamic weight generation, weight splitting, branch weighting, and learnable parameter fusion, and outputs fused features through 1×1 convolution.
2. The weld defect detection method according to claim 1, characterized in that, The weld defect detection network includes a backbone network, a neck network, and a detection head. The backbone network is used to extract multi-layer weld image features, the neck network is used to construct multi-scale feature transfer paths and perform feature fusion, and the detection head is used to output weld defect detection results.
3. The weld defect detection method according to claim 1, characterized in that, The adaptive dynamic alignment and fusion module includes a channel alignment unit, a channel splicing unit, a dynamic weight generation unit, a weight splitting unit, a branch weighting unit, a learnable parameter fusion unit, and an output convolution unit.
4. The weld defect detection method according to claim 3, characterized in that, The input of the adaptive dynamic alignment and fusion module includes a first input feature X1 and a second input feature X2. The size of the first input feature X1 is (C1, H, W), and the size of the second input feature X2 is (C2, H, W). Wherein, C1 and C2 represent the number of channels of the first input feature and the second input feature, respectively, and H and W represent the height and width of the feature map, respectively.
5. The weld defect detection method according to claim 4, characterized in that, The channel alignment unit includes 1×1 convolutions applied to the first input feature X1 and the second input feature X2, respectively. The first input feature X1 is channel aligned using the 1×1 convolution to obtain the first alignment feature F1, and the second input feature X2 is channel aligned using the 1×1 convolution to obtain the second alignment feature F2. The dimensions of both the first alignment feature F1 and the second alignment feature F2 are (C...). a (,H,W), where C a This indicates the number of channels after channel alignment.
6. The weld defect detection method according to claim 5, characterized in that, The channel splicing unit is used to splice the first alignment feature F1 and the second alignment feature F2 along the channel dimension; the dynamic weight generation unit is used to sequentially perform 3×3 convolution and sigmoid activation on the spliced features to generate an overall dynamic weight tensor A0, the size of which is (2C). a ,H,W).
7. The weld defect detection method according to claim 6, characterized in that, The weight splitting unit is used to split the overall dynamic weight tensor A0 along the channel dimension into a first branch dynamic weight tensor A1 and a second branch dynamic weight tensor A2, the size of which is (C). a ,H,W).
8. The weld defect detection method according to claim 7, characterized in that, The branch weighting unit is used to multiply the first branch dynamic weight A1 with the first alignment feature F1 element by element to obtain the first weighted feature F1′, and to multiply the second branch dynamic weight A2 with the second alignment feature F2 element by element to obtain the second weighted feature F2′.
9. The weld defect detection method according to claim 8, characterized in that, The learnable parameter fusion unit includes a first fusion parameter α1 and a second fusion parameter α2, both of which are channel-level learnable parameters with dimensions (1, C). a The learnable parameter fusion unit is used to adjust the fusion contribution of the first weighted feature F1′ through the first fusion parameter α1, and to adjust the fusion contribution of the second weighted feature F2′ through the second fusion parameter α2. After the two adjusted branch features are added element-wise, the fused output feature Y is obtained by 1×1 convolution of the output convolution unit. The size of the fused output feature Y is (C a ,H,W).
10. The weld defect detection method according to claim 1, characterized in that, The weld defect detection network is based on the YOLO26n network, and its features are fused. The adaptive dynamic alignment and fusion module is set in the node, and the ADown downsampling structure is set in some downsampling nodes to form the YOLO-ADA detection network.