Training image generation method and device of welding defect detection model, equipment and medium

By constructing a 3D model of the welding workpiece and setting defect parameters, and using X-ray photons to generate training images, the problem of strong randomness of training images in the existing technology is solved, and efficient training and generalization ability of the welding defect detection model are achieved.

CN120635323APending Publication Date: 2025-09-12HEBEI UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510792438.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

The existing training image generation method is highly random and cannot quantitatively control welding defects, resulting in limited generalization performance of the welding defect detection model.

Method used

By constructing a 3D model of the welded workpiece and setting the welding defects according to preset defect parameters, X-ray photons are used to irradiate the defective workpiece model and determine the intensity of the X-ray photons at different positions, thereby generating a training image for the welding defect detection model.

Benefits of technology

Quantitative control of welding defects is achieved, a large number of controllable training images are generated, and the generalization ability and training accuracy of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635323A_ABST
    Figure CN120635323A_ABST
Patent Text Reader

Abstract

The invention provides a training image generation method and device for a welding defect detection model, equipment and a medium, and relates to the technical field of electric digital data processing. The method comprises the steps that a welding workpiece 3D model is constructed according to size parameters of a welding workpiece; according to preset defect parameters, welding defects are set in the welding workpiece 3D model, and a defect workpiece model is obtained; x-ray photons are utilized to irradiate the defect workpiece model, and the intensity of the X-ray photons at different positions after the X-ray photons penetrate through the defect workpiece model is determined; and generating a training image of the welding defect detection model according to the intensity of the X-ray photons at different positions after the X-ray photons penetrate through the defect workpiece model. According to the invention, quantitative control of the welding defects in the training image can be realized, so that the generalization performance of the welding defect detection model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electrical digital data processing, and in particular to a method, device, equipment and medium for generating training images of a welding defect detection model. Background Art

[0002] Weld defect detection is an essential process in the manufacturing and processing of equipment related to electricity, petroleum, and machinery. X-ray inspection is a common method for weld defect detection. However, current X-ray inspection still relies primarily on manual testing, and its efficiency and accuracy are significantly affected by human factors. Therefore, the transformation and upgrading to intelligent technology is urgent.

[0003] In recent years, with the rapid development of artificial intelligence technology, X-ray automatic detection of welding defects based on deep learning models has attracted much attention in the industry. Using a large number of X-ray images containing welding defects to train the model and obtain a trained welding defect detection model can achieve accurate detection of welding defects. However, in the equipment manufacturing field, due to the strict control of equipment manufacturing welding processes, the probability of welding defects is low, and due to the restrictions of commercial confidentiality regulations between companies, data sharing within the industry is poor. Therefore, it is extremely difficult to obtain a large number of X-ray images containing welding defects for training welding defect detection models. Under laboratory conditions, manipulating welding defects by controlling the welding process requires a large amount of materials, equipment, and personnel, which is very costly.

[0004] Related technologies typically use methods such as data augmentation and adversarial generation to generate X-ray images containing welding defects as training images for training welding defect detection models. Data augmentation primarily expands the number of images by performing random cropping, flipping, and adjusting brightness and contrast. Adversarial generation primarily generates X-ray images containing welding defects from random noise through adversarial training of two neural networks. However, the images generated by these two methods are highly random and cannot quantitatively control the welding defects in the images, which in turn limits the generalization performance of the trained welding defect detection models. Summary of the Invention

[0005] Embodiments of the present invention provide a method, apparatus, device, and medium for generating training images for a welding defect detection model to address the problem in related technologies that the training images are highly random, resulting in limited generalization capabilities of the trained welding defect detection model.

[0006] In a first aspect, an embodiment of the present invention provides a method for generating training images for a welding defect detection model, comprising:

[0007] Construct a 3D model of the welding workpiece according to the size parameters of the welding workpiece;

[0008] According to preset defect parameters, a welding defect is set in the 3D model of the welding workpiece to obtain a defective workpiece model;

[0009] irradiating the defective workpiece model with X-ray photons, and determining the intensity of the X-ray photons at different positions after penetrating the defective workpiece model;

