An automatic detection method for weld position and width

By constructing CIFP and MIADM modules, a weld detection method based on the BLSIoU loss function was designed, which solved the problem of accurate identification of weld position and width in complex welding scenarios, achieving efficient and accurate weld detection and improving welding quality control.

CN119762442BActive Publication Date: 2025-12-02BEIJING CHUANGXIANG ZHIKONG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411808390.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-12-02
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

Existing automatic weld inspection methods struggle to accurately identify the location and width of welds when dealing with complex welding scenarios, especially when the weld shape is irregular or there is significant background noise interference, resulting in a significant drop in inspection performance.

Method used

We employ a deep learning-based automatic weld location and width detection method. By constructing a hierarchical context-aware feature extractor CIFP and a multi-scale detector MIADM module with multi-information alignment, we design a new loss function BLSIoU to optimize the accuracy and robustness of weld detection.

Benefits of technology

It has improved the automation level of weld inspection, reduced production costs, enhanced the accuracy and consistency of welding quality, and reduced the possibility of human error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762442B_ABST
    Figure CN119762442B_ABST
Patent Text Reader

Abstract

This invention proposes an automatic detection method for weld location and width, belonging to the field of machine learning. The method acquires weldment image data using a fixed-position camera and manually annotates it to construct a dataset. It utilizes a hierarchical contextual understanding feature extractor (CIFP) module and a multi-information aligned multi-scale detector (MIADM) module to improve weld feature recognition accuracy and detection performance. An innovative BLSIoU loss function is designed to address sample imbalance and label ambiguity issues, thereby enhancing detection accuracy. Combining the above modules, a single-stage target detection algorithm network structure is designed to achieve efficient and accurate weld detection. Through model training and inference detection, the weld width is automatically calculated and output, achieving automated detection. This invention's detection method not only improves detection accuracy and robustness but also significantly enhances detection efficiency through automation, which is of great significance for welding quality control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine learning, and specifically relates to an automatic detection method for weld position and weld width. Background Technology

[0002] In modern industrial production, welding is one of the important processes for connecting metal parts; the quality of the weld is directly related to the safety and reliability of the product. Traditional weld inspection methods mainly rely on manual visual inspection, which is not only inefficient but also easily affected by human factors, making it difficult to guarantee the consistency and accuracy of the inspection results. With the development of automation technology, automatic weld inspection technology has emerged, aiming to improve inspection efficiency and accuracy and reduce human error. However, existing automatic inspection methods often have difficulty accurately identifying the position and width of the weld when dealing with complex welding scenarios, especially when the weld shape is irregular and there is a lot of background noise interference, the inspection performance will be significantly reduced.

[0003] To address these issues, researchers began exploring the use of machine learning techniques to improve the automation level of weld inspection. Machine learning can train inspection systems on large amounts of data, enabling them to learn to recognize weld features and thus improve inspection accuracy. However, building weld inspection datasets is a time-consuming and costly process, requiring a large amount of image data and precise annotation information. Furthermore, the diversity and complexity of weld features require inspection algorithms to handle welds of different scales and angles, which places higher demands on algorithm design. Therefore, how to build an efficient and accurate weld inspection system has become a challenge in the field of machine learning.

[0004] Against this backdrop, this invention proposes an automatic weld location and width detection method based on deep learning. This method improves the accuracy and robustness of weld detection by constructing a hierarchical context-aware feature extractor (CIFP) and a multi-scale detector (MIADM) module with multi-information alignment, and by designing a novel loss function (BLSIoU). This method not only automatically detects the location and width of welds but also achieves efficient control of welding quality through model training and inference detection. This approach significantly improves the automation level of weld detection, reduces production costs, and enhances product quality, demonstrating significant industrial application value. Summary of the Invention

[0005] This invention proposes an automatic detection method for weld position and width, aiming to improve the automation level and detection accuracy of welding quality control. By adopting advanced machine learning technology, this method can effectively identify and measure the weld position and width in welded parts, and maintain high accuracy even in complex environments with irregular weld shapes or background noise.

[0006] The present invention proposes an automatic detection method for weld position and weld width, which specifically includes the following steps:

[0007] S1. Weld position and width detection dataset creation: A fixed camera is set up at the end of the production line to collect image data of the welded parts, and the weld position information is manually labeled. The label information includes the weld position from multiple angles, which conforms to the angle and length of the weld in the image. After the labeling is completed, the weld position detection dataset is obtained.

[0008] S2. Construct the CIFP module: a feature extractor for hierarchical context understanding to improve the recognition accuracy of weld features;

