Training method of weld defect detection model, weld defect detection method and system

CN122156918BActive Publication Date: 2026-08-28CGN CANGNAN NUCLEAR POWER CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610629972.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-09
Publication Date
2026-08-28
Estimated Expiration
2046-05-09

AI Technical Summary

Technical Problem

因受核电领域涉密因素的制约,虽然长输管线的焊缝缺陷图像数量较多,但核电设备的焊缝缺陷图像数量少之又少,这直接限制了深度学习识别算法的学习能力与识别精度

Benefits of technology

[0015]本发明的有益效果:本发明提出焊缝缺陷检测模型的训练方法、焊缝缺陷检测方法及系统,首先,通过将基础焊缝图像集合输入至DDPM扩散模型,生成若干新的核电设备焊缝图像,解决了无法获取足够的核电设备焊缝图像用来训练的问题。其次,依据基础焊缝图像集合和生成的核电设备焊缝图像以及各自对应的样本标签,分别形成不同的训练样本集。例如,将所述基础焊缝图像集合和生成的核电设备焊缝图像以及各自对应的样本标签,作为第一训练样本集。将所述基础焊缝图像集合中的核电设备焊缝图像及对应的样本标签,以及生成的核电设备焊缝图像及对应的样本标签,作为第二训练样本集。将具有预设缺陷类型的核电设备焊缝图像及对应的样本标签作为第三训练样本集。然后,分别通过第一训练样本集、第二训练样本集和第三训练样本集,分别对焊缝缺陷检测模型中的第一分支网络、第二分支网络和第三分支网络进行训练,整合训练完成的第一分支网络、第二分支网络和第三分支网络,得到训练完成的焊缝缺陷检测模型。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122156918B_ABST
    Figure CN122156918B_ABST
Patent Text Reader

Abstract

The application provides a training method of a weld defect detection model, a weld defect detection method and a system. The training method comprises the following steps: inputting a basic weld image set and generated nuclear power equipment weld images and respective corresponding sample labels into a first branch network for training; inputting the nuclear power equipment weld images in the basic weld image set and the corresponding sample labels, and the generated nuclear power equipment weld images and the corresponding sample labels into a second branch network for training; inputting nuclear power equipment weld images with a preset defect type and corresponding sample labels into a third branch network for training; and integrating the trained first branch network, the trained second branch network and the trained third branch network to obtain a trained weld defect detection model. The application trains multiple branch networks respectively by using different types of nuclear power equipment weld images, so that the detection and recognition accuracy of the weld defect detection model for different weld defect types is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of weld defect detection technology, and in particular to a training method for weld defect detection models, a weld defect detection method, and a system. Background Technology

[0002] In the nuclear power industry, piping systems, pressure vessels, cooling systems, and other critical components widely rely on precision welding technology to ensure their sealing and structural durability. Nuclear reactors and their auxiliary equipment often operate under extreme conditions such as high temperature, high pressure, and strong radioactivity for extended periods, thus requiring extremely stringent welding quality standards. Defects such as cracks, porosity, inclusions, and incomplete penetration in the welds, if not detected and addressed in a timely manner, can lead to serious safety accidents, threatening not only human lives but also potentially causing significant property damage.

[0003] Radiographic inspection technology can visually reveal the shape, size, and distribution of internal defects in weld materials. Deep learning recognition algorithms can effectively improve the intelligence and automation of this type of inspection. However, currently widely used deep learning recognition algorithms heavily rely on a large number of weld defect images during the training phase. Due to confidentiality constraints in the nuclear power sector, while there are many images of weld defects in long-distance pipelines, the number of images of weld defects in nuclear power equipment is extremely limited. This directly restricts the learning ability and recognition accuracy of deep learning recognition algorithms. Therefore, there are areas for improvement. Summary of the Invention

[0004] This invention provides a training method for a weld defect detection model, a weld defect detection method, and a system to improve the technical problem in the prior art where the limited number of weld defect images of nuclear power equipment restricts the learning ability and recognition accuracy of deep learning recognition algorithms.

[0005] This invention proposes a training method for a weld defect detection model, comprising: A set of basic weld seam images is obtained and input into the DDPM diffusion model to generate several new nuclear power equipment weld seam images. The set of basic weld seam images includes long-distance pipeline weld seam images as the main samples and nuclear power equipment weld seam images as supplementary samples. All long-distance pipeline weld seam images and all nuclear power equipment weld seam images have corresponding sample labels. The basic weld seam image set and the generated nuclear power equipment weld seam images, along with their corresponding sample labels, are used as the first training sample set and input into the first branch network of the weld seam defect detection model to be trained for training, thereby obtaining the trained first branch network; the weld seam defect detection model is a YOLO object detection model; The nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, are used as the second training sample set and input into the second branch network of the weld defect detection model to be trained for training, so as to obtain the trained second branch network. In the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images, the nuclear power equipment weld images with preset defect types and their corresponding sample labels are used as the third training sample set and input into the third branch network of the weld defect detection model to be trained for training, so as to obtain the trained third branch network. By integrating the first, second, and third branch networks that have been trained, a fully trained weld defect detection model is obtained.

[0006] In one embodiment of the present invention, the basic weld image set and the generated nuclear power equipment weld images, along with their corresponding sample labels, are used as a first training sample set and input into the first branch network of the weld defect detection model to be trained for training, resulting in a trained first branch network, including: The basic weld seam image set, the generated nuclear power equipment weld seam images, and their respective corresponding sample labels are used to form the first training sample set; The training samples in the first training sample set are input into the backbone network in the first branch network for feature extraction, resulting in multiple image content features with different dimensions and depths. The neck network in the first branch network is used to fuse all the image content features to obtain fused features; The fused features are predicted by the head network in the first branch network to obtain the corresponding prediction results; Based on the sample labels of the training samples and the corresponding prediction results, calculate the loss value of the loss function of the first branch network; Based on the loss value, the Adam optimizer is used to optimize the parameters of the first branch network to obtain the trained first branch network. The parameter optimization process iterates with a preset number of training batches and a total number of training rounds, and the learning rate decays from the initial learning rate according to the cosine annealing strategy.

[0007] In one embodiment of the present invention, the nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, are used as a second training sample set and input into the second branch network of the weld defect detection model to be trained for training, to obtain the trained second branch network, including: The nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, form a second training sample set; The training samples in the second training sample set are input into the backbone network in the second branch network for feature extraction, resulting in multiple image content features with different dimensions and depths. The neck network in the second branch network is used to fuse all the image content features to obtain fused features; The fused features are predicted by the head network in the second branch network to obtain the corresponding prediction results; Based on the sample labels of the training samples and the corresponding prediction results, calculate the loss value of the loss function of the second branch network; Based on the loss value, the Adam optimizer is used to optimize the parameters of the second branch network, resulting in the trained second branch network. The parameter optimization process iterates with a preset number of training batches and a total number of training rounds, and the learning rate decays from the initial learning rate using a cosine annealing strategy.