[0010] A training image of a welding defect detection model is generated according to the intensity of X-ray photons at different positions after penetrating the defective workpiece model.

[0011] In one possible implementation, generating a training image for a welding defect detection model based on the intensities of X-ray photons at different positions after penetrating the defective workpiece model includes:

[0012] Normalizing the intensities of the X-ray photons at different positions after penetrating the defective workpiece model to obtain normalized intensities of the X-ray photons at different positions;

[0013] For each position, the normalized intensity of the X-ray photons is calculated by multiplying the normalized intensity by the maximum pixel value of the single channel, and the product is rounded down to determine the pixel value corresponding to the position.

[0014] Based on the pixel values ​​corresponding to each position, a training image for the welding defect detection model is generated.

[0015] In a possible implementation, setting a welding defect in the 3D model of the welded workpiece according to preset defect parameters to obtain a defective workpiece model includes:

[0016] respectively determining a workpiece base material region and a weld seam region in the 3D model of the welded workpiece;

[0017] According to the defect parameters, the qualified welding area and the weld defect area are determined on the weld area, and the element composition, atomic percentage and density in the workpiece base material area, the qualified welding area and the weld defect area are set accordingly to obtain a defective workpiece model.

[0018] In a possible implementation, irradiating the defective workpiece model with X-ray photons and determining the intensity of the X-ray photons at different positions after penetrating the defective workpiece model includes:

[0019] An X-ray source model and a detector model are respectively arranged on both sides of the defective workpiece model, the X-ray source model is controlled to emit X-ray photons to irradiate the defective workpiece model, and the detector model is controlled to receive X-ray photons that have penetrated the defective workpiece model, so as to determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

[0020] In a possible implementation, the method further includes:

[0021] Obtaining the model size of the defective workpiece model and the training image size required by the welding defect detection model;

[0022] A first distance between the defective workpiece model and the X-ray source model, and a second distance between the defective workpiece model and the detector model are determined according to a ratio of the model size to the training image size.

[0023] In one possible implementation, determining a first distance between the defective workpiece model and the X-ray source model, and a second distance between the defective workpiece model and the detector model based on a ratio of the model size to the training image size includes:

[0024] Determining a ratio of the model size to the training image size as a ratio of the first distance to the second distance;

[0025] Based on the ratio of the first distance to the second distance, a first distance between the defective workpiece model and the X-ray source model and a second distance between the defective workpiece model and the detector model are determined.

[0026] In a possible implementation, the defect parameter includes a defect type, and the defect type includes a pore defect and an inclusion defect;

[0027] Set the element composition, atomic percentage, and density within the weld defect area, including:

[0028] When the defect type is a pore defect, the element composition, atomic percentage and density corresponding to the gas in the pore defect are set to the element composition, atomic percentage and density in the welding defect area;

[0029] When the defect type is an inclusion defect, the element composition, atomic percentage and density corresponding to the inclusion components in the inclusion defect are set to the element composition, atomic percentage and density in the welding defect area.

[0030] In a second aspect, an embodiment of the present invention provides a training image generation device for a welding defect detection model, comprising:

[0031] Modeling modules for:

[0032] Construct a 3D model of the welding workpiece according to the size parameters of the welding workpiece;

[0033] According to preset defect parameters, a welding defect is set in the 3D model of the welding workpiece to obtain a defective workpiece model;

[0034] a deployment module, configured to irradiate the defective workpiece model with X-ray photons and determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model;

[0035] The generation module is used to generate a training image of the welding defect detection model according to the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

[0036] In a third aspect, an embodiment of the present invention provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method in the first aspect or any possible implementation of the first aspect is implemented.

[0037] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in the first aspect or any possible implementation of the first aspect is implemented.

[0038] The embodiment of the present invention adopts the concept of modeling and simulation, and can construct a corresponding defective workpiece model according to preset defect parameters to achieve quantitative control of welding defects. In the virtual model space where the defective workpiece model is located, the defective workpiece model is further irradiated with X-ray photons to determine the intensity of X-ray photons at different positions after penetrating the defective workpiece model, thereby generating training images for the welding defect detection model. Among them, a large number of training images with controllable welding defects can be quickly generated through modeling and simulation. While increasing the number of training images, it can also enrich the types of welding defects in the training images and reduce the randomness of welding defects in the training images, thereby improving the generalization ability of the welding defect detection model and the accuracy of model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 This is a flowchart of a method for generating training images for a welding defect detection model according to an embodiment of the present invention;

[0040] Figure 2 This is a schematic diagram of the layout positions of the X-ray source model, defect workpiece model, and detector model provided in an embodiment of the present invention;

[0041] Figure 3 is a schematic diagram of a training image corresponding to the defective workpiece model provided by an embodiment of the present invention;

[0042] Figure 4 It is a structural diagram of a training image generation device for a welding defect detection model provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0044] Related technologies typically use methods such as data augmentation and adversarial generation to generate X-ray images containing welding defects as training images for welding defect models. However, these methods are highly random and cannot quantitatively control the size, shape, and type of welding defects in the images. This, in turn, limits the generalization performance of the trained welding defect detection models.

[0045] In order to achieve quantitative control of welding defects in training images and improve the generalization ability of welding defect detection models, the embodiment of the present invention adopts the concept of modeling and simulation, and constructs a corresponding defective workpiece model according to preset defect parameters, which can achieve quantitative control of welding defects. On this basis, X-ray photons are further simulated to irradiate the defective workpiece model, so as to determine the intensity of X-ray photons at different positions after penetrating the defective workpiece model, and generate training images for the welding defect detection model. Among them, a large number of training images with controllable welding defects can be quickly generated through modeling and simulation. While increasing the number of training images, it can also enrich the types of welding defects in the training images and reduce the randomness of welding defects in the training images, thereby improving the generalization ability of the welding defect detection model.

[0046] See also Figure 1 , which shows a flow chart of the implementation of the method for generating training images for the welding defect detection model provided by an embodiment of the present invention, and is described in detail as follows:

[0047] Step 101, constructing a 3D model of the welding workpiece according to the size parameters of the welding workpiece;

[0048] In the deep learning model's X-ray automatic detection technology for welding defects, a large number of X-ray images containing welding defects are usually used as training images for model training to obtain a trained welding defect detection model, and then automatic welding defect detection is performed through the welding defect model.

[0049] In embodiments of the present invention, the dimensional parameters of the welded workpiece in the training images required for training the weld defect detection model can be pre-acquired. Dimensional parameters primarily refer to the workpiece's specifications, such as plate thickness, wall thickness, diameter, and length. Based on the dimensional parameters required by the weld defect detection model, a 3D model of the welded workpiece is constructed using 3D drawing software.

[0050] Step 102: setting welding defects in the 3D model of the welded workpiece according to preset defect parameters to obtain a defective workpiece model;

[0051] Based on the aforementioned 3D model of the welded workpiece, the welding parameters of the welded workpiece in the training images are further acquired for training the weld defect detection model. Welding parameters primarily include welding position, weld joint form, and weld joint type. The welding position is typically the symmetrical centerline of the workpiece. Weld joint forms include flat plate welds and pipe welds. Weld joint types include butt joints, fillet joints, and lap joints.

[0052] In the embodiment of the present invention, the weld area is set on the 3D model of the welding workpiece according to the above-mentioned welding position, and the weld is drawn according to parameters such as the welding interface form and the welding joint type.

[0053] Based on the weld seam determination described above, embodiments of the present invention further define weld defects within the 3D model of the welded workpiece according to preset defect parameters to obtain a defective workpiece model. In some embodiments, the workpiece base material region and the weld seam region within the 3D model of the welded workpiece can be first determined separately; then, based on the defect parameters, a weld-qualified region and a weld-defective region are determined within the weld seam region, and the elemental composition and atomic percentages within the workpiece base material region, the weld-qualified region, and the weld-defective region are correspondingly defined to obtain a defective workpiece model.

[0054] Here, based on the aforementioned welding positions, the workpiece base material region and the weld region in the 3D model of the welded workpiece can be distinguished. Furthermore, based on defect parameters, the weld region can be divided into a qualified weld region and a weld defect region. Defect parameters may include defect location, defect shape, defect size, and defect type. In embodiments of the present invention, a weld defect region can be set within the weld region based on the defect location, defect shape, and defect size.

[0055] Based on the demarcation of the workpiece base material area, the weld qualified area and the weld defect area, the embodiment of the present invention simulates a welded workpiece containing weld defects by correspondingly setting the element composition, atomic percentage and density of different areas.

[0056] It is understood that the workpiece base material and the welding material have different materials, and accordingly, their elemental composition, atomic percentage, and density are also different. Therefore, embodiments of the present invention can determine the elemental composition, atomic percentage, and density of the workpiece base material region and the qualified weld region based on the materials of the workpiece base material and the welding material.

[0057] The elemental composition, atomic percentage, and density of the weld defect area can be determined based on the defect type. Here, the defect type may include porosity defects and inclusion defects. Porosity defects are mostly air gaps, cracks, or pores that are not fused or welded through. The gas components in the above-mentioned air gaps, cracks, or pores generally include one or more of air, hydrogen, nitrogen, oxygen, and carbon monoxide. In the embodiment of the present invention, the elemental composition, atomic percentage, and density corresponding to the gas in the porosity defect can be set to the elemental composition, atomic percentage, and density in the weld defect area.

[0058] Inclusion defects are mostly defects caused by the presence of impurity components during the welding process. In an embodiment of the present invention, the elemental composition, atomic percentage, and density corresponding to the impurity components in the inclusion defect can be set to the elemental composition, atomic percentage, and density within the weld defect area. Among them, the impurity components present in the welding process are mostly tungsten or other solid inclusions. For example, for an inclusion defect with tungsten as the impurity component, the elemental composition, atomic percentage, and density corresponding to tungsten can be set to the elemental composition, atomic percentage, and density within the weld defect area.

[0059] Step 103, irradiating the defective workpiece model with X-ray photons to determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model;

[0060] In some embodiments, see Figure 2 The X-ray source model and the detector model can be respectively arranged on both sides of the defective workpiece model, the X-ray source model can be controlled to emit X-ray photons to irradiate the defective workpiece model, and the detector model can be controlled to receive the X-ray photons after penetrating the defective workpiece model, so as to determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

[0061] It should be noted that the X-ray source model and the detector model are both virtual models in the virtual model space where the defective workpiece model resides. This embodiment of the present invention simulates a scenario where real X-ray photons irradiate a real welded workpiece containing welding defects by placing X-ray source models and detector models on both sides of the defective workpiece model and controlling the X-ray source model to emit X-ray photons to irradiate the defective workpiece model. The detector model then receives X-ray photons that have penetrated the defective workpiece model, thereby determining the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

[0062] When deploying the X-ray source model, the shape and size of the X-ray source model can be pre-set, as well as the energy and number of X-ray photons emitted by the X-ray source model, to determine the intensity of the X-ray photons emitted by the X-ray source model. The intensity of the X-ray photons emitted by the X-ray source model is the product of the number of X-ray photons passing through a unit area per unit time and the energy of a single X-ray photon.

[0063] The detector model in the embodiment of the present invention can determine the intensity of X-ray photons at different positions after penetrating the defective workpiece model based on the intensity of X-ray photons emitted by the X-ray source model.

[0064] In some embodiments, the attenuation coefficient of the material of the welding workpiece for X-ray photons and the thickness of the material penetrated by the X-ray light path can be obtained respectively; then, the product of the attenuation coefficient and the material thickness is calculated, and based on the product, the attenuation degree of the X-ray photons is determined; finally, the product of the intensity of the X-ray photons emitted by the X-ray source model and the attenuation degree is calculated, and the product is determined as the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

[0065] The above calculation steps can be expressed by the calculation formula: I = I0 × exp(-μ × L);

[0066] Where I represents the intensity of the X-ray photons after penetrating the defective workpiece model, I0 represents the intensity of the X-ray photons emitted by the X-ray source model, exp(·) represents the natural exponential function, μ represents the attenuation coefficient of the material of the welded workpiece for X-ray photons, and L represents the thickness of the material penetrated by the X-ray light path.

[0067] X-ray photons emitted by the X-ray source model travel through different X-ray optical paths, penetrating the defective workpiece model and reaching the detector model. The detector model can determine the intensity of the X-ray photons at different locations after penetrating the defective workpiece model. Based on the intensities of the X-ray photons at these different distribution locations, this embodiment of the present invention generates an X-ray image containing the weld defect, i.e., a training image for the weld defect detection model.

[0068] Step 104 : generating a training image for a welding defect detection model based on the intensity of X-ray photons at different positions after penetrating the defective workpiece model.

[0069] In some embodiments, when generating a training image, the intensity of X-ray photons at different positions after penetrating the defective workpiece model can be normalized to obtain the normalized intensity of the X-ray photons at different positions; then, for the normalized intensity of the X-ray photons at each position, the product of the normalized intensity and the maximum pixel value of a single channel is calculated, and the product is rounded down to determine the pixel value corresponding to the position; then, based on the pixel values ​​corresponding to each position, a training image of the welding defect detection model is generated.

[0070] Specifically, by normalizing the intensity of X-ray photons at different positions after penetrating the defect workpiece model, the intensity of the X-ray photons can be scaled to the range of (0, 1] to obtain the normalized intensity. On this basis, the product of the normalized intensity and the maximum pixel value of a single channel is calculated, and the intensity of the X-ray photons can be converted into the corresponding pixel value in proportion. Here, considering that the pixel values ​​are all integers, the embodiment of the present invention rounds down the product of the normalized intensity and the maximum pixel value of a single channel, and determines the rounded value as the pixel value.

[0071] Different image bits correspond to different single-channel maximum pixel values. For example, the single-channel maximum pixel value corresponding to an 8-bit image is 255, and the single-channel maximum pixel value corresponding to a 10-bit image is 1023. The embodiment of the present invention can determine the value of the single-channel maximum pixel value according to the image bit number required by the welding defect detection model, and then determine the pixel values ​​at different positions to generate a training image for the welding defect detection model. For example, see Figure 3 , when the maximum pixel value of a single channel is 255, according to Figure 2 The defective artifact model shown in Figure 3 The training images shown.

[0072] The present invention can pre-set different defect parameters to generate different defect workpiece models. For each defect workpiece model, a training image can be generated, ultimately generating a large number of training images containing different welding defects for training the welding defect detection model.

[0073] The embodiment of the present invention adopts the concept of modeling and simulation, and can construct a corresponding defective workpiece model according to preset defect parameters to achieve quantitative control of welding defects. In the virtual model space where the defective workpiece model is located, the defective workpiece model is further irradiated with X-ray photons to determine the intensity of X-ray photons at different positions after penetrating the defective workpiece model, thereby generating training images for the welding defect detection model. Among them, a large number of training images with controllable welding defects can be quickly generated through modeling and simulation. While increasing the number of training images, it can also enrich the types of welding defects in the training images and reduce the randomness of welding defects in the training images, thereby improving the generalization ability of the welding defect detection model and the accuracy of model training.

[0074] On the basis of the above embodiment, the embodiment of the present invention further considers adjusting the distances among the X-ray source model, the defective workpiece model and the detector model to adjust the image size of the generated training image.

[0075] In some embodiments, when laying out the X-ray source model and the detector model, the model size of the defective workpiece model and the training image size required for the welding defect detection model can also be obtained in advance; then, based on the ratio of the model size and the training image size, the first distance between the defective workpiece model and the X-ray source model and the second distance between the defective workpiece model and the detector model are determined.

[0076] Specifically, the ratio of the model size to the training image size can be determined as the ratio of the first distance to the second distance; then, based on the ratio of the first distance to the second distance, the first distance between the defective workpiece model and the X-ray source model, and the second distance between the defective workpiece model and the detector model are determined.

[0077] According to imaging principles, the ratio of the defective workpiece model's size to the training image size is equal to the ratio of the first distance to the second distance. Therefore, in this embodiment of the present invention, the ratio of the first distance to the second distance is determined based on the ratio of the model size to the training image size, and the first distance and the second distance are determined based on this ratio.

[0078] In the embodiment of the present invention, the first distance and the second distance are adjusted according to the ratio of the first distance and the second distance to obtain the training image size required by the welding defect detection model. Here, the values ​​of the first distance and the second distance are not specifically limited.

[0079] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0080] The following are device embodiments of the present invention. For details not fully described therein, reference may be made to the corresponding method embodiments described above.

[0081] Figure 4 A schematic diagram of the structure of a training image generation device for a welding defect detection model provided by an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, which are described in detail as follows:

[0082] like Figure 4 As shown, a training image generation device 4 for a welding defect detection model includes: a modeling module 41, a layout module 42 and a generation module 43.

[0083] The modeling module 41 is used to:

[0084] Construct a 3D model of the welding workpiece according to the size parameters of the welding workpiece;

[0085] According to the preset defect parameters, the welding defects are set in the 3D model of the welding workpiece to obtain a defective workpiece model;

[0086] A layout module 42 is configured to irradiate the defective workpiece model with X-ray photons and determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model;

[0087] The generation module 43 is used to generate a training image of the welding defect detection model according to the intensity of the X-ray photons at different positions after penetrating the defect workpiece model.

[0088] In a possible implementation, the generating module 43 is specifically configured to:

[0089] Normalizing the intensities of X-ray photons at different positions after penetrating the defect workpiece model to obtain normalized intensities of X-ray photons at different positions;

[0090] For the normalized intensity of X-ray photons at each position, calculate the product of the normalized intensity and the maximum pixel value of a single channel, and round the product down to determine the pixel value corresponding to the position;

[0091] Based on the pixel values ​​corresponding to each position, a training image for the welding defect detection model is generated.

[0092] In a possible implementation, the modeling module 42 is specifically configured to:

[0093] Determine the workpiece base material area and weld area in the 3D model of the welded workpiece respectively;

[0094] According to the defect parameters, the qualified welding area and the weld defect area are determined on the weld area, and the element composition, atomic percentage and density in the workpiece base material area, the qualified welding area and the weld defect area are set accordingly to obtain a defective workpiece model.

[0095] In a possible implementation, the deployment module 43 is specifically configured to:

[0096] The X-ray source model and the detector model are respectively arranged on both sides of the defective workpiece model, the X-ray source model is controlled to emit X-ray photons to irradiate the defective workpiece model, and the detector model is controlled to receive X-ray photons after penetrating the defective workpiece model, so as to determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

[0097] In a possible implementation, the deployment module 42 is further configured to:

[0098] Obtain the model size of the defect workpiece model and the training image size required for the welding defect detection model;

[0099] A first distance between the defective workpiece model and the X-ray source model, and a second distance between the defective workpiece model and the detector model are determined according to a ratio of the model size to the training image size.

[0100] In a possible implementation, the deployment module 42 is specifically configured to:

[0101] Determine the ratio of the model size to the training image size as the ratio of the first distance to the second distance;

[0102] Based on the ratio of the first distance to the second distance, a first distance between the defective workpiece model and the X-ray source model and a second distance between the defective workpiece model and the detector model are determined.

[0103] In a possible implementation, the defect parameter includes a defect type, and the defect type includes a pore defect and an inclusion defect;

[0104] The modeling module 41 is specifically used for:

[0105] When the defect type is a pore defect, the element composition, atomic percentage and density of the gas in the pore defect are set to the element composition, atomic percentage and density in the welding defect area;

[0106] When the defect type is an inclusion defect, the element composition, atomic percentage and density corresponding to the inclusion components in the inclusion defect are set to the element composition, atomic percentage and density in the welding defect area.

[0107] This device embodiment can be used to implement the above method embodiment. Its technical principles and implementation effects are the same as those of the above method embodiment, and will not be repeated here.

[0108] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the method in the above method embodiment when executing the computer program.

[0109] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described or recorded in detail in one embodiment, please refer to the relevant descriptions of other embodiments. Unless otherwise specified or there is a logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other. The technical features of different embodiments can be combined to form new embodiments based on their inherent logical relationships.

[0110] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A method for generating training images for a welding defect detection model, characterized in that: include: Construct a 3D model of the welding workpiece according to the size parameters of the welding workpiece; According to preset defect parameters, a welding defect is set in the 3D model of the welding workpiece to obtain a defective workpiece model; irradiating the defective workpiece model with X-ray photons, and determining the intensity of the X-ray photons at different positions after penetrating the defective workpiece model; A training image of a welding defect detection model is generated according to the intensity of X-ray photons at different positions after penetrating the defective workpiece model.

2. The method for generating training images for a welding defect detection model according to claim 1, wherein: Generating a training image of a welding defect detection model according to the intensity of X-ray photons at different positions after penetrating the defective workpiece model includes: Normalizing the intensities of the X-ray photons at different positions after penetrating the defective workpiece model to obtain normalized intensities of the X-ray photons at different positions; For each position, the normalized intensity of the X-ray photons is calculated by multiplying the normalized intensity by the maximum pixel value of the single channel, and the product is rounded down to determine the pixel value corresponding to the position. Based on the pixel values ​​corresponding to each position, a training image for the welding defect detection model is generated.

3. The method for generating training images for a welding defect detection model according to claim 1 or 2, characterized in that: The step of setting a welding defect in the 3D model of the welding workpiece according to preset defect parameters to obtain a defective workpiece model includes: respectively determining a workpiece base material region and a weld seam region in the 3D model of the welded workpiece; According to the defect parameters, the qualified welding area and the weld defect area are determined on the weld area, and the element composition, atomic percentage and density in the workpiece base material area, the qualified welding area and the weld defect area are set accordingly to obtain a defective workpiece model.

4. The method for generating training images for a welding defect detection model according to claim 1 or 2, wherein: The step of irradiating the defective workpiece model with X-ray photons and determining the intensity of the X-ray photons at different positions after penetrating the defective workpiece model includes: An X-ray source model and a detector model are respectively arranged on both sides of the defective workpiece model, the X-ray source model is controlled to emit X-ray photons to irradiate the defective workpiece model, and the detector model is controlled to receive X-ray photons that have penetrated the defective workpiece model, so as to determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

5. The method for generating training images for a welding defect detection model according to claim 4, wherein: The method further comprises: Obtaining the model size of the defective workpiece model and the training image size required by the welding defect detection model; A first distance between the defective workpiece model and the X-ray source model, and a second distance between the defective workpiece model and the detector model are determined according to a ratio of the model size to the training image size.

6. The method for generating training images for a welding defect detection model according to claim 5, wherein: Determining a first distance between the defective workpiece model and the X-ray source model, and a second distance between the defective workpiece model and the detector model according to a ratio of the model size to the training image size includes: Determining a ratio of the model size to the training image size as a ratio of the first distance to the second distance; Based on the ratio of the first distance to the second distance, a first distance between the defective workpiece model and the X-ray source model and a second distance between the defective workpiece model and the detector model are determined.

7. The method for generating training images for a welding defect detection model according to claim 3, wherein: The defect parameters include defect types, which include pore defects and inclusion defects; Set the element composition, atomic percentage, and density within the weld defect area, including: When the defect type is a pore defect, the element composition, atomic percentage and density corresponding to the gas in the pore defect are set to the element composition, atomic percentage and density in the welding defect area; When the defect type is an inclusion defect, the element composition, atomic percentage and density corresponding to the inclusion components in the inclusion defect are set to the element composition, atomic percentage and density in the welding defect area.

8. A training image generation device for a welding defect detection model, characterized in that: Modeling modules for: Construct a 3D model of the welding workpiece according to the size parameters of the welding workpiece; According to preset defect parameters, a welding defect is set in the 3D model of the welding workpiece to obtain a defective workpiece model; a deployment module, configured to irradiate the defective workpiece model with X-ray photons and determine the intensity of the X-ray photons at different positions after penetrating the defective workpiece model; The generation module is used to generate a training image of the welding defect detection model according to the intensity of the X-ray photons at different positions after penetrating the defective workpiece model.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for generating a training image for a welding defect detection model according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for generating a training image for a welding defect detection model according to any one of claims 1 to 7 is implemented.