[0009] S3. Construct the MIADM module: Enhance the decision-making of multi-scale detectors through multi-information alignment to optimize the detection performance of welds at different scales;

[0010] S4. Design of BLSIoU loss function: By decoupling IoU and aligning tasks, the problems of sample imbalance and label ambiguity are solved, and a new evaluation criterion is proposed to improve the accuracy and robustness of detection.

[0011] S5. Combine modules S2-S4 to design a network structure for a single-stage target detection algorithm. This network structure includes four parts: network input, feature extraction backbone network, feature fusion neck network, and detection head network, in order to achieve efficient and accurate detection of weld position and width.

[0012] S6. Substitute the weld position detection dataset established in S1 into the target detection network designed in S5 to train the model and obtain the trained weld position and width detection model.

[0013] S7. Input the image data to be detected into the training model in S6 for inference detection, and calculate and output the weld width of the detected weld to achieve automatic detection of weld position and width.

[0014] Preferably, the specific process of the CIFP module described in step S2 includes:

[0015] First, the depth of the low-level feature maps is increased by using a top-down CNN structure, and the local spatial awareness capability of CNN is introduced.

[0016] Secondly, features of the same resolution from the transformer and CNN path are fused through skip connections to enrich the feature representation; the feature fusion formula of the CIFP module is as follows:

[0017] F i =f top-down (F i )+f bottom-up (Fi );

[0018] Among them, F i f represents the feature map of the i-th layer. top-down and f bottom-up These represent the top-down CNN structure and the bottom-up transformer path, respectively.

[0019] Then, to avoid ambiguity during feature fusion, cascaded transform blocks are used to reduce depth differences during feature fusion while maintaining consistency. Contextual information is injected during feature balancing computation in the following way: F″ i =F′ i +λ·W i ·N i ;

[0020] Among them, F″ i This represents the final context-enhanced feature map, where λ is the balancing parameter and W... i These are the attention weights calculated using the scale attention module;

[0021] Finally, dependencies between all location pairs are constructed using a nonlocal attention module, and the nonlocal features are rescaled to their original size at each scale for further context injection. The specific formula for nonlocal attention is as follows:

[0022] N i =NonLocal(F i );

[0023] Where NonLocal represents a nonlocal attention operation, it constructs dependencies between all position pairs within the feature map; the scale attention module in the process adaptively refines the features in the following way:

[0024] F′ i =SAM(F i N i );

[0025] Among them, F′ i This represents the feature map after being enhanced by the scale attention module.

[0026] Preferably, the specific process of the MIADM module in step S3 includes:

[0027] First, multi-scale feature maps from CIFP are received. For each scale feature map, shared features are generated through cascaded convolutional layers and connection operations. The specific formula for generating shared features is as follows:

[0028] F shared =σ(conv) a (F i ));

[0029] Among them, F i Here, σ is the feature map at scale i, σ is the activation function, and conva() represents a cascaded convolutional layer. Then, task-specific attention layers are used to generate localization and classification-related feature maps respectively. The specific formula for calculating the task-specific attention map is as follows:

[0030] A x =α(conv(MLP(poolAvg(F) shared ))));

[0031] Among them, A x Here, α represents the attention weight, α is the activation function, MLP is a multilayer perceptron, and poolAvg is the average pooling operation. For each weld target, localization decisions are made at each scale. The reliability of the model is enhanced through multi-task and cross-scale feature alignment, as shown in the specific formula:

[0032] F top-down =align(F i F i+1 );

[0033] F bottom-up =align(F i F i-1 );

[0034] Among them, F i Here is the feature map at scale i, and align represents the alignment operation. Finally, for each scale detector, the final confidence score and localization bounding box are output, with the specific formula as follows:

[0035] Detection = softmax(F top-down +F bottom-up );

[0036] Here, Detection represents the final detection result, and softmax is a normalization operation used to output the target detection confidence score.

[0037] Preferably, the BLSIoU loss function described in step S4 mainly includes the following steps:

[0038] First, quality assessment criteria are used to select training samples to ensure that the samples have high localization and detection quality. The specific formula is as follows:

[0039] Q = (C·φ) × (IoU·ψ);

[0040] Where C is the classification score, IoU is the intersection-over-union ratio, and φ and ψ are indices controlling the importance of classification and localization; then the samples are normalized using the following formula:

[0041]

[0042] Among them, IoU max It is the maximum IoU value, Q max This is the highest quality assessment value; the improved Focal Loss function is used to handle the detection task, and the specific formula is as follows:

[0043]