[0008] In one embodiment of the present invention, among the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images, nuclear power equipment weld images with preset defect types and their corresponding sample labels are used as a third training sample set and input into the third branch network of the weld defect detection model to be trained for training, to obtain the trained third branch network, including: The nuclear power equipment weld images in the basic weld image set, and the generated nuclear power equipment weld images, will form a third training sample set by including nuclear power equipment weld images with preset defect types and their corresponding sample labels. The training samples in the third training sample set are input into the backbone network in the third branch network for feature extraction, resulting in multiple image content features with different dimensions and depths. The neck network in the third branch network is used to fuse all the image content features to obtain fused features; The fused features are predicted using the head network in the third branch network to obtain the corresponding prediction results; Based on the sample labels of the training samples and the corresponding prediction results, calculate the loss value of the loss function of the third branch network; Based on the loss value, the Adam optimizer is used to optimize the parameters of the third branch network to obtain the trained third branch network. The parameter optimization process iterates with a preset number of training batches and a total number of training rounds, and the learning rate decays from the initial learning rate according to the cosine annealing strategy.

[0009] In one embodiment of the present invention, the first branch network, the second branch network and the third branch network share the same backbone network and each has an independent neck network and head network.

[0010] In one embodiment of the present invention, the loss function of the first branch network, or the loss function of the third branch... ,satisfy: ; in, This is expressed as the total loss of the first or third branch network. , , and Represented as a non-zero constant, , , and These are respectively represented as the location loss, mask loss, confidence loss, and classification loss of the first or third branch network.

[0011] In one embodiment of the present invention, the loss function of the second branch network satisfies: ; in, This is expressed as the total loss of the second branch network. , Represented as a non-zero constant, and These are represented as the location loss and classification loss of the second branch network, respectively.

[0012] This invention also proposes a weld defect detection method, which applies any of the weld defect detection models described above, including: The image of the weld to be detected is input into a pre-trained weld defect detection model; A first detection result is obtained through the first branch network of the weld defect detection model. The first detection result contains defect information for all defect types. The defect information includes defect type, defect location, and confidence level. All defect types are applicable to both long-distance pipeline welds and nuclear power equipment welds. The second detection result is obtained through the second branch network of the weld defect detection model. The second detection result contains defect information for all defect types. A third detection result is obtained through the third branch network of the weld defect detection model, and the third detection result contains defect information of a preset defect type; Based on the confidence levels of the first and second detection results, generate detection results for other defect types besides the preset defect types; based on the confidence levels of the first, second, and third detection results, generate detection results for the preset defect types.

[0013] This invention also proposes a training system for a weld defect detection model, comprising: The acquisition unit is used to acquire a set of basic weld seam images and input the set of basic weld seam images into the DDPM diffusion model to generate several new nuclear power equipment weld seam images; the set of basic weld seam images includes long-distance pipeline weld seam images as main samples and nuclear power equipment weld seam images as supplementary samples, and all long-distance pipeline weld seam images and all nuclear power equipment weld seam images have corresponding sample labels; The first training unit is used to input the basic weld seam image set and the generated nuclear power equipment weld seam images and their corresponding sample labels as the first training sample set into the first branch network of the weld seam defect detection model to be trained for training, so as to obtain the trained first branch network; the weld seam defect detection model is a YOLO object detection model; The second training unit is used to input the nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, as the second training sample set into the second branch network of the weld defect detection model to be trained, so as to obtain the trained second branch network. The third training unit is used to take the nuclear power equipment weld images with preset defect types and their corresponding sample labels from the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images as the third training sample set, and input them into the third branch network of the weld defect detection model to be trained for training, so as to obtain the trained third branch network. The integration unit is used to integrate the first, second, and third branch networks that have been trained to obtain a trained weld defect detection model.

[0014] The present invention also proposes a weld defect detection system, which applies the weld defect detection model as described above, including: The input unit is used to input the weld image to be detected into the pre-trained weld defect detection model; The first detection unit is used to obtain a first detection result through the first branch network of the weld defect detection model. The first detection result contains defect information for all defect types. The defect information includes defect type, defect location, and confidence level. All defect types are applicable to both long-distance pipeline welds and nuclear power equipment welds. The second detection unit is used to obtain a second detection result through the second branch network of the weld defect detection model. The second detection result contains defect information for all defect types. The third detection unit is used to obtain a third detection result through the third branch network of the weld defect detection model, and the third detection result includes defect information of a preset defect type. The generation unit is configured to generate detection results for other defect types besides preset defect types based on the confidence levels of the first and second detection results; and to generate detection results for preset defect types based on the confidence levels of the first, second, and third detection results.

[0015] The beneficial effects of this invention are as follows: This invention proposes a training method, a weld defect detection method, and a system for a weld defect detection model. First, by inputting a basic weld image set into the DDPM diffusion model, several new nuclear power equipment weld images are generated, solving the problem of not being able to obtain enough nuclear power equipment weld images for training. Second, based on the basic weld image set, the generated nuclear power equipment weld images, and their corresponding sample labels, different training sample sets are formed. For example, the basic weld image set, the generated nuclear power equipment weld images, and their corresponding sample labels are used as the first training sample set. The nuclear power equipment weld images and their corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and their corresponding sample labels, are used as the second training sample set. The nuclear power equipment weld images with preset defect types and their corresponding sample labels are used as the third training sample set. Then, the first branch network, the second branch network, and the third branch network in the weld defect detection model are trained using the first training sample set, the second training sample set, and the third training sample set, respectively. The trained first branch network, the second branch network, and the third branch network are integrated to obtain the trained weld defect detection model. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0017] In the attached diagram: Figure 1 This is a schematic diagram illustrating the steps of a training method for a weld defect detection model provided in an embodiment of the present invention.

[0018] Figure 2The diagram below illustrates the working principle of the training and sampling processes of the DDPM diffusion model in the training method for a weld defect detection model provided in an embodiment of the present invention.

[0019] Figure 3 The structural block diagram of the weld defect detection model is shown in the training method of the weld defect detection model provided in an embodiment of the present invention.

[0020] Figure 4 This is a schematic diagram of the steps of a weld defect detection method provided in an embodiment of the present invention.

[0021] Figure 5 This is a structural block diagram of a training system for a weld defect detection model provided in an embodiment of the present invention.

[0022] Figure 6 This is a structural block diagram of a weld defect detection system provided in an embodiment of the present invention. Detailed Implementation

[0023] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0024] Please see Figures 1 to 6 This invention proposes a training method, a weld defect detection method, and a system for a weld defect detection model, applicable to the nuclear power field, such as intelligent weld defect detection in nuclear power plants. Based on the deep learning-based DDPM (Denoising Diffusion Probabilistic Models) algorithm, this invention achieves scene transfer of nuclear power equipment defect data, solving the problem of insufficient weld (defect) images for training. It utilizes a multi-branch weld defect detection model specifically designed for this scenario, leveraging the complementary advantages of each branch to more accurately identify the types of weld defects of key concern in this scenario. This invention is not only applicable to weld defect detection tasks in the nuclear power field but also has significant reference value in other fields where high-quality training data is difficult to obtain, such as critical military fields like medicine and aerospace. Detailed descriptions are provided below using specific embodiments.

[0025] Please see Figure 1 The present invention proposes a training method for a weld defect detection model, which may include the following steps.

