Method for automatically detecting position and width of welding seam

By adopting deep learning technology in weld detection, CIFP and MIADM modules are built and BLSIoU loss function is designed, the accuracy of weld position and seam width detection in complex welding scenarios is solved, efficient and accurate weld detection is achieved, and the automation level of welding quality control is improved.

CN119762442AActive Publication Date: 2025-04-04BEIJING CHUANGXIANG ZHIKONG TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

When the existing automatic weld detection methods deal with complex welding scenarios, it is difficult to accurately identify the position and width of the weld, especially when the weld shape is irregular or the background noise is high, the detection performance is significantly reduced.

Method used

The automatic detection method of weld position and seam width based on deep learning is adopted to improve the accuracy and robustness of weld detection by constructing a hierarchical context-based feature extractor CIFP and multi-information-aligned multi-scale detector MIADM module, and designing a new loss function BLSIoU.

Benefits of technology

It realizes high-accurate weld position and seam width detection in complex welding scenarios, significantly improving the automation level of weld inspection, reducing production costs, and improving product quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762442A_ABST
    Figure CN119762442A_ABST
Patent Text Reader

Abstract

The invention provides an automatic detection method for a welding seam position and a seam width, and belongs to the field of machine learning. The method comprises the following steps: acquiring image data of a welding part through a camera at a fixed camera position, and carrying out manual annotation to construct a data set; a feature extractor CIFP module with hierarchical context understanding and a multi-scale detector MIADM module with multi-information alignment are used for improving the welding seam feature recognition precision and detection performance; a BLSIoU loss function is innovatively designed, so that the problems of sample imbalance and label fuzziness are solved, and the detection accuracy is improved; by combining the modules, a single-stage target detection algorithm network structure is designed, and efficient and accurate welding seam detection is realized; through model training and reasoning detection, the welding seam width is automatically calculated and output, and the purpose of automatic detection is achieved; according to the detection method, the accuracy and robustness of detection are improved, the detection efficiency is remarkably improved through an automatic process, and the detection method has important significance on welding quality control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of machine learning, and in particular relates to an automatic detection method for weld position and weld width. Background Art

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

[0003] In order to solve the above problems, researchers began to explore the use of machine learning technology to improve the automation level of weld detection. Machine learning technology can enable the detection system to learn to identify the characteristics of welds through a large amount of data training, thereby improving the accuracy of detection. However, the construction of weld detection data sets is a time-consuming and costly process that requires a large amount of image data and precise annotation information. In addition, the diversity and complexity of weld features require that the detection algorithm be able to handle welds of different scales and angles, which places higher requirements on the design of the algorithm. Therefore, how to build an efficient and accurate weld detection system has become a challenge in the field of machine learning.

[0004] In this context, the present invention proposes an automatic detection method for weld position and width based on deep learning; this method improves the accuracy and robustness of weld detection by constructing a hierarchical context-understanding feature extractor CIFP and a multi-scale detector MIADM module for multi-information alignment, and designs a new loss function BLSIoU; this method can not only automatically detect the position and width of the weld, but also achieve efficient control of the welding quality through model training and inference detection; through this method, the automation level of weld detection can be significantly improved, the production cost can be reduced, and the product quality can be improved, which has important industrial application value. Summary of the invention

[0005] The present invention proposes an automatic detection method for weld position and seam width, aiming to improve the automation level and detection accuracy of welding quality control; by adopting advanced machine learning technology, the 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 provides an automatic detection method for weld position and weld width, which specifically comprises the following steps:

[0007] S1. Preparation of weld position and seam width detection dataset: A fixed-position 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 annotated. The annotated information includes the weld position at multiple angles, which is consistent with the angle and length of the weld in the image. After the annotation is completed, the weld position detection dataset is obtained;

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

[0009] S3, build MIADM module: multi-scale detector with enhanced decision-making through multi-information alignment to optimize the detection performance of welds of different scales;

[0010] S4. Design BLSIoU loss function: Solve the problems of sample imbalance and label ambiguity through IoU decoupling and task alignment, and propose a new evaluation standard to improve the accuracy and robustness of detection;

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

[0012] S6, substituting the weld position detection data set established in S1 into the target detection network designed in S5 for model training, and obtaining a trained weld position and seam width detection model;

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

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

[0015] First, the depth of the low-level feature map is increased through the top-down CNN structure, and the local spatial perception ability of CNN is introduced;

[0016] Secondly, the same-resolution features from the transformer and CNN paths 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 represents the feature map of the i-th layer, f top-down and f bottom-up They represent the top-down CNN structure and the bottom-up transformer path respectively;