[0044] Here, γ is a hyperparameter used to adjust the degree of attention given to easily classifiable samples; an IoU decoupling loss function is introduced, including IoF and IoG, with the specific formula as follows:

[0045]

[0046] Where D represents the detection box, GT represents the ground truth bounding box, and NumGT and NumDet represent the total number of ground truth bounding boxes and the total number of detection boxes, respectively. Finally, the model is optimized by combining IoU, IoF, and IoG losses. The formula for the comprehensive loss function is:

[0047] L total =L cls +α·L IoF +β·L IoG ;

[0048] α and β are weights that balance the importance of different loss terms.

[0049] Preferably, in step S7, the seam width calculation process utilizes the coordinates of the four vertices of the rectangular frame automatically detected in step S5, combined with the pixel size of the image, to dynamically calculate the width of the shorter side of the rectangular frame; by comparing the lengths of the two sides of the rectangular frame, the shorter side is determined and its length is calculated; the length is converted from pixel units to millimeter units to obtain the actual width of the weld.

[0050] This technology offers significant advantages over existing technologies. First, by constructing a hierarchical context-aware feature extractor (CIFP) module, it can more accurately identify weld features, maintaining high recognition accuracy even with complex weld shapes or high background noise. Second, the introduction of a multi-scale detector (MIADM) module with multi-information alignment enables the detection system to adapt to welds of different scales, optimizing detection performance. Furthermore, the innovatively designed BLSIoU loss function effectively addresses sample imbalance and label ambiguity issues, further improving detection accuracy and robustness. This technology also significantly improves detection efficiency through automated processes, reducing labor costs and the possibility of human error. In summary, this technology demonstrates unique advantages in improving the automation level, accuracy, and robustness of weld detection, and has significant practical application value for enhancing welding quality control. Attached Figure Description

[0051] Figure 1 This is a flowchart illustrating the implementation of an automatic detection method for weld location and width.

[0052] Figure 2 This is a schematic diagram of the CIFP module structure design.

[0053] Figure 3 This is a schematic diagram of the MIADM module structure design.

[0054] Figure 4 A schematic diagram of the BLSIoU loss function flow design.

[0055] Figure 5 This is a schematic diagram showing the inspection results of the weld and weld width. Detailed Implementation

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

[0057] Please see Figures 1-5 This invention provides a technical solution for an automatic detection method for weld position and weld width.

[0058] like Figure 1 As shown in the overall flowchart, the automatic detection method for weld position and width proposed in this invention specifically includes the following steps:

[0059] S1. Weld position and width detection dataset creation: A fixed camera is set up at the end of the production line to collect image data of the welded parts, and the weld position information is manually labeled. The label information includes the weld position from multiple angles, which conforms to the angle and length of the weld in the image. After the labeling is completed, the weld position detection dataset is obtained.

[0060] S2. Construct the CIFP module: a feature extractor for hierarchical context understanding to improve the recognition accuracy of weld features;

[0061] S3. Construct the MIADM module: Enhance the decision-making of multi-scale detectors through multi-information alignment to optimize the detection performance of welds at different scales;

[0062] S4. Design of BLSIoU loss function: By decoupling IoU and aligning tasks, the problems of sample imbalance and label ambiguity are solved, and a new evaluation criterion is proposed to improve the accuracy and robustness of detection.

[0063] S5. Combine modules S2-S4 to design a network structure for a single-stage target detection algorithm. This network structure includes four parts: network input, feature extraction backbone network, feature fusion neck network, and detection head network, in order to achieve efficient and accurate detection of weld position and width.

[0064] S6. Substitute the weld position detection dataset established in S1 into the target detection network designed in S5 to train the model and obtain the trained weld position and width detection model.

[0065] S7. Input the image data to be detected into the training model in S6 for inference detection, and calculate and output the weld width of the detected weld to achieve automatic detection of weld position and width.

[0066] Furthermore, such as Figure 2 As shown, the specific process of the CIFP module mentioned in step S2 includes:

[0067] First, the depth of the low-level feature maps is increased by using a top-down CNN structure, and the local spatial awareness capability of CNN is introduced.

[0068] Secondly, features of the same resolution from the transformer and CNN path are fused through skip connections to enrich the feature representation; the feature fusion formula of the CIFP module is as follows:

[0069] F i =f top-down (F i )+f bottom-up (F i );

[0070] Among them, F if represents the feature map of the i-th layer. top-down and f bottom-up These represent the top-down CNN structure and the bottom-up transformer path, respectively.