[0026] Step S10: Obtain a set of basic weld seam images and input the set of basic weld seam images into the DDPM diffusion model to generate several new nuclear power equipment weld seam images; the set of basic weld seam images includes long-distance pipeline weld seam images as main samples and nuclear power equipment weld seam images as supplementary samples, and all long-distance pipeline weld seam images and all nuclear power equipment weld seam images have corresponding sample labels.

[0027] Specifically, a basic set of weld images is obtained, which includes long-distance pipeline weld images as the main samples and nuclear power equipment weld images as supplementary samples. All images are labeled accordingly. The long-distance pipeline weld images are from publicly available or collaborative long-distance pipeline radiographic inspection projects, while the nuclear power equipment weld images are from some available nuclear power equipment maintenance records.

[0028] Due to the limited number of weld seam images for nuclear power equipment, the basic weld seam image set was input into the DDPM diffusion model to expand the training samples. The DDPM diffusion model's scene transfer capability was used to generate several new nuclear power equipment weld seam images, and the corresponding sample labels for these new images were confirmed. The generation process employed a U-Net-based noise prediction network based on an attention mechanism. Sampling was performed with a diffusion step count of 4000 and a linearly increasing noise variance coefficient. The generated images closely resembled real nuclear power plant scenes in terms of texture, defect morphology, and background features, effectively alleviating the problem of scarce training data for nuclear power equipment weld seam images in nuclear power plant scenarios.

[0029] like Figure 2 As shown, in one embodiment of the present invention, the DDPM (Denoising Diffusion Probabilistic Models) diffusion model is trained on a set of basic weld images in long-distance pipeline scenarios and a small number of nuclear power equipment scenarios to generate new nuclear power equipment weld images that partially conform to the characteristics of nuclear power equipment scenarios. Then, a new training set is formed by generalizing the new nuclear power equipment weld images and their corresponding sample labels to the basic weld image set. The DDPM diffusion model is iteratively trained to fine-tune it, gradually enhancing its ability to generate weld defect feature images in nuclear power equipment scenarios for use in training subsequent weld defect detection models. Step S10 may include the following steps.

[0030] Step S11: Scan the film using a radiographic film scanner to obtain multiple basic weld seam images. These multiple basic weld seam images mainly consist of weld seam images from long-distance pipeline scenes and some nuclear power equipment scenes.

[0031] Step S12: Mark weld defects in the weld images of different scenarios collected above, and then process the images using offline data enhancement methods such as translation, rotation, cropping, scaling, contrast adjustment, brightness adjustment, and noise addition. At the same time, process the corresponding label data synchronously to form a basic weld image set D0, with a data volume of approximately 160,000 images.

[0032] Step S13: Pre-train the DDPM model on the basic weld image set D0 to enable it to learn the weld defect features under different scenarios and establish a basic defect generation capability.

[0033] Step S14: After obtaining the pre-trained DDPM model, the DDPM model is further fine-tuned using the nuclear power equipment weld seam image training dataset D1, which is similar to the weld seam (defect) images and background features in the nuclear power equipment scenario. This allows the DDPM model to better understand and simulate the weld seam defect features in the nuclear power equipment scenario. The dataset D1 is a part of D0, and the data volume is approximately 30,000 images.

[0034] Step S15: Generate a large number of nuclear power equipment weld images using the fine-tuned DDPM model, and filter out those images that match the defects and background features of the nuclear power equipment. In particular, filter out images that match the defect features of the nuclear power equipment welds.

[0035] Step S16: Merge the selected nuclear power equipment weld seam images with the original nuclear power equipment weld seam image training dataset D1 to form training set D2. Based on this training set D2, fine-tune the DDPM model again, iterating this fine-tuning process repeatedly to further optimize its ability to generate defect images in specific scenarios. In this embodiment, the fine-tuning training is performed three times.

[0036] Step 17: Using the DDPM model, which has undergone three rounds of fine-tuning and optimization, new weld seam images of nuclear power equipment are generated. Data that meets the conditions of a nuclear power plant scenario is selected, and defects are labeled to form the nuclear power equipment weld seam image training dataset D3. After offline data augmentation, the dataset contains approximately 9,000 images. Together with the basic weld seam image set D0, it serves as the dataset for training the deep learning weld defect detection model, ensuring that the training data remains highly specific to the target nuclear power equipment scenario.

[0037] like Figure 2 As shown, in step S10, the basic weld seam image set is input into the DDPM diffusion model to generate several new nuclear power equipment weld seam images, which may include the training process and sampling process of the DDPM diffusion model. The training process and sampling process of the DDPM diffusion model are as follows.

[0038] Training process of DDPM diffusion model: Initialization parameters: Set the total number of diffusion steps to 1. Define a noise variance control coefficient sequence The value is a sequence that linearly increases from 0.0001 to 0.02. The number of training epochs for the noisy model is set to 800, the batch size is 64, and the initial learning rate is 0.0008. The noisy model is a U-Net model with an added attention module.

[0039] Forward process: This process generates training samples and corresponding sample labels for each nuclear power equipment weld image. The diffusion steps start from Calculate the noisy samples according to the following formula. , This formula can be recursively applied to training samples corresponding to weld images of nuclear power equipment. get, This is noise sampled from a standard normal distribution.

[0040] , ; .

[0041] in, Represented as diffusion step The corresponding noise variance control coefficients, Represented as diffusion step The corresponding noisy samples, This represents the true conditional probability distribution of the forward diffusion process, used to describe the situation where the noisy sample from the previous time step is known. At that time, generate noisy samples for the current moment. A fixed probability model.

[0042] Training the noisy model: The training samples generated in the previous step Above, a convolutional neural network based on Unet (U-shaped network) with an added attention module is trained as a noise prediction model to predict the noise added at each step of the forward pass. The loss function is the pixel-wise mean squared error, as shown in the following formula:

[0043] in, ,and .

[0044] Iterative optimization training: Continuously iterate the above steps to improve the noisy model of the convolutional neural network. The parameters are adjusted until the predetermined number of iterations is reached.

[0045] Sampling process of DDPM diffusion model: Initialize model input: from standard Gaussian distribution Sampling a random noise sample .

[0046] Reverse process: For The noise model based on Unet (U-shaped network) trained as described above. Predicted noise In the initial Gaussian noise Based on this, noise is gradually removed, calculated using the following formula.

[0047] ; in, , .

[0048] This is represented as the parameterized conditional probability distribution of the reverse process. Represented as the parameterized mean of the reverse process, Represented as the covariance matrix of the reverse process, Represented as diffusion step The signal preservation coefficient, Represented as diffusion step The cumulative product of the signal preservation coefficients, Represented as diffusion step The cumulative product of the signal retention coefficients.

[0049] Finally obtained This refers to the new nuclear power equipment weld images learned from the DDPM diffusion model.

[0050] Step S20: The basic weld seam image set and the generated nuclear power equipment weld seam images and their corresponding sample labels are used as the first training sample set and input into the first branch network of the weld seam defect detection model to be trained for training, so as to obtain the first branch network after training; the weld seam defect detection model is the YOLO (You Only LookOnce) target detection model.