[0019] Then, to avoid ambiguity during feature fusion, the transformer blocks are cascaded to reduce the depth difference during feature fusion while maintaining consistency. During the calculation of feature balance, context information is injected in the following way: F″ i =F′ i +λ·W i ·N i ;

[0020] Among them, F i represents the final context-enhanced feature map, λ is the balance parameter, and W i is the attention weight calculated by the scale attention module;

[0021] Finally, the dependencies between all position pairs are constructed through the non-local attention module, and the non-local features are rescaled to the original size at each scale for further context injection. The specific formula of non-local attention is:

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

[0023] Among them, NonLocal represents the non-local attention operation, which builds the dependencies between all position pairs in the feature map; the scale attention module in the process adaptively refines the features in the following ways:

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

[0025] Among them, F′ i Represents the feature map enhanced by the scale attention module.

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

[0027] First, receive the multi-scale feature maps from CIFP; for each scale feature map, generate shared features through cascaded convolutional layers and connection operations. The specific formula for generating shared features is:

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

[0029] Among them, F i is the feature map of the i-th scale, σ is the activation function, and conva() represents the cascaded convolutional layer; then, the task-specific attention layer is used to generate the feature maps related to positioning and classification respectively. The specific task-specific attention map calculation formula is:

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

[0031] Among them, A x represents the attention weight, α is the activation function, MLP is the multi-layer perceptron, and poolAvg is the average pooling operation; for each weld target, the decision is located at each scale, and the reliability of the model is enhanced by multi-task and cross-scale feature alignment. The specific formula is:

[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 is the feature map of the i-th scale, align represents the alignment operation; finally, for each scale detector, the final confidence and positioning bounding box are output. The specific formula is:

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

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

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

[0038] First, a quality assessment criterion is used to select training samples to ensure that the samples have high positioning and detection quality. The specific formula is:

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

[0040] Among them, C is the classification score, IoU is the intersection over union ratio, φ and ψ are indexes that control the importance of classification and positioning; then the samples are normalized, the specific formula is:

[0041]

[0042] Among them, IoU max is the maximum IoU value, Q max is the maximum quality assessment value; the improved Focal Loss loss function is used to process the detection task, and the specific formula is:

[0043]

[0044] Among them, γ is a hyperparameter used to adjust the degree of attention to easy-to-classify samples; the IoU decoupled loss function is introduced, including IoF and IoG, and the specific formula is:

[0045]

[0046] Where D represents the detection box, GT represents the true annotation box, NumGT and NumDet represent the total number of true annotation boxes and detection boxes respectively. Finally, the IoU, IoF and IoG losses are combined to optimize the model. The comprehensive loss function formula is:

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

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

[0049] Preferably, in the calculation process of the seam width in step S7, the information of the coordinates of the four vertices of the rectangular box automatically detected in step S5 is used, combined with the pixel size of the image, to dynamically calculate the width of the shorter side of the rectangular box; by comparing the lengths of the two sides of the rectangular box, 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 has significant advantages over the existing technology. First, by constructing a hierarchical context-understanding feature extractor CIFP module, this technology can more accurately identify weld features, and maintain high recognition accuracy even when the weld shape is complex or the background noise is large. Second, the introduction of the multi-scale detector MIADM module with multi-information alignment enables the detection system to adapt to welds of different scales and optimizes the detection performance. In addition, the innovatively designed BLSIoU loss function effectively solves the problems of sample imbalance and label ambiguity, further improving the accuracy and robustness of detection. This technology also significantly improves detection efficiency through automated processes, reduces labor costs, and reduces the possibility of human errors. Overall, this technology has demonstrated its unique advantages in improving the automation level, accuracy and robustness of weld detection, and has important practical application value for improving welding quality control. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 The invention provides a flow chart for implementing an automatic detection method for weld position and weld width.

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

[0053] Figure 3 Schematic diagram of MIADM module structure design.

[0054] Figure 4 Schematic diagram of BLSIoU loss function process design.

[0055] Figure 5 Schematic diagram of weld and seam width inspection results. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0057] See also Figure 1-Figure 5 The present invention provides a technical solution for the automatic detection method of weld position and weld width.

[0058] like Figure 1 As shown in the overall flow chart, the present invention proposes an automatic detection method for weld position and weld width, which specifically includes the following steps:

[0059] S1. Preparation of weld position and seam width detection dataset: A fixed-position 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 annotated. The annotated information includes the weld position at multiple angles, which is consistent with the angle and length of the weld in the image. After the annotation is completed, the weld position detection dataset is obtained;

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

[0061] S3, build MIADM module: multi-scale detector with enhanced decision-making through multi-information alignment to optimize the detection performance of welds of different scales;