[0071] Then, to avoid ambiguity during feature fusion, cascaded transform blocks are used to reduce depth differences during feature fusion while maintaining consistency. Contextual information is injected during feature balancing computation in the following way: F″ i =F′ i +λ·W i ·N i ;

[0072] Among them, F″ i This represents the final context-enhanced feature map, where λ is the balancing parameter and W... i These are the attention weights calculated using the scale attention module;

[0073] Finally, dependencies between all location pairs are constructed using a nonlocal attention module, and the nonlocal features are rescaled to their original size at each scale for further context injection. The specific formula for nonlocal attention is as follows:

[0074] N i =NonLocal(F i );

[0075] Where NonLocal represents a nonlocal attention operation, it constructs dependencies between all position pairs within the feature map; the scale attention module in the process adaptively refines the features in the following way:

[0076] F′ i =SAM(Fi, N) i );

[0077] Among them, F′ i This represents the feature map after being enhanced by the scale attention module.

[0078] Furthermore, such as Figure 3 As shown, the specific process of the MIADM module mentioned in step S3 includes:

[0079] First, multi-scale feature maps from CIFP are received. For each scale feature map, shared features are generated through cascaded convolutional layers and connection operations. The specific formula for generating shared features is as follows:

[0080] F shared =σ(conv) a (F i ));

[0081] Among them, F iHere, σ is the feature map at scale i, σ is the activation function, and conva() represents a cascaded convolutional layer. Then, task-specific attention layers are used to generate localization and classification-related feature maps respectively. The specific formula for calculating the task-specific attention map is as follows:

[0082] A x =α(conv(MLP(poolAvg(F) shared ))));

[0083] Among them, A x Here, α represents the attention weight, α is the activation function, MLP is a multilayer perceptron, and poolAvg is the average pooling operation. For each weld target, localization decisions are made at each scale. The reliability of the model is enhanced through multi-task and cross-scale feature alignment, as shown in the specific formula:

[0084] F top-down =align(F i F i+1 );

[0085] F bottom-up =align(F i F i-1 );

[0086] Among them, F i Here is the feature map at scale i, and align represents the alignment operation. Finally, for each scale detector, the final confidence score and localization bounding box are output, with the specific formula as follows:

[0087] Detection = softmax(F top-down +F bottom-up );

[0088] Here, Detection represents the final detection result, and softmax is a normalization operation used to output the target detection confidence score.

[0089] Furthermore, such as Figure 4 As shown, the BLSIoU loss function mentioned in step S4 mainly includes the following steps:

[0090] First, quality assessment criteria are used to select training samples to ensure that the samples have high localization and detection quality. The specific formula is as follows:

[0091] Q = (C·φ) × (IoU·ψ);

[0092] Where C is the classification score, IoU is the intersection-over-union ratio, and φ and ψ are indices controlling the importance of classification and localization; then the samples are normalized using the following formula:

[0093]

[0094] Among them, IoU max It is the maximum IoU value, Q max This is the highest quality assessment value; the improved Focal Loss function is used to handle the detection task, and the specific formula is as follows:

[0095]

[0096] Here, γ is a hyperparameter used to adjust the degree of attention given to easily classifiable samples; an IoU decoupling loss function is introduced, including IoF and IoG, with the specific formula as follows:

[0097]

[0098] Where D represents the detection box, GT represents the ground truth bounding box, and NumGT and NumDet represent the total number of ground truth bounding boxes and the total number of detection boxes, respectively. Finally, the model is optimized by combining IoU, IoF, and IoG losses. The formula for the comprehensive loss function is:

[0099] L total =L cls +α·L IoF +β·L IoG ;

[0100] α and β are weights that balance the importance of different loss terms.

[0101] Furthermore, in Figure 1 The process of calculating the weld width mentioned in step S7 uses the coordinates of the four vertices of the rectangle obtained by automatic detection in step S5, combined with the pixel size of the image, to dynamically calculate the width of the shorter side of the rectangle; by comparing the lengths of the two sides of the rectangle, the shorter side is determined and its length is calculated; the length is converted from pixel units to millimeter units to obtain the actual width of the weld.

Claims