[0051] The weld defect detection model is a multi-branch target detection model based on the improved YOLO architecture. The first branch adopts an anchor-based detection segmentation head based on YOLOv5, and the C3 module in the original structure is replaced with a more efficient convolutional module (C2F, Cross-stage Partial with 2Feature Fusions) with stronger feature extraction capabilities.

[0052] In one embodiment of the present invention, step S20 may include the following steps.

[0053] Step S21: Combine the basic weld seam image set, the generated nuclear power equipment weld seam image, and their respective sample labels to form the first training sample set.

[0054] Specifically, the basic weld seam image set and the generated nuclear power equipment weld seam images, along with their corresponding sample labels, form the first training sample set. The first training sample set contains approximately 169,000 weld seam images from long-distance pipeline and nuclear power equipment scenarios, covering nine defect categories: cracks, porosity, inclusions, incomplete penetration, lack of fusion, undercut, weld beads, dents, and burn-through. The annotations conform to relevant non-destructive testing standards such as GB / T 3323-2005 or ISO 17636-1. Each image in the first training sample set has an annotated defect bounding box and category label. Before training, online data augmentation operations are performed on the first training sample set, including random cropping, horizontal and vertical flipping, brightness and contrast adjustment, image scaling, translation transformation, slight rotation, and mosaic enhancement, to improve the diversity of the first training samples and the model's generalization ability, while reducing the risk of overfitting.

[0055] Specifically, the basic architecture of the first branch network is constructed, and the model structure parameters are initialized. This network includes a backbone network for feature extraction, a neck network for multi-scale feature fusion, and a head network for prediction. Before training begins, to ensure the stability and convergence efficiency of model training, the weight parameters of all convolutional layers are initialized using the Kaiming initialization (He initialization) method.

[0056] Specifically, the weights of each convolutional layer ,satisfy The weights of each convolutional layer From a mean of 0 and a standard deviation of Random sampling from a normal distribution, where This indicates the number of input channels for this layer.

[0057] This initialization method helps alleviate the vanishing or exploding gradient problem, enabling the network to maintain the stability of activation value distribution in the early stages of training, thus laying a numerical foundation for subsequent feature extraction and optimization. Furthermore, the initial anchor box size used for detection in the head network has been learned from the first training sample set using the K-means clustering algorithm and embedded as prior information in the detection head.

[0058] Step S22: Input the training samples in the first training sample set into the backbone network of the first branch network for feature extraction to obtain multiple image content features with different dimensions and depths.

[0059] Specifically, such as Figure 3 As shown, the weld defect detection model is a multi-branch object detection model based on an improved YOLO architecture. The first branch uses an anchor-based detection and segmentation head based on YOLOv5. Training samples from the first training sample set, after online data augmentation, are batch-input into the backbone of the first branch network for multi-level feature extraction. This backbone network adopts an improved Cross-Stage Partial Darknet (CSPDarknet) architecture, replacing the original C3 module with a more efficient convolutional module (C2F, Cross-Stage Partial with 2 Feature Fusions) for stronger feature reuse. Through layer-by-layer convolution and cross-stage local connections, multiple image content features P1, P2, P3, P4, and P5 with different spatial dimensions and semantic depths are extracted from the input image. These features P1, P2, P3, P4, and P5 correspond to defect information at different scales. For example, low-level features contain edge and texture details, while high-level features contain semantic and contextual information, together forming the bottom output of the multi-scale feature pyramid.

[0060] Step S23: Perform feature fusion on all the image content features through the neck network in the first branch network to obtain fused features.

[0061] Specifically, such as Figure 3As shown, the neck network in the first branch performs cross-scale fusion and semantic enhancement on multiple image content features output by the backbone network. This neck network employs a path aggregation network and a feature pyramid structure, effectively integrating the semantic information of high-level features with the localization information of low-level features through bidirectional paths from top to bottom and bottom to top. It also performs convolutional processing on feature maps of different resolutions to obtain semantically rich and accurately localized fused features. This process enhances the model's ability to identify multi-scale defects, especially showing better robustness to defects in small targets and those in complex backgrounds.

[0062] like Figure 3 As shown, the convolutional module (Conv) is used to extract image features. The efficient convolutional module (C2f, Cross-stage Partial with 2 Feature Fusions) enhances feature extraction capabilities. The upsampling module (Up) improves the feature map resolution to meet multi-scale detection requirements. The basic convolutional module (C) is a simplified version of the feature extraction unit.

[0063] Step S24: Predict the fused features through the head network in the first branch network to obtain the corresponding prediction results.

[0064] Specifically, such as Figure 3 As shown, the head network in the first branch network predicts the fused features and outputs the corresponding defect detection results. This head network is an anchor-based detection and segmentation head based on YOLOv5, including a decoupling head and a segmentation head structure, which are responsible for bounding box regression, class prediction, and mask segmentation, respectively. In the early stage of training, the K-means clustering method is used to cluster the sizes of all defect bounding boxes in the first training sample set, generating 9 sets of representative initial anchor box sizes, which are used as the prior boxes for the head network. The head network decodes the fused features through convolutional layers, predicting the bounding box coordinates, confidence score, class probability, and segmentation mask corresponding to each anchor box, thereby obtaining the prediction results for each training sample.

[0065] like Figure 3 As shown, the specific structure of the coupled detection head is as follows: Figure 3The dashed box at the bottom contains 2D convolutional modules (Conv2d) and channels. The channels can be represented as: channels: 3*(nc+5+nm), which is 3 anchor boxes × (number of classes + 5 bounding box parameters + number of masks). The loss functions corresponding to the coupled detection head include bounding box regression loss (Bbox), target confidence loss (obj), complete intersection over union (CIoU) loss, and binary cross-entropy loss (BCE).

[0066] like Figure 3 As shown, the specific structure of the segment head is as follows: Figure 3 The dashed box at the bottom includes the convolutional module (Conv), the upsampling module (Up), and the masking module (nm). The loss function corresponding to the segmentation head includes the Binary Cross Entropy Loss (BCE).

[0067] Step S25: Calculate the loss value of the loss function of the first branch network based on the sample labels of the training samples and the corresponding prediction results.

[0068] Specifically, based on the real sample labels of the training samples and their corresponding prediction results, the loss function of the first branch network is calculated. The loss function is a weighted combination of location loss, mask loss, confidence loss, and classification loss. The location loss uses Complete Intersection over Union (CIoU) to optimize bounding box regression accuracy, the mask loss uses a binary cross-entropy loss function for segmentation, and both the confidence loss and classification loss use cross-entropy loss functions. The weights of each loss term are set to 0.05, 0.05, 0.7, and 0.3, respectively. The weighted summation yields the comprehensive loss value, which reflects the difference between the current model's prediction results and the real labels, guiding subsequent parameter optimization.

[0069] In one embodiment of the present invention, the loss function of the first branch network satisfies: ; in, This is expressed as the total loss of the first branch network. , , and Represented as a non-zero constant, , , and These are respectively represented as the location loss, mask loss, confidence loss, and classification loss of the first branch network.