[0062] S4. Design BLSIoU loss function: Solve the problems of sample imbalance and label ambiguity through IoU decoupling and task alignment, and propose a new evaluation standard to improve the accuracy and robustness of detection;

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

[0064] S6, substituting the weld position detection data set established in S1 into the target detection network designed in S5 for model training, and obtaining a trained weld position and seam width detection model;

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

[0066] Further, 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 map is increased through the top-down CNN structure, and the local spatial perception ability of CNN is introduced;

[0068] Secondly, the same-resolution features from the transformer and CNN paths 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 irepresents the feature map of the i-th layer, f top-down and f bottom-up They represent the top-down CNN structure and the bottom-up transformer path respectively;

[0071] Then, to avoid ambiguity during feature fusion, the transformer blocks are cascaded to reduce the depth difference during feature fusion while maintaining consistency. During the calculation of feature balance, context information is injected in the following way: F″ i =F′ i +λ·W i ·N i ;

[0072] Among them, F i represents the final context-enhanced feature map, λ is the balance parameter, and W i is the attention weight calculated by the scale attention module;

[0073] Finally, the dependencies between all position pairs are constructed through the non-local attention module, and the non-local features are rescaled to the original size at each scale for further context injection. The specific formula of non-local attention is:

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

[0075] Among them, NonLocal represents the non-local attention operation, which builds the dependencies between all position pairs in the feature map; the scale attention module in the process adaptively refines the features in the following ways:

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

[0077] Among them, F′ i Represents the feature map enhanced by the scale attention module.

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

[0079] First, receive the multi-scale feature maps from CIFP; for each scale feature map, generate shared features through cascaded convolutional layers and connection operations. The specific formula for generating shared features is:

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

[0081] Among them, F iis the feature map of the i-th scale, σ is the activation function, and conva() represents the cascaded convolutional layer; then, the task-specific attention layer is used to generate the feature maps related to positioning and classification respectively. The specific task-specific attention map calculation formula is:

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

[0083] Among them, A x represents the attention weight, α is the activation function, MLP is the multi-layer perceptron, and poolAvg is the average pooling operation; for each weld target, the decision is located at each scale, and the reliability of the model is enhanced by multi-task and cross-scale feature alignment. The specific formula is:

[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 is the feature map of the i-th scale, align represents the alignment operation; finally, for each scale detector, the final confidence and positioning bounding box are output. The specific formula is:

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

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

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

[0090] First, a quality assessment criterion is used to select training samples to ensure that the samples have high positioning and detection quality. The specific formula is:

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

[0092] Among them, C is the classification score, IoU is the intersection over union ratio, φ and ψ are indexes that control the importance of classification and positioning; then the samples are normalized, the specific formula is:

[0093]

[0094] Among them, IoU max is the maximum IoU value, Q max is the maximum quality assessment value; the improved Focal Loss loss function is used to process the detection task, and the specific formula is:

[0095]

[0096] Among them, γ is a hyperparameter used to adjust the degree of attention to easy-to-classify samples; the IoU decoupled loss function is introduced, including IoF and IoG, and the specific formula is:

[0097]

[0098] Where D represents the detection box, GT represents the true annotation box, NumGT and NumDet represent the total number of true annotation boxes and detection boxes respectively. Finally, the IoU, IoF and IoG losses are combined to optimize the model. The comprehensive loss function formula is:

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

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

[0101] Further, in Figure 1 The calculation process of the seam width mentioned in step S7 utilizes the information of the coordinates of the four vertices of the rectangular box automatically detected in step S5 and combines the pixel size of the image to dynamically calculate the width of the shorter side of the rectangular box; by comparing the lengths of the two sides of the rectangular box, 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. A method for automatically detecting weld position and weld width, characterized in that: The following steps are involved: S1. Preparation of weld position and seam width detection dataset: A fixed-position 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 annotated. The annotated information includes the weld position at multiple angles, which is consistent with the angle and length of the weld in the image. After the annotation is completed, the weld position detection dataset is obtained; S2. Construct CIFP module: a feature extractor for hierarchical context understanding to improve the recognition accuracy of weld features; S3, build MIADM module: multi-scale detector with enhanced decision-making through multi-information alignment to optimize the detection performance of welds of different scales; S4. Design BLSIoU loss function: Solve the problems of sample imbalance and label ambiguity through IoU decoupling and task alignment, and propose a new evaluation standard to improve the accuracy and robustness of detection; S5. Combine S2-S4 modules to design a network structure of a single-stage target detection algorithm, which includes four parts: network input, feature extraction backbone network, feature fusion neck network and detection head network, to achieve efficient and accurate weld position and seam width detection; S6, substituting the weld position detection data set established in S1 into the target detection network designed in S5 for model training, and obtaining a trained weld position and seam width detection model; S7, input the image data to be detected into the S6 training model for inference detection, and calculate the seam width of the detected weld and output the result to achieve automatic detection of the weld position and seam width.

2. The automatic detection method for weld position and weld 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 map is increased through the top-down CNN structure, and the local spatial perception ability of CNN is introduced; Secondly, the same-resolution features from the transformer and CNN paths are fused through skip connections to enrich the feature representation; the feature fusion formula of the CIFP module is as follows: F i =f top-down (F i )+f bottom-up (F i ); Among them, F i represents the feature map of the i-th layer, f top-down and f bottom-up They represent the top-down CNN structure and the bottom-up transformer path respectively; Then, to avoid ambiguity during feature fusion, cascade transformer blocks to reduce the depth difference during feature fusion while maintaining consistency. During the calculation of feature balance, context information is injected in the following way: F″ i =F′ i +λ·W i ·N i ; Among them, F i represents the final context-enhanced feature map, λ is the balance parameter, and W i is the attention weight calculated by the scale attention module; Finally, the dependencies between all position pairs are constructed through the non-local attention module, and the non-local features are rescaled to the original size at each scale for further context injection. The specific formula of non-local attention is: N i =NonLocal(F i ); Among them, NonLocal represents the non-local attention operation, which builds the dependencies between all position pairs in the feature map; the scale attention module in the process adaptively refines the features in the following ways: F′ i =SAM(F i ,N i ); Among them, F′ i Represents the feature map enhanced by the scale attention module.

3. The automatic detection method for weld position and weld width according to claim 1, characterized in that: The specific process of the MIADM module described in step S3 includes: First, receive the multi-scale feature maps from CIFP; for each scale feature map, generate shared features through cascaded convolutional layers and connection operations. The specific formula for generating shared features is: F shared =σ(conv a (F i )); Among them, F i is the feature map of the i-th scale, σ is the activation function, and conva() represents the cascaded convolutional layer; then, the task-specific attention layer is used to generate the feature maps related to positioning and classification respectively. The specific task-specific attention map calculation formula is: A x α(conv(MLP(poolAvg(F). shared )))) Among them, A x represents the attention weight, α is the activation function, MLP is the multi-layer perceptron, and poolAvg is the average pooling operation; for each weld target, the decision is located at each scale, and the reliability of the model is enhanced by multi-task and cross-scale feature alignment. The specific formula is: F top-down =align(F i ,F i+1 ); F bottom-up =align(F i ,F i-1 ); Among them, F i is the feature map of the i-th scale, align represents the alignment operation; finally, for each scale detector, the final confidence and positioning bounding box are output. The specific formula is: Detection=softmax(F top-down +F bottom-up ); Among them, Detection represents the final detection result, and softmax is a normalization operation used to output the target detection confidence.

4. The automatic detection method for weld position and weld width according to claim 1, characterized in that: The BLSIoU loss function described in step S4 mainly includes the following steps: First, a quality assessment criterion is used to select training samples to ensure that the samples have high positioning and detection quality. The specific formula is: Q = (C·φ) × (IoU·ψ); Among them, C is the classification score, IoU is the intersection over union ratio, φ and ψ are indexes that control the importance of classification and positioning; then the samples are normalized, the specific formula is: Among them, IoU max is the maximum IoU value, Q max is the maximum quality assessment value; the improved Focal Loss loss function is used to process the detection task, and the specific formula is: Among them, γ is a hyperparameter used to adjust the degree of attention to easy-to-classify samples; the IoU decoupled loss function is introduced, including IoF and IoG, and the specific formula is: Where D represents the detection box, GT represents the true annotation box, NumGT and NumDet represent the total number of true annotation boxes and detection boxes respectively. Finally, the IoU, IoF and IoG losses are combined to optimize the model. The comprehensive loss function formula is: L total =L cls +α·L IoF +β·L IoG ; Where α and β are weights that balance the importance of different loss terms.

5. The automatic detection method for weld position and weld width according to claim 1, characterized in that: In the calculation process of the seam width in step S7, the information of the coordinates of the four vertices of the rectangular frame automatically detected in step S5 is used to dynamically calculate the width of the shorter side of the rectangular frame in combination with the pixel size of the image; the shorter side is determined by comparing the lengths of the two sides of the rectangular frame, and its length is calculated; Convert the length from pixels to millimeters to get 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 detection method based on improved YOLOX

    CN114240821A

  • Weld defect visual inspection method based on improved YOLOv5s network

    CN117576015A

  • Single-stage small-sample-object detection method based on decoupled metric

    US11205098B1