1. An automatic detection method for weld position and weld width, characterized in that, Includes the following steps: S1. Weld position and width detection dataset creation: A fixed camera is set up at the end of the production line to collect image data of the welded parts, and the weld position information is manually labeled. The label information includes the weld position from multiple angles, which conforms to the angle and length of the weld in the image. After the labeling is completed, the weld position detection dataset is obtained. S2. Construct the CIFP module: a feature extractor for hierarchical context understanding; S3. Constructing the MIADM module: A multi-scale detector that enhances decision-making through multi-information alignment; S4. Design of BLSIoU loss function: Solve the problems of sample imbalance and label ambiguity by IoU decoupling and task alignment, and propose a new evaluation criterion; S5. Design a network structure for a single-stage target detection algorithm by combining modules S2-S4. This network structure includes four parts: network input, feature extraction backbone network, feature fusion neck network, and detection head network. S6. Substitute the weld position detection dataset established in S1 into the target detection network designed in S5 to train the model and obtain the trained weld position and width detection model. S7. Input the image data to be detected into the training model in S6 for inference detection, and calculate the weld width and output the results of the detected welds. The specific process of the MIADM module in step S3 includes: First, multi-scale feature maps from CIFP are received. For each scale feature map, shared features are generated through cascaded convolutional layers and connection operations. The specific formula for generating shared features is as follows: ; in, Let σ be the feature map at scale i, and conv be the activation function. a () denotes a cascaded convolutional layer; then, a task-specific attention layer is used to generate localization and classification-related feature maps respectively. The specific formula for calculating the task-specific attention map is as follows: ; in, The attention weights are represented by α, the activation function is MLP, and poolAvg is the average pooling operation. For each weld target, location decisions are made at each scale, and the model is enhanced through multi-task and cross-scale feature alignment. Reliability, specifically the formula: ; ; in, Here is the feature map at scale i, and align represents the alignment operation. Finally, for each scale detector, the final confidence score and localization bounding box are output, with the specific formula as follows: ; Here, Detection represents the final detection result, and softmax is a normalization operation used to output the target detection confidence score.

2. The automatic detection method for weld position and width according to claim 1, characterized in that, The specific process of the CIFP module described in step S2 includes: First, the depth of the low-level feature maps is increased by using a top-down CNN structure, and the local spatial awareness capability of CNN is introduced. Secondly, features of the same resolution from the transformer and CNN path are fused through skip connections to enrich the feature representation; the feature fusion formula of the CIFP module is as follows: ; in, This represents the feature map of the i-th layer. and These represent the top-down CNN structure and the bottom-up transformer path, respectively. Then, to avoid ambiguity during feature fusion, cascaded transform blocks are used to reduce depth differences during feature fusion while maintaining consistency. Contextual information is injected during the feature balancing computation process in the following ways: ; in, This represents the final context-enhanced feature map, where λ is the balancing parameter. These are the attention weights calculated using the scale attention module; Finally, dependencies between all location pairs are constructed using a nonlocal attention module, and the nonlocal features are rescaled to their original size at each scale for further context injection. The specific formula for nonlocal attention is as follows: ; Where NonLocal represents a nonlocal attention operation, it constructs dependencies between all position pairs within the feature map; the scale attention module in the process adaptively refines the features in the following way: ; in, This represents the feature map after being enhanced by the scale attention module.

3. The automatic detection method for weld position and width according to claim 1, characterized in that, The BLSIoU loss function mentioned in step S4 mainly includes the following steps: First, quality assessment criteria are used to select training samples to ensure that the samples have high localization and detection quality. The specific formula is as follows: ; Where C is the classification score. IoU It is intersection, union, and comparison. ϕ and ψ It is an index that controls the importance of classification and localization; then the samples are normalized, with the specific formula being: ; in, It is the maximum IoU value. This is the highest quality assessment value; the improved Focal Loss function is used to handle the detection task, and the specific formula is as follows: ; in, γ It is a hyperparameter used to adjust the degree of attention given to easily classifiable samples; a loss function for IoU decoupling is introduced, including IoF and IoG, with the specific formula as follows: ; in D Let GT represent the ground truth bounding boxes, and NumGT and NumDet represent the total number of ground truth bounding boxes and the total number of detected bounding boxes, respectively. Finally, the model is optimized by combining IoU, IoF, and IoG losses. The formula for the combined loss function is: ; in α and β It is a weight that balances the importance of different loss terms.

4. The automatic detection method for weld position and width according to claim 1, characterized in that, In step S7, the seam width is calculated by using the coordinates of the four vertices of the rectangle obtained by automatic detection in step S5, combined with the pixel size of the image, to dynamically calculate the width of the shorter side of the rectangle; by comparing the lengths of the two sides of the rectangle, the shorter side is determined and its length is calculated. Convert the length from pixel units to millimeters to obtain the actual width of the weld.

Citation Information

Patent Citations

  • Weld seam and weld seam defect detection method based on deep learning

    CN109900706A

  • Weld defect visual inspection method based on improved YOLOv5s network

    CN117576015A