A weld defect recognition method
By introducing high-resolution feature maps and feature fusion networks, combined with an adaptive spatial feature fusion module and channel attention weights, the problem of insufficient accuracy in weld defect identification is solved, and efficient and accurate detection of multi-scale weld defects in complex environments is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG QIANJIANG ROBOT CO LTD
- Filing Date
- 2026-04-08
- Publication Date
- 2026-06-23
Smart Images

Figure CN122265727A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of weld defect identification technology and relates to a method for weld defect identification. Background Technology
[0002] Welding, as a core joining process in modern manufacturing, is widely used in critical fields such as aerospace, automobile manufacturing, shipbuilding, and construction engineering. From aircraft fuselage assembly to bridge structure construction, welding quality directly determines the structural integrity and service life of products.
[0003] Welds are prone to various defects due to factors such as welding process parameters, material quality, operator skills, and environmental conditions. These defects include cracks, porosity, slag inclusions, lack of fusion, incomplete penetration, undercut, and weld beads. These defects can seriously threaten product safety. For example, minor weld defects in the aerospace industry can lead to structural fractures, while weld defects in petrochemical pipelines can cause leaks and explosions. Statistics show that over 50% of structural failures are directly related to weld defects. Therefore, efficient and accurate identification of weld defects is a core element in ensuring production safety and improving product quality.
[0004] In recent years, with breakthroughs in deep learning technology, models based on convolutional neural networks (CNNs) have become a research hotspot in the field of weld defect recognition due to their ability to automatically learn high-level features. Classic network structures such as AlexNet, VGG, and ResNet, combined with improved techniques such as multi-scale fusion and attention mechanisms, have significantly improved recognition accuracy. However, in practical industrial applications, this technology still faces many challenges. On the one hand, the industrial environment is complex, with unstable lighting, irregular weld shapes, and severe background noise, resulting in unsatisfactory image quality, directly affecting the accuracy and reliability of feature extraction and recognition. On the other hand, the high similarity of image features between different defects makes classification difficult; at the same time, the high cost and long cycle of acquiring high-quality labeled data restrict the further promotion and optimization of the model. In addition, most current deep learning models are insufficient in terms of real-time performance, resource consumption, and interpretability, making it difficult to fully meet the real-time detection needs of production lines and to establish sufficient trust in high-security fields. Summary of the Invention
[0005] The purpose of this invention is to address the aforementioned problems in the existing technology by proposing a method for identifying weld defects. The technical problem to be solved is: how to improve the accuracy of defect identification.
[0006] The objective of this invention can be achieved through the following technical solution: a method for identifying weld defects, comprising the following steps:
[0007] S1. Acquire weld images and perform preprocessing to obtain standardized images;
[0008] S2. Input the preprocessed standardized image into the trained weld defect detection model; the weld defect detection model includes:
[0009] The backbone network is used to extract features from the input standardized image, extracting feature maps at four scales: P2, P3, P4, and P5.
[0010] A feature fusion network is used to perform upsampling progressive fusion and downsampling feedback fusion on the feature maps at the four scales to generate fused feature maps at the four scales.
[0011] The detection head, connected to the feature fusion network, includes four detection head branches corresponding to the four scales P2, P3, P4, and P5, respectively, for defect detection based on the corresponding fused feature maps to obtain weld defect identification results;
[0012] S3. Output the weld defect identification results through the weld defect detection model.
[0013] When identifying weld defects using this method, weld images are first acquired from the field. These images are then preprocessed to generate standardized images, which are input into a pre-trained weld defect detection model. Based on this model, feature extraction, defect analysis, and identification are performed, ultimately outputting the weld defect identification result. The weld defect detection module in this method introduces high-resolution P2-scale feature maps into the backbone network, enabling the model to capture the detailed features of small, low-contrast defects in the weld images. This effectively solves the problem of missed and false detections caused by the loss of small target information due to feature downsampling in traditional detection models, significantly reducing the missed and false detection rates of small defects and improving the detection accuracy of small-sized defects. Through a bidirectional path combining upsampling progressive fusion and downsampling feedback fusion in the feature fusion network, full interaction and complementarity of cross-scale features are achieved. This enables the model to dynamically fuse contextual information at different scales, allowing it to accurately locate small nearby defects using high-resolution features and reliably identify large distant defects with strong semantic features. This achieves stable and accurate detection of various weld defects with vastly different sizes, significantly enhancing the model's generalization ability and robustness in complex and ever-changing industrial environments. Furthermore, the detection head in this model employs a parallel branch structure that strictly corresponds to the four scale features (P2, P3, P4, and P5), achieving scale-aligned prediction. This ensures that each detection branch focuses on processing the feature map with the optimal resolution, avoiding interference or weight competition among multi-scale features within a single detection head. This method further improves the accuracy of localization and classification while maintaining detection speed, resulting in more reliable weld defect identification results.
[0014] In the aforementioned weld defect identification method, in step S2, the feature fusion network includes an adaptive spatial feature fusion module. This module generates spatially adaptive weights for feature maps at four scales: P2, P3, P4, and P5. It also introduces channel attention weights based on weld semantic priors. The spatially adaptive weights are combined with the channel attention weights to generate fusion weights, which are then used to weighted fuse feature maps at different scales. Through adaptive spatial feature fusion, the model can better utilize multi-scale features, especially for small-sized and uniquely shaped welds, significantly improving detection accuracy.
[0015] In the above-described weld defect identification method, in step S2, the channel attention weights based on weld semantic priors are generated by the geometric features of the weld region, wherein the geometric features include at least one of linearity, curvature, and edge gradient.
[0016] In the above-described weld defect identification method, step S2, which involves extracting feature maps at four scales (P2, P3, P4, and P5), includes:
[0017] The input standardized image is downsampled a first time to extract basic features, and then downsampled a second time to generate a P2 scale feature map.
[0018] After feature enhancement processing of the P2 scale feature map, a third downsampling is performed to generate the P3 scale feature map.
[0019] After feature enhancement processing of the P3 scale feature map, a fourth downsampling is performed to generate the P4 scale feature map.
[0020] After performing feature enhancement processing on the P4 scale feature map, a fifth downsampling is performed to generate the P5 scale feature map.
[0021] Deep feature extraction, spatial pyramid pooling, and an attention mechanism are applied to the P5-scale feature map to enhance features, generating the final P5-scale feature map, which is then output to the feature fusion network. This step, through systematic downsampling and feature enhancement, enables the model to possess full-scale perception capabilities from pixel-level details to high-level semantics. This is the fundamental prerequisite for the model to simultaneously and accurately identify various weld defects with a wide size range, providing a foundation for accurate weld defect identification.
[0022] In the above-described weld defect identification method, in step S2, the upsampling progressive fusion operation includes:
[0023] The final P5 scale feature map is upsampled and then concatenated with the P4 scale feature map generated by the backbone network. After fusion optimization, the fused P4 scale feature map is obtained.
[0024] The fused P4 scale feature map is upsampled and then concatenated with the P3 scale feature map generated by the backbone network. After fusion optimization, the fused P3 scale feature map is obtained.
[0025] The fused P3-scale feature map is upsampled and then concatenated with the P2-scale feature map generated by the backbone network. After fusion optimization, the final output is a P2-scale detection feature adapted to ultra-small targets. Upsampling progressive fusion is responsible for passing the high-level semantic information of the deep network from top to bottom to the high-resolution feature map of the shallow layer, so that detailed information, such as edges and textures, have stronger semantic expressive power. This plays an important role in generating high-quality P2-scale features and improving the accuracy of small target detection, such as fine weld cracks.
[0026] In the above-described weld defect identification method, in step S2, the downsampling feedback fusion operation includes:
[0027] The P2 scale detection features are downsampled and then fused with the P3 scale feature map obtained from the upsampling stage. After further fusion optimization, the P3 scale detection features are obtained.
[0028] The P3 scale detection features are downsampled and then fused with the P4 scale feature map obtained from the upsampling stage. After further fusion optimization, the P4 scale detection features are obtained.
[0029] The P4 scale detection features are downsampled and then fused with the P5 scale feature map obtained from the upsampling stage. After further fusion optimization, the P5 scale detection features are obtained.
[0030] The P2, P3, P4, and P5 scale detection features are output to the corresponding detection head branches for defect prediction. The downsampling feedback fusion step transfers low-level location and detail information from the shallow network, such as precise contours, from bottom to top, supplementing and refining the mid-to-high-level features. Working together with the upsampling progressive fusion, this ensures that the features used in the four detection head branches integrate contextual information from different scales, significantly improving the model's ability to identify features of weld defects of different sizes. This lays a solid foundation for more accurate adaptive decision-making by the subsequent detection head.
[0031] In the above-described weld defect identification method, in step S2, the weld defect identification results obtained by the detection head include the predicted results of the weld defect's bounding box location, category, and confidence level.
[0032] In the above-described weld defect identification method, in step S2, the weld defect identification method further includes post-processing of the prediction result, the post-processing operations including:
[0033] Use a confidence threshold to filter predicted boxes that are below a preset confidence threshold;
[0034] Non-maximum suppression (NMS) is used to remove predicted bounding boxes with overlap values exceeding a preset threshold. Based on a set confidence threshold, predicted bounding boxes with low confidence are filtered out to reduce false detections. NMS is also used to remove predicted bounding boxes with high overlap, ensuring that each defect is detected only once. The overlap threshold is typically set to 0.5. These two steps together ensure the accuracy, uniqueness, and reliability of the final output.
[0035] In the aforementioned weld defect identification method, in step S2, the detection head branch is an enhanced adaptive spatial feature fusion detection head. Designing the detection head branch as an enhanced adaptive spatial feature fusion detection head plays a crucial and targeted improvement role, significantly enhancing the model's detection accuracy and robustness for multi-scale targets, especially small target defects, in complex industrial scenarios.
[0036] In the above-described weld defect identification method, in step S2, the weld defect detection model is trained through the following steps:
[0037] S21. Obtain an image dataset containing weld defect annotation information;
[0038] S22. Normalize and augment the images in the image dataset. The data augmentation operation includes at least one of simulating welding spatter, lighting changes, or metal reflection.
[0039] S23. Divide the dataset processed in S22 into training set, validation set and test set according to a preset ratio;
[0040] S24. The weld defect detection model is trained and optimized using the training set and validation set. The loss function used for training is a hybrid loss function that combines focus loss and CIoU loss.
[0041] S25. After training, the performance of the weld defect detection model is evaluated using a test set. The evaluation metrics include accuracy, recall, mean precision, and map-range metrics for multi-scale defects.
[0042] S26. When the performance evaluation results of the weld defect detection model meet the conditions, save the trained model parameters. By training the weld defect detection model, the final model can efficiently and stably learn weld defect features and has comprehensive performance that can be reliably applied in real complex industrial scenarios, further ensuring the accuracy of weld defect identification.
[0043] Compared with existing technologies, this weld defect identification method has the following advantages:
[0044] 1. This invention introduces a high-resolution P2-scale feature map, enabling the model to capture the detailed features of tiny, low-contrast defects. This fundamentally alleviates the problem of small target information loss caused by feature downsampling in traditional models, thereby significantly reducing the false negative and false positive rates of tiny defects and significantly improving the detection capability of small-sized defects.
[0045] 2. This invention dynamically integrates contextual information at different scales, enabling precise localization of small defects at close range using high-resolution features and reliable identification of large defects at a distance using strong semantic features. This greatly enhances the detection capability for various weld defects with significant size differences, achieving stable and accurate detection of defects at multiple scales. Attached Figure Description
[0046] Figure 1 This is a schematic diagram of the weld defect detection model architecture of the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0048] When applying this weld defect identification method, a weld defect detection model is pre-built and trained. The specific steps are as follows: First, a dedicated weld defect dataset is prepared. In this embodiment, dataset W4 is used. The data comes from actual industrial welding scenarios, covering three materials: carbon steel, stainless steel, and aluminum alloy, and three typical joint forms: flat butt weld, fillet weld, and pipe butt weld. It includes five types of defects: cracks, porosity, slag inclusions, lack of fusion, and incomplete penetration. The samples for each category are balanced. VOC format is used for annotation, recording the defect bounding box and category label. The annotation error is <1 pixel after dual verification by manual quality inspection and ultrasonic testing. The images in the dataset are preprocessed, including normalization, scaling all pixel values to the range [0,1] to eliminate illumination differences. Next, targeted data augmentation operations are performed, including but not limited to random flipping, rotation, scaling, and simulating interference unique to industrial sites such as welding spatter, illumination changes, and metal reflection. These augmentation operations aim to greatly improve the model's generalization ability and robustness in complex and variable real-world environments.
[0049] This weld defect detection model is the YOLO11-ASFF-P2 model, an improvement on YOLOv11. This model includes:
[0050] The backbone network is used to extract features from the input standardized image, extracting feature maps at four scales: P2, P3, P4, and P5.
[0051] A feature fusion network is used to perform upsampling progressive fusion and downsampling feedback fusion on the feature maps at the four scales to generate fused feature maps at the four scales.
[0052] The detection head, connected to the feature fusion network, includes four detection head branches corresponding to four scales: P2, P3, P4, and P5, respectively. These branches are used to perform defect detection based on the corresponding fused feature maps to obtain weld defect identification results. In this embodiment, the detection head branch adopts the enhanced adaptive spatial feature fusion detection head ASFFHead.
[0053] The feature fusion network includes an adaptive spatial feature fusion module, which generates spatially adaptive weights for feature maps at four scales: P2, P3, P4, and P5. It also introduces channel attention weights based on weld semantic priors. These spatially adaptive weights are combined with the channel attention weights to generate fusion weights, which are then used to weightedly fuse feature maps at different scales. The channel attention weights based on weld semantic priors are generated by the geometric features of the weld region, including at least one of linearity, curvature, and edge gradients.
[0054] The model is then trained and optimized, specifically as follows:
[0055] The preprocessed and data augmented dataset is divided into training, validation and test sets according to a preset ratio; for example, a total of 6400 640×640 pixel JPEG images are divided into training set (4800 images), validation set (800 images) and test set (800 images) in a 6:1:1 ratio.
[0056] The weld defect detection model is trained and optimized using the training set and validation set. The loss function used for training is a hybrid loss function that combines focus loss and CIoU loss.
[0057] After training, the weld defect detection model is forward-propagated using the test set to obtain prediction results, including bounding box coordinates, class probabilities, and confidence scores. Subsequently, low-confidence prediction boxes are filtered out using a confidence threshold (set to 0.5), and overlapping boxes are removed using the Non-Maximum Suppression (NMS) algorithm to ensure the accuracy of the detection results.
[0058] The performance of the weld defect detection model was then evaluated. The evaluation metrics included accuracy, recall, mean precision, and map-range metrics for multi-scale defects. Among them, accuracy (Precision) = TP / (TP+FP) reflects the proportion of true positive samples in the predicted positive samples and measures the detection accuracy.
[0059] Recall = TP / (TP+FN) reflects the proportion of real positive samples that are correctly detected and measures the completeness of the detection.
[0060] mAP (mean accuracy) is the average AP value of all defect categories. AP is the area under the PR curve, which comprehensively evaluates the detection performance of multiple categories.
[0061] map-range is the mean mAP of targets with different size ranges. It is specifically optimized for multi-scale detection. Defects are divided into three categories according to pixel size: small (<16), medium (16-64), and large (>64). The average AP of each scale is calculated to quantify the model's ability to detect defects of different sizes.
[0062] When the performance evaluation results of the weld defect detection model meet the conditions, the trained model parameters are saved.
[0063] After model training, this weld defect identification method is applied, such as by collecting weld image data from a shipbuilding site. High-resolution industrial cameras are used to photograph welds at different welding stations, ensuring that the acquired images clearly show weld details and potential defects. During acquisition, lighting conditions are carefully controlled to avoid uneven lighting affecting image quality. The acquired images are preprocessed. Following the preprocessing methods used in the model training phase, the images are normalized, scaling pixel values to the range of [0, 1] to eliminate brightness differences between images. Based on data augmentation strategies, images are randomly flipped, rotated, and scaled to increase data diversity and improve the model's generalization ability.
[0064] The preprocessed, standardized image is input into the trained welding defect detection model for defect detection. The welding defect detection model performs feature extraction and analysis on the image, processing features at different scales through a backbone network and feature fusion module. The specific processing steps are as follows:
[0065] like Figure 1As shown, feature maps at four scales (P2, P3, P4, and P5) are extracted through the backbone network: The input standardized image is downsampled for the first time by the first Conv module to extract basic features, and then downsampled for the second time by the second Conv module to generate the P2 scale feature map; the P2 scale feature map is then deepened by the first C2f module, and downsampled for the third time by the third Conv module to generate the P3 scale feature map; the P3 scale feature map is then deepened by the second C2f module, and downsampled for the fourth time by the fourth Conv module to generate the P4 scale feature map; the P4 scale feature map is then deepened by the first C3k2 module, and downsampled for the fifth time by the fifth Conv module to generate the P5 scale feature map; the P5 scale feature map is then subjected to deep feature extraction by the second C3k2 module, spatial pyramid pooling by the SPPF module, and an attention mechanism is introduced by the C2PSA module to enhance the features. The P5 scale feature map after C2PSA processing becomes the final output of the backbone network.
[0066] Upsampling and progressive fusion are performed: the final generated P5-scale feature map is upsampled and concatenated with the P4-scale feature map generated by the backbone network through the Concat module, and then fused and optimized by the C2f module to obtain the fused P4-scale feature map; the fused P4-scale feature map is upsampled and concatenated with the P3-scale feature map generated by the backbone network through the Concat module, and then fused and optimized by the C2f module to obtain the fused P3-scale feature map; the fused P3-scale feature map is upsampled and concatenated with the P2-scale feature map generated by the backbone network through the Concat module, and then fused and optimized by the C2f module to finally output the P2-scale detection features adapted to ultra-small targets.
[0067] Downsampling feedback fusion is performed: the P2-scale detection features are downsampled using the Conv module and fused with the P3-scale feature map from the upsampling stage, then concatenated using the Concat module, and further optimized using the C2f module to obtain the P3-scale detection features; the P3-scale detection features are downsampled using the Conv module and fused with the P4-scale feature map from the upsampling stage, then concatenated using the Concat module, and further optimized using the C2f module to obtain the P4-scale detection features; the P4-scale detection features are downsampled using the Conv module and fused with the P5-scale feature map from the upsampling stage, then concatenated using the Concat module, and further optimized using the C3k2 module to obtain the P5-scale detection features; finally, the feature fusion network outputs the P2-scale, P3-scale, P4-scale, and P5-scale detection features to the corresponding detection head branches for defect prediction.
[0068] Weld Defect Prediction: Four detection head branches perform defect detection based on corresponding scale detection features, obtaining weld defect identification results, including the predicted bounding box location, category, and confidence level of the weld defect. After obtaining the prediction results output by the weld defect detection model, post-processing is performed. Based on a set confidence threshold, prediction boxes with low confidence are filtered out to reduce false detections. The Non-Maximum Suppression (NMS) algorithm is used to remove prediction boxes with high overlap, ensuring that each defect is detected only once. The confidence threshold is set differently depending on the defect type; for example, for porosity, the confidence threshold ranges from 0.5 to 0.65; for cracks, it ranges from 0.25 to 0.4; for lack of fusion, it ranges from 0.3 to 0.45; for undercut, it ranges from 0.45 to 0.6; and for overlap, it ranges from 0.6 to 0.75. Improve detection accuracy by setting differentiated thresholds.
[0069] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
Claims
1. A method for identifying weld defects, characterized in that, The method for identifying weld defects includes the following steps: S1. Acquire weld images and perform preprocessing to obtain standardized images; S2. Input the preprocessed standardized image into the trained weld defect detection model; the weld defect detection model includes: The backbone network is used to extract features from the input standardized image, extracting feature maps at four scales: P2, P3, P4, and P5. A feature fusion network is used to perform upsampling progressive fusion and downsampling feedback fusion on the feature maps at the four scales to generate fused feature maps at the four scales. The detection head, connected to the feature fusion network, includes four detection head branches corresponding to the four scales P2, P3, P4, and P5, respectively, for defect detection based on the corresponding fused feature maps to obtain weld defect identification results; S3. Output the weld defect identification results through the weld defect detection model.
2. The weld defect identification method according to claim 1, characterized in that, In step S2, the feature fusion network includes an adaptive spatial feature fusion module, which generates spatial adaptive weights for feature maps at four scales: P2, P3, P4, and P5, and introduces channel attention weights based on weld semantic priors. The spatial adaptive weights are combined with the channel attention weights to generate fusion weights, so as to perform weighted fusion of feature maps at different scales.
3. The weld defect identification method according to claim 2, characterized in that, In step S2, the channel attention weights based on weld semantic priors are generated guided by the geometric features of the weld region, including at least one of linearity, curvature, and edge gradient.
4. The weld defect identification method according to claim 1, 2, or 3, characterized in that, In step S2, the operation of extracting feature maps at four scales, P2, P3, P4, and P5, includes: The input standardized image is downsampled a first time to extract basic features, and then downsampled a second time to generate a P2 scale feature map. After feature enhancement processing of the P2 scale feature map, a third downsampling is performed to generate the P3 scale feature map. After feature enhancement processing of the P3 scale feature map, a fourth downsampling is performed to generate the P4 scale feature map. After performing feature enhancement processing on the P4 scale feature map, a fifth downsampling is performed to generate the P5 scale feature map. Deep feature extraction, spatial pyramid pooling, and an attention mechanism are applied to the P5-scale feature map to enhance the features, generating the final P5-scale feature map and outputting it to the feature fusion network.
5. The weld defect identification method according to claim 4, characterized in that, In step S2, the upsampling progressive fusion operation includes: The final P5 scale feature map is upsampled and then concatenated with the P4 scale feature map generated by the backbone network. After fusion optimization, the fused P4 scale feature map is obtained. The fused P4 scale feature map is upsampled and then concatenated with the P3 scale feature map generated by the backbone network. After fusion optimization, the fused P3 scale feature map is obtained. The fused P3-scale feature map is upsampled and then concatenated with the P2-scale feature map generated by the backbone network. After fusion optimization, the final output is a P2-scale detection feature adapted to ultra-small targets.
6. The weld defect identification method according to claim 5, characterized in that, In step S2, the downsampling feedback fusion operation includes: The P2 scale detection features are downsampled and then fused with the P3 scale feature map obtained from the upsampling stage. After further fusion optimization, the P3 scale detection features are obtained. The P3 scale detection features are downsampled and then fused with the P4 scale feature map obtained from the upsampling stage. After further fusion optimization, the P4 scale detection features are obtained. The P4 scale detection features are downsampled and then fused with the P5 scale feature map obtained from the upsampling stage. After further fusion optimization, the P5 scale detection features are obtained. Output the detection features at scales P2, P3, P4, and P5 to the corresponding detection head branches for defect prediction.
7. The weld defect identification method according to claim 1, characterized in that, In step S2, the weld defect identification results obtained by the detection head include the predicted results of the weld defect's bounding box location, category, and confidence level.
8. The weld defect identification method according to claim 7, characterized in that, In step S2, the weld defect identification method further includes post-processing of the prediction results, the post-processing operations including: Use a confidence threshold to filter predicted boxes that are below a preset confidence threshold; Non-maximum suppression algorithm is used to remove predicted bounding boxes that exceed a preset overlap threshold.
9. The weld defect identification method according to claim 1, 2, or 3, characterized in that, In step S2, the detection head branch is an enhanced adaptive spatial feature fusion detection head.
10. The weld defect identification method according to claim 1, characterized in that, In step S2, the weld defect detection model is trained through the following steps: S21. Obtain an image dataset containing weld defect annotation information; S22. Normalize and augment the images in the image dataset. The data augmentation operation includes at least one of simulating welding spatter, lighting changes, or metal reflection. S23. Divide the dataset processed in S22 into training set, validation set and test set according to a preset ratio; S24. The weld defect detection model is trained and optimized using the training set and validation set. The loss function used for training is a hybrid loss function that combines focus loss and CIoU loss. S25. After training, the performance of the weld defect detection model is evaluated using a test set. The evaluation metrics include accuracy, recall, mean precision, and map-range metrics for multi-scale defects. S26. When the performance evaluation results of the weld defect detection model meet the conditions, save the trained model parameters.