[0070] Step S26: Based on the loss value, the Adam (Adaptive Moment Estimation) optimizer is used to optimize the parameters of the first branch network to obtain the trained first branch network. The parameter optimization process iterates with a preset number of training batches and total training rounds, and the learning rate decays from the initial learning rate according to the cosine annealing strategy.

[0071] Specifically, based on the calculated loss value, the Adam optimizer is used to perform backpropagation and gradient updates on all trainable parameters in the first branch network to optimize the parameters. During the optimization process, the training batch size is set to 128, the total number of training epochs is 150, and the learning rate adopts a cosine annealing decay strategy, with the initial learning rate set to 0.001, which gradually decreases to near zero according to the cosine curve during training.

[0072] After each iteration, the network weights are adjusted based on the loss value until the preset number of training epochs is reached or the loss converges, ultimately resulting in the first branch network that has been trained. This network is capable of detecting nine common defects from weld seam images in multiple scenarios, providing a stable feature extraction foundation for the training of subsequent branches.

[0073] Step S30: Take the nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, as the second training sample set, and input them into the second branch network of the weld defect detection model to be trained for training, so as to obtain the trained second branch network.

[0074] In one embodiment of the present invention, step S30 includes the following steps.

[0075] Step S31: Combine the nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, to form a second training sample set.

[0076] Step S32: Input the training samples in the second training sample set into the backbone network of the second branch network for feature extraction to obtain multiple image content features with different dimensions and depths.

[0077] Step S33: Perform feature fusion on all the image content features through the neck network in the second branch network to obtain fused features.

[0078] Step S34: Predict the fused features through the head network in the second branch network to obtain the corresponding prediction results.

[0079] Specifically, such as Figure 3 As shown, the head network is a decoupled detection head, and its specific structure is as follows: Figure 3 As shown in the bottom dashed box, the decoupled detection head includes a convolutional module (Conv), a 2D convolutional module (Conv2d), a module for maximum number of discretization intervals for bounding box regression (4*reg_max), and a module for the number of defect categories (nc). The branch of the maximum number of discretization intervals in the decoupled detection head uses the Complete Intersection over Union (CIoU) loss function and the Distribution Focal Loss (DFL) loss function. The branch of the number of defect categories in the decoupled detection head uses the Binary Cross Entropy (BCE) loss function.

[0080] Step S35: Calculate the loss value of the loss function of the second branch network based on the sample labels of the training samples and the corresponding prediction results.

[0081] Step S36: Based on the loss value, the Adam optimizer is used to optimize the parameters of the second branch network to obtain the trained second branch network. The parameter optimization process iterates with a preset number of training batches and total training rounds, and the learning rate decays from the initial learning rate according to the cosine annealing strategy.

[0082] Specifically, firstly, the nuclear power equipment weld images in the basic weld image set are merged with the generated nuclear power equipment weld images to form a second training sample set. This sample set mainly focuses on nuclear power equipment scenarios, includes the aforementioned nine defect categories, and contains approximately 95,000 images. Before being input into the second branch network, the samples undergo online data augmentation processing, including random cropping, flipping, brightness and contrast adjustment, scaling, translation, slight rotation, and mosaic enhancement, to improve data diversity and model generalization ability.

[0083] Next, the architecture of the second branch network is constructed. This branch shares the same backbone network as the first branch, and its parameters were frozen after the first branch was trained to retain general feature extraction capabilities. The second branch has independent neck and head networks: the neck network adopts a feature pyramid structure to fuse multi-scale features from the backbone network. The head network is based on YOLOv8's anchor-based detection mechanism, directly predicting defect bounding boxes and class probabilities without pre-setting anchor boxes, making it more suitable for defect targets with large aspect ratio variations. Before training begins, the weights of the newly added convolutional layers in this branch are initialized using the Kaiming initialization method to ensure training stability.

[0084] Subsequently, the enhanced second training sample was input into the network for training. During training, the input image resolution was uniformly adjusted to 640×640 pixels, the batch size was set to 128, and the total number of training epochs was 150. The optimization process used the Adam optimizer, with a cosine annealing learning rate initially set to 0.001. The loss function consisted of a weighted average of location regression loss and classification loss, and the network parameters were progressively optimized through backpropagation and gradient updates.

[0085] Finally, after complete training, the second branch network is obtained. This branch focuses on defect detection in nuclear power equipment scenarios. Through complementary design with the first branch, it improves the model's accuracy and adaptability in identifying defects with varying shapes in nuclear power scenarios.

[0086] In one embodiment of the present invention, the loss function of the second branch network satisfies: ; in, This is expressed as the total loss of the second branch network. , Represented as a non-zero constant, and These are represented as the location loss and classification loss of the second branch network, respectively.

[0087] Step S40: In the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images, the nuclear power equipment weld images with preset defect types and their corresponding sample labels are used as the third training sample set and input into the third branch network of the weld defect detection model to be trained for training, so as to obtain the trained third branch network.

[0088] In one embodiment of the present invention, step S40 may include the following steps.

[0089] Step S41: From the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images, the nuclear power equipment weld images with preset defect types and their corresponding sample labels are used to form a third training sample set.

[0090] Step S42: Input the training samples in the third training sample set into the backbone network of the third branch network for feature extraction to obtain multiple image content features with different dimensions and depths.

[0091] Step S43: Perform feature fusion on all the image content features through the neck network in the third branch network to obtain fused features.

[0092] Step S44: Predict the fused features through the head network in the third branch network to obtain the corresponding prediction results.

[0093] Step S45: Calculate the loss value of the loss function of the third branch network based on the sample labels of the training samples and the corresponding prediction results.

[0094] Step S46: Based on the loss value, the Adam optimizer is used to optimize the parameters of the third branch network to obtain the trained third branch network. The parameter optimization process iterates with a preset number of training batches and total training rounds, and the learning rate decays from the initial learning rate according to the cosine annealing strategy.

[0095] Specifically, firstly, from the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images, image samples belonging to four preset key defect types are selected to form a third training sample set. These four defect types include cracks, incomplete penetration, lack of fusion, and inclusions. These defects pose higher safety risks and are more difficult to detect in nuclear power plant scenarios. To improve the diversity and class balance of the samples, offline data augmentation processing is performed on the selected images, including operations such as flipping, rotating, scaling, and contrast enhancement. Oversampling is also performed on defect categories with fewer samples, ultimately resulting in a training set of approximately 16,000 images. Before training, this set is further augmented online, such as through random cropping and mosaic enhancement, to enhance the model's robustness to noise and deformation.

[0096] Next, the images from the third training sample set are input into the third branch network. This branch shares the same backbone network as the first and second branches, and the backbone network parameters are frozen to retain the general feature extraction capabilities obtained in the previous training. The third branch has independent neck and head networks. Its head adopts a YOLOv5-based anchor-based detection and segmentation structure, and the original C3 module is replaced with an efficient convolutional module (C2F, Cross-stage Partial with 2 Feature Fusions) to improve feature reuse and propagation efficiency. Before training begins, the weights of the newly added convolutional layers in this branch are initialized using the Kaiming initialization method. In addition, the K-means clustering method is used to cluster the defect bounding box sizes in the third training sample set, generating 9 initial anchor boxes as prior boxes for the detection head.

[0097] The training process was then initiated. The input image resolution was uniformly adjusted to 640×640 pixels, the training batch size was set to 64, and the total number of training epochs was 150. The optimizer used was Stochastic Gradient Descent (SGD), with a cosine annealing learning rate initially set to 0.001. The loss function consisted of a weighted average of location loss, mask loss, confidence loss, and classification loss, and the network parameters were continuously optimized through backpropagation during training.

[0098] Finally, the third branch network was obtained after complete training. This branch is specifically optimized for four types of key defects in nuclear power plant scenarios. By focusing on learning their morphological, textural, and background features, it significantly improves the detection sensitivity and localization accuracy of these high-risk defects, thereby enhancing the reliability and practicality of the entire system in nuclear power safety inspection.

[0099] In one embodiment of the invention, the loss function of the third branch ,satisfy: ; in, This is expressed as the total loss of the third branch network. , , and Represented as a non-zero constant, , , and These are respectively represented as the location loss, mask loss, confidence loss, and classification loss of the third branch network.

[0100] It should be noted here that, as Figure 3As shown, the architectures of the first and third branch networks are the same, therefore similar loss functions are used. However, this does not mean that in the loss function of the first branch and the loss function of the third branch, , , and , , , and The same applies. It should be understood that because the input training sample sets are different in the first and third branch networks, the parameter adjustments made in the branch networks based on the loss function are completely independent of each other.

[0101] Step S50: Integrate the first branch network, the second branch network, and the third branch network after training to obtain the trained weld defect detection model.

[0102] Specifically, after the independent training of the first, second, and third branches, these three branches are integrated to form a complete weld defect detection model. The weld defect detection model shares the same backbone feature extraction network but has three structurally independent and functionally complementary detection heads. During inference, the integrated weld defect detection model can execute the predictions of the three branches in parallel. Through post-processing steps such as confidence thresholding, coordinate mapping, and non-maximum suppression of the detection results output by each branch, the final weld defect identification result is generated by fusion.

[0103] Specifically, for long-distance pipeline defect types, the confidence level output of the first branch is mainly used as the basis. For general defect types in nuclear power equipment, the confidence levels of the first and second branches are combined for judgment. For the four preset key defect types in nuclear power equipment, the confidence level of the third branch is further combined for decision-making, thereby achieving high-precision and high-coverage intelligent identification of weld defects.

[0104] Please see Figure 4 In one embodiment of the present invention, a weld defect detection method is proposed, which applies the weld defect detection model as described above and includes the following steps.

[0105] Step S100: Input the weld image to be detected into the pre-trained weld defect detection model.

[0106] Specifically, the weld radiographic images to be detected undergo adaptive preprocessing and block processing, and are then input into a pre-trained weld defect detection model.

[0107] First, the input image undergoes adaptive window width and level adjustment. This is achieved by calculating its grayscale histogram, merging adjacent grayscale intervals, and selecting the effective grayscale interval with the highest pixel frequency as the basis for window width and level adjustment. The image is then normalized to enhance the contrast and visual effect of the weld area. Next, the preprocessed image is cropped into several identical square sub-images along its width with an overlap rate of one-eighth. The resolution of each sub-image is uniformly adjusted to 640×640 pixels to meet the model's input requirements. Finally, all the sub-image blocks are sequentially input into the weld defect detection model for parallel inference.

[0108] For example, first, calculate the grayscale histogram of the input image, using the following formula: ; .

[0109] in, Represented as preset pixel values, Represented as coordinates in the input image The pixel value at the point.

[0110] The formula for finding the set of pixel values ​​with a frequency greater than 0 is as follows: .

[0111] Calculate the pixel value difference between adjacent non-zero frequency pixel values. The formula is as follows: If Less than the preset threshold =20 (in the 8-bit image data dimension), then merge into one interval.

[0112] .

[0113] After merging the intervals, the total frequency of pixel values ​​in each interval is counted.

[0114] If a certain interval range is greater than the interval range threshold =14 (in the 8-bit image data dimension), and the total frequency within the interval is greater than (image width * image height) * scale factor threshold. If the value is 0.16, then this interval is considered a candidate grayscale interval for valid image content.

[0115] Sort the candidate grayscale intervals in descending order of total frequency and select the interval with the highest frequency. That is, window width value for Window position value for Then round down. Apply this window width and level adjustment processing to the input image while normalizing it, as shown in the following formula: ; in, These are the pixel values ​​of the original image. These are the pixel values ​​of the processed image.

[0116] Step S200: Obtain a first detection result through the first branch network of the weld defect detection model. The first detection result contains defect information for all defect types. The defect information includes defect type, defect location, and confidence level. All defect types are applicable to both long-distance pipeline welds and nuclear power equipment welds.

[0117] Specifically, the first branch network of the weld defect detection model processes each input sub-image to obtain the first detection result. Based on pre-trained general defect detection capabilities, the first branch network outputs detection information covering all nine types of defects in long-distance pipelines and nuclear power equipment scenarios, including defect category, bounding box location, and corresponding confidence score. This branch's detection result has broad defect coverage, providing basic detection suggestions for subsequent result fusion.

[0118] Step S300: Obtain a second detection result through the second branch network of the weld defect detection model. The second detection result contains defect information for all defect types.

[0119] Specifically, the second branch network of the weld defect detection model processes the same input sub-image to obtain a second detection result. This second branch network focuses on nuclear power equipment scenarios, employing an anchor-free detection mechanism to output detection information for all nine types of defects in nuclear power equipment welds, including defect category, location, and confidence level. This branch result, based on the first branch, further enhances the adaptability to detecting defects with varying morphologies in nuclear power environments.

[0120] Step S400: Obtain a third detection result through the third branch network of the weld defect detection model. The third detection result contains defect information of a preset defect type.

[0121] Specifically, the third branch network of the weld defect detection model processes the same input sub-image to obtain a third detection result. This third branch network is specifically optimized for four pre-defined key defect types in nuclear power equipment scenarios, outputting defect detection information including cracks, incomplete penetration, lack of fusion, and inclusions. Through targeted training, this branch exhibits higher detection sensitivity and location accuracy for these high-risk defects.

[0122] Step S500: Based on the confidence level of the first detection result and the confidence level of the second detection result, generate detection results for other defect types besides the preset defect types; based on the confidence level of the first detection result, the confidence level of the second detection result, and the confidence level of the third detection result, generate detection results for the preset defect types.

[0123] Specifically, the detection results output from the three branches are fused and post-processed to generate the final weld defect identification result.

[0124] Since the first branch network outputs defect information for all defect types, the second branch network also outputs defect information for all defect types, while the third branch network outputs defect information for preset defect types. It should be understood that when the input weld image to be detected is actually one of the preset defect types, the confidence level of the third branch network output is higher. Therefore, based on the confidence levels of the first, second, and third detection results, detection results for the preset defect types can be generated. Consistent with the above, all defect types can cover nine categories: cracks, porosity, inclusions, incomplete penetration, lack of fusion, undercut, weld beads, dents, and burn-through.

[0125] In addition, if the third branch network does not output the preset defect type, or the confidence of the output preset defect type is low, it is highly likely that the input weld image to be detected is not actually the preset defect type. Therefore, based on the confidence of the first detection result and the confidence of the second detection result, detection results for other defect types besides the preset defect type are generated.

[0126] In one embodiment of the present invention, the first branch network is trained using a set of basic weld seam images, generated nuclear power equipment weld seam images, and their corresponding sample labels; the second branch network is trained using nuclear power equipment weld seam images and their corresponding sample labels from the set of basic weld seam images, as well as generated nuclear power equipment weld seam images and their corresponding sample labels; and the third branch network is trained using nuclear power equipment weld seam images with preset defect types and their corresponding sample labels. Therefore, in a scenario where the weld seam image to be detected is input into a pre-trained weld defect detection model for detection, the detection results output by the three branch networks of the weld defect detection model can be processed as follows. Of course, since the weld defect detection model is pre-trained, its training results will differ based on different training sample sets. Only one specific example is given here; other examples are possible for the processing results of the above-described weld defect detection model.

[0127] First, for the types of defects in long-distance pipelines, the confidence level of each defect in the first detection result can be used for screening, and defect identification results that are higher than the preset threshold can be retained.

[0128] For other defect types in nuclear power equipment besides the four preset categories, the final identification result can be determined by combining the confidence levels of the first and second detection results and using a weighted or optimal strategy.

[0129] For the four types of key defects pre-defined in nuclear power equipment, the confidence level of the third detection result can be further combined to perform multi-branch result fusion, and the identification result with the highest confidence level can be selected as the output.

[0130] All recognition results are mapped back to the original image coordinate system, and then Non-Maximum Suppression (NMS) processing is performed. The Intersection over Union (IoU) threshold is set to 0.6 to eliminate overlapping recognition areas. Finally, the weld defect recognition results with defect category, location coordinates and confidence score are output, thus completing the intelligent recognition process.

[0131] Please see Figure 5 The present invention proposes a training system 10 for a weld defect detection model, including an acquisition unit 11, a first training unit 12, a second training unit 13, a third training unit 14 and an integration unit 15.

[0132] The acquisition unit 11 is used to acquire a set of basic weld seam images and input the set of basic weld seam images into the DDPM diffusion model to generate several new nuclear power equipment weld seam images. The set of basic weld seam images includes long-distance pipeline weld seam images as main samples and nuclear power equipment weld seam images as supplementary samples, and all long-distance pipeline weld seam images and all nuclear power equipment weld seam images have corresponding sample labels.

[0133] The first training unit 12 is used to input the basic weld seam image set and the generated nuclear power equipment weld seam image and their respective corresponding sample labels as the first training sample set into the first branch network of the weld seam defect detection model to be trained for training, so as to obtain the trained first branch network; the weld seam defect detection model is a YOLO target detection model.

[0134] The second training unit 13 is used to input the nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, as the second training sample set, into the second branch network of the weld defect detection model to be trained for training, so as to obtain the trained second branch network.

[0135] The third training unit 14 is used to input the nuclear power equipment weld images with preset defect types and their corresponding sample labels into the third branch network of the weld defect detection model to be trained, from the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images, as the third training sample set, to obtain the trained third branch network.

[0136] Integration unit 15 is used to integrate the first branch network, the second branch network and the third branch network after training to obtain the trained weld defect detection model.

[0137] Please see Figure 6 In one embodiment of the present invention, a weld defect detection system 100 is also proposed, which applies the weld defect detection model as described above, including an input unit 110, a first detection unit 120, a second detection unit 130, a third detection unit 140 and a generation unit 150.

[0138] The input unit 110 is used to input the weld image to be detected into the pre-trained weld defect detection model.

[0139] The first detection unit 120 is used to obtain a first detection result through the first branch network of the weld defect detection model. The first detection result contains defect information for all defect types. The defect information includes defect type, defect location, and confidence level. All defect types are applicable to both long-distance pipeline welds and nuclear power equipment welds.

[0140] The second detection unit 130 is used to obtain a second detection result through the second branch network of the weld defect detection model. The second detection result contains defect information for all defect types.

[0141] The third detection unit 140 is used to obtain a third detection result through the third branch network of the weld defect detection model, and the third detection result includes defect information of a preset defect type.

[0142] The generation unit 150 is used to generate detection results for other defect types besides the preset defect type based on the confidence level of the first detection result and the confidence level of the second detection result; and to generate detection results for the preset defect type based on the confidence level of the first detection result, the confidence level of the second detection result and the confidence level of the third detection result.

[0143] This invention proposes a training method, a weld defect detection method, and a system for a weld defect detection model. First, by inputting a basic set of weld images into a DDPM diffusion model, several new nuclear power equipment weld images are generated, solving the problem of insufficient nuclear power equipment weld images for training. Second, different training sample sets are formed based on the basic set of weld images, the generated nuclear power equipment weld images, and their corresponding sample labels. For example, the basic set of weld images, the generated nuclear power equipment weld images, and their corresponding sample labels are used as the first training sample set. The nuclear power equipment weld images and their corresponding sample labels in the basic set of weld images, as well as the generated nuclear power equipment weld images and their corresponding sample labels, are used as the second training sample set. The nuclear power equipment weld images with preset defect types and their corresponding sample labels are used as the third training sample set. Then, the first branch network, the second branch network, and the third branch network in the weld defect detection model are trained using the first, second, and third training sample sets, respectively. The trained first, second, and third branch networks are then integrated to obtain the trained weld defect detection model.

[0144] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method for detecting weld defects, characterized in that, include: The image of the weld to be detected is input into a pre-trained weld defect detection model; The first detection result is obtained through the first branch network of the weld defect detection model. The first detection result includes defect information of all defect types of welds in long-distance pipelines and nuclear power equipment. The defect information includes defect type, defect location, and confidence level; The second detection result is obtained through the second branch network of the weld defect detection model. The second detection result contains defect information of all defect types of nuclear power equipment welds. A third detection result is obtained through the third branch network of the weld defect detection model. The third detection result includes defect information of the preset defect type of the nuclear power equipment weld. When the input weld to be detected is a defect type for long-distance pipelines, the identification results are output based on the confidence level of each defect in the first detection result; When the input weld to be inspected is a defect type other than the preset defect type for nuclear power equipment, the inspection results for other defect types are generated based on the confidence level of the first inspection result and the confidence level of the second inspection result. When the input weld to be inspected is a preset defect type for nuclear power equipment, the detection result of the preset defect type is generated based on the confidence level of the first detection result, the confidence level of the second detection result, and the confidence level of the third detection result. The training methods for the weld defect detection model include: A set of basic weld seam images is obtained and input into the DDPM diffusion model to generate several new nuclear power equipment weld seam images. The set of basic weld seam images includes long-distance pipeline weld seam images as the main samples and nuclear power equipment weld seam images as supplementary samples. All long-distance pipeline weld seam images and all nuclear power equipment weld seam images have corresponding sample labels. The basic weld seam image set and the generated nuclear power equipment weld seam images, along with their corresponding sample labels, are used as the first training sample set and input into the first branch network of the weld seam defect detection model to be trained for training, thereby obtaining the trained first branch network; the weld seam defect detection model is a YOLO object detection model; The nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, are used as the second training sample set and input into the second branch network of the weld defect detection model to be trained for training, so as to obtain the trained second branch network. In the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images, the nuclear power equipment weld images with preset defect types and their corresponding sample labels are used as the third training sample set and input into the third branch network of the weld defect detection model to be trained for training, so as to obtain the trained third branch network. By integrating the first, second, and third branch networks that have been trained, a fully trained weld defect detection model is obtained.

2. The weld defect detection method according to claim 1, characterized in that, The basic weld seam image set and the generated nuclear power equipment weld seam images, along with their corresponding sample labels, are used as the first training sample set and input into the first branch network of the weld seam defect detection model to be trained for training, resulting in the trained first branch network, which includes: The basic weld seam image set, the generated nuclear power equipment weld seam images, and their respective corresponding sample labels are used to form the first training sample set; The training samples in the first training sample set are input into the backbone network in the first branch network for feature extraction, resulting in multiple image content features with different dimensions and depths. The neck network in the first branch network is used to fuse all the image content features to obtain fused features; The fused features are predicted by the head network in the first branch network to obtain the corresponding prediction results; Based on the sample labels of the training samples and the corresponding prediction results, calculate the loss value of the loss function of the first branch network; Based on the loss value, the Adam optimizer is used to optimize the parameters of the first branch network to obtain the trained first branch network. The parameter optimization process iterates with a preset number of training batches and a total number of training rounds, and the learning rate decays from the initial learning rate according to the cosine annealing strategy.

3. The weld defect detection method according to claim 1, characterized in that, The nuclear power equipment weld images and corresponding sample labels from the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, are used as the second training sample set and input into the second branch network of the weld defect detection model to be trained for training, resulting in the trained second branch network, which includes: The nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, form a second training sample set; The training samples in the second training sample set are input into the backbone network in the second branch network for feature extraction, resulting in multiple image content features with different dimensions and depths. The neck network in the second branch network is used to fuse all the image content features to obtain fused features; The fused features are predicted by the head network in the second branch network to obtain the corresponding prediction results; Based on the sample labels of the training samples and the corresponding prediction results, calculate the loss value of the loss function of the second branch network; Based on the loss value, the Adam optimizer is used to optimize the parameters of the second branch network, resulting in the trained second branch network. The parameter optimization process iterates with a preset number of training batches and a total number of training rounds, and the learning rate decays from the initial learning rate using a cosine annealing strategy.

4. The weld defect detection method according to claim 1, characterized in that, In the nuclear power equipment weld images in the basic weld image set, and in the generated nuclear power equipment weld images, nuclear power equipment weld images with preset defect types and their corresponding sample labels are used as the third training sample set and input into the third branch network of the weld defect detection model to be trained for training, resulting in the trained third branch network, including: The nuclear power equipment weld images in the basic weld image set, and the generated nuclear power equipment weld images, will form a third training sample set by including nuclear power equipment weld images with preset defect types and their corresponding sample labels. The training samples in the third training sample set are input into the backbone network in the third branch network for feature extraction, resulting in multiple image content features with different dimensions and depths. The neck network in the third branch network is used to fuse all the image content features to obtain fused features; The fused features are predicted using the head network in the third branch network to obtain the corresponding prediction results; Based on the sample labels of the training samples and the corresponding prediction results, calculate the loss value of the loss function of the third branch network; Based on the loss value, the Adam optimizer is used to optimize the parameters of the third branch network to obtain the trained third branch network. The parameter optimization process iterates with a preset number of training batches and a total number of training rounds, and the learning rate decays from the initial learning rate according to the cosine annealing strategy.

5. The weld defect detection method according to claim 4, characterized in that, The first branch network, the second branch network, and the third branch network share the same backbone network, and each has an independent neck network and head network.

6. The weld defect detection method according to claim 2 or 4, characterized in that, The loss function of the first branch network, or the loss function of the third branch. ,satisfy: ; in, This is expressed as the total loss of the first or third branch network. , , and Represented as a non-zero constant, , , and These are respectively represented as the location loss, mask loss, confidence loss, and classification loss of the first or third branch network.

7. The weld defect detection method according to claim 3, characterized in that, The loss function of the second branch network satisfies: ; in, This is expressed as the total loss of the second branch network. , Represented as a non-zero constant, and These are represented as the location loss and classification loss of the second branch network, respectively.

8. A weld defect detection system, employing the weld defect detection model as described in any one of claims 1 to 7, characterized in that, include: The input unit is used to input the weld image to be detected into the pre-trained weld defect detection model; The first detection unit is used to obtain a first detection result through the first branch network of the weld defect detection model. The first detection result includes defect information of all defect types of welds in long-distance pipelines and nuclear power equipment. The defect information includes defect type, defect location, and confidence level; The second detection unit is used to obtain a second detection result through the second branch network of the weld defect detection model. The second detection result contains defect information of all defect types of nuclear power equipment welds. The third detection unit is used to obtain a third detection result through the third branch network of the weld defect detection model. The third detection result includes defect information of the preset defect type of the nuclear power equipment weld. The generation unit is configured to: when the input weld to be detected is a defect type for long-distance pipelines, output identification results based on the confidence levels of each defect in the first detection results; when the input weld to be detected is a defect type for nuclear power equipment other than the preset defect type, generate detection results for other defect types based on the confidence levels of the first and second detection results; when the input weld to be detected is a preset defect type for nuclear power equipment, generate detection results for the preset defect type based on the confidence levels of the first, second, and third detection results. The training system for the weld defect detection model includes: The acquisition unit is used to acquire a set of basic weld seam images and input the set of basic weld seam images into the DDPM diffusion model to generate several new nuclear power equipment weld seam images; the set of basic weld seam images includes long-distance pipeline weld seam images as main samples and nuclear power equipment weld seam images as supplementary samples, and all long-distance pipeline weld seam images and all nuclear power equipment weld seam images have corresponding sample labels; The first training unit is used to input the basic weld seam image set and the generated nuclear power equipment weld seam images and their corresponding sample labels as the first training sample set into the first branch network of the weld seam defect detection model to be trained for training, so as to obtain the trained first branch network; the weld seam defect detection model is a YOLO object detection model; The second training unit is used to input the nuclear power equipment weld images and corresponding sample labels in the basic weld image set, as well as the generated nuclear power equipment weld images and corresponding sample labels, as the second training sample set into the second branch network of the weld defect detection model to be trained, so as to obtain the trained second branch network. The third training unit is used to take the nuclear power equipment weld images with preset defect types and their corresponding sample labels from the nuclear power equipment weld images in the basic weld image set and the generated nuclear power equipment weld images as the third training sample set, and input them into the third branch network of the weld defect detection model to be trained for training, so as to obtain the trained third branch network. The integration unit is used to integrate the first, second, and third branch networks that have been trained to obtain a trained weld defect detection model.

Citation Information

Patent Citations

  • Long-distance pipeline ray image defect intelligent identification method based on self-attention network

    CN114445366A

  • Cigarette case defect detection method, device, equipment and medium

    CN114708214A