A lock piece weld porosity identification method based on DCGAN network and semantic segmentation technology
By combining DCGAN network with semantic segmentation technology, high-quality data is generated, which solves the problems of high data acquisition cost and low accuracy in the identification of porosity of lock welds. It achieves efficient and accurate porosity detection and is applicable to welding quality assessment in fields such as bridges, ships, and buildings.
Patent Information
- Application Number
- CN202411773999.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-12-05
AI Technical Summary
In the existing technology, it is difficult to efficiently identify the porosity of the lock plate weld. In the existing technology, it is difficult to efficiently identify the porosity of the lock plate weld in the welding area. In the existing technology, it is difficult to accurately and quickly identify the porosity of the lock plate weld, especially when the data acquisition cost is high and the distribution is uneven.
A method based on DCGAN network and semantic segmentation technology is adopted. Two-dimensional porosity images are generated by X-ray detection. After image preprocessing, data augmentation is generated using DCGAN network, and an Attention U-Net neural network is established. Cross-validation training is performed, and porosity is calculated and compared with manual statistical results to verify the effectiveness of the method.
It significantly improves the accuracy and efficiency of porosity identification and is suitable for the evaluation and control of lock plate welding quality in industrial testing.
Smart Images

Figure CN119625313B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of porosity identification technology, specifically to a method for identifying the porosity of lock plate welds based on DCGAN network and semantic segmentation technology. Background Technology
[0002] Locking plates are critical connecting components in many engineering structures, especially in welded assemblies in bridges, ships, buildings, and large machinery. They primarily bear the load, provide connection, and transmit force. Their quality and reliability directly affect the safety and service life of the entire structure. To achieve this function, locking plates typically require welding to firmly bond two components together, forming a single unit that meets load-bearing and fatigue resistance requirements.
[0003] Welding, as the core process of locking plate connection, is crucial to the entire working system. It must not only ensure a tight connection between the locking plates but also guarantee the strength and durability of the weld, enabling it to withstand complex external loads over long periods. However, in practice, the welding process is easily affected by material properties, process parameters, and environmental conditions, leading to defects such as porosity, lack of fusion, and cracks in the weld area. Porosity, as one of the most common defects in welding, significantly weakens the weld's load-bearing capacity and fatigue performance. Excessive porosity can also cause stress concentration, accelerating weld failure and ultimately affecting the working stability of the locking plates. Therefore, accurately detecting porosity in the weld and calculating the porosity is a key part of ensuring welding quality and the reliability of the locking plate connection.
[0004] Currently, X-ray nondestructive testing (NDT) is a common method for detecting welding defects. It can generate two-dimensional images by penetrating the weld area with X-rays, revealing internal defects such as porosity. However, traditional porosity assessment methods typically rely on manual statistics following simple image processing techniques, which is not only time-consuming and labor-intensive but also susceptible to subjective factors in accuracy. With the development of deep learning, semantic segmentation technology can accurately segment target regions in images and has been widely used in image recognition. However, semantic segmentation models based on encoder-decoder architectures are complex, with a large number of parameters, requiring a large number of labeled samples for training. In industrial applications, such as detecting porosity in lock plate welds, obtaining sufficient high-quality labeled data is costly and suffers from uneven data distribution, making it difficult to train a sufficiently accurate semantic segmentation network model. Therefore, proposing an accurate and fast porosity detection method is particularly important. Summary of the Invention
[0005] To address the aforementioned problems, this invention proposes a method for identifying the porosity of lock plate welds based on DCGAN networks and semantic segmentation technology. This method overcomes the difficulties in obtaining lock plate weld porosity images and the low accuracy of porosity segmentation. First, X-ray detection is used to generate and record images by penetrating the lock plate weld area with X-rays, obtaining two-dimensional porosity images. This constructs an experimental dataset of lock plate welds. Image preprocessing is then performed, including grayscale conversion, image correction, and cropping. The experimental dataset is divided into training and testing sets. The DCGAN network is trained based on the images in the training set. The trained model is used to generate images to expand the training set, establishing a semantic segmentation Attention U-Net neural network. The expanded training set is then used for cross-validation training. The trained model is then used to identify porosity on the testing set. The ratio of the number of identified porosity pixels to the total number of pixels in the weld area is used to calculate the porosity. Finally, the number of pixels in the test set images is manually counted to calculate the porosity, which is then compared with the porosity calculated by the neural network to verify the effectiveness of the proposed method.
[0006] The objective of this invention is achieved through the following technical solution: a method for identifying the porosity of locking weld seams based on DCGAN network and semantic segmentation technology, comprising the following steps:
[0007] Step 1: Use X-ray inspection to generate and record images by penetrating the welded locking plate with X-rays, obtain two-dimensional pore images, and construct an experimental dataset of the locking plate weld.
[0008] Step 2: Image preprocessing, including grayscale conversion, perspective-based image correction and cropping;
[0009] Step 3: Divide the experimental dataset into a training set and a test set. Use the images from the training set to train the DCGAN network. The trained model is then used to generate images to expand the training set.
[0010] Step 4: Build the semantic segmentation model Attention U-Net and train it using the augmented training set through cross-validation to optimize model performance;
[0011] Step 5: Perform recognition on the test set using the trained model, and calculate the porosity by the ratio of the number of recognized pore pixels to the total number of pixels in the welding area.
[0012] Step 6: Manually count the number of pixels in the test set images to calculate the porosity, and compare it with the porosity calculated by the neural network to verify the effectiveness of the method.
[0013] In one implementation, the specific method of step S1 is as follows:
[0014] In step S1, when using the X-ray method to detect pores, the locking plate should be placed completely parallel to ensure that the length and width ratios of the resulting two-dimensional pore map are consistent.
[0015] In one implementation, the specific method of step S2 is as follows:
[0016] Step S2.1. First, the image obtained from the experiment is converted to grayscale to obtain a single-channel grayscale image;
[0017] Step S2.2. Correct the image based on perspective transformation. First, binarize the grayscale image to generate a binary image:
[0018]
[0019] Where T is the selected grayscale threshold, I gray (x,y) is the initial grayscale image, I binary (x, y) is a binarized image. Next, the contour with the largest area is detected in the binary image:
[0020]
[0021] Among them, C max To obtain the maximum contour, C is the set of contours, c i For the i-th contour in the set, A(c i ) is the outline c i Given the area of the rectangle, calculate its minimum bounding rectangle and obtain the coordinates of its four vertices:
[0022] {P1,P2,P3,P4}=MinRect(C max )
[0023] Where {P1,P2,P3,P4} is the set of vertices of the minimum bounding rectangle of the maximum contour, and then ensure that the vertices are arranged in a specified order:
[0024] {P'1,P'2,P'3,P'4}=Sort({P1,P2,P3,P4})
[0025] Where {P'1,P'2,P'3,P'4} are the sorted vertex coordinates, and finally, for image I... gray Perform perspective transformation to obtain the corrected image I. corrected ;
[0026] Step S2.3. Crop the corrected image and remove irrelevant background.
[0027] In one implementation, the specific method of step S3 is as follows:
[0028] Step S3.1. Use the DCGAN network to expand the training dataset. This is a data expansion method based on generative adversarial networks. Its principle is to generate new high-quality images through adversarial training between the generator G and the discriminator D. The final generated images can be used as part of the expanded dataset to enhance the diversity of training data and improve the training effect of the semantic segmentation model.
[0029] Step S3.2. Augment the images generated by the DCGAN network into the training set to construct a training dataset containing the augmented data.
[0030] In one implementation, the specific method of step S4 is as follows:
[0031] Step S4.1. Use the Attention U-Net semantic segmentation neural network. The structure of this network is similar to the standard U-Net network model, which includes an encoder, a decoder, and skip connections. The difference is that Attention U-Net introduces an attention mechanism in the skip connections. For each skip connection, Attention U-Net provides a weighted encoder feature map to the decoder. This can suppress unimportant background features and highlight the features of key regions. This network uses the attention mechanism to focus on the most important parts of the image, thereby improving the segmentation accuracy.
[0032] Step S4.2. Using the expanded training set, the model is trained using a cross-validation strategy to improve the segmentation accuracy of the network under different image conditions.
[0033] In one implementation, the specific method of step S5 is as follows:
[0034] Step S5.1. Use the trained Attention U-Net network model to recognize the images in the test set to obtain a two-dimensional aperture segmentation map;
[0035] Step S5.2. Calculate the porosity by the ratio of the number of segmented and identified pore pixels to the total number of pixels in the welding area. The porosity is calculated as follows:
[0036]
[0037] Where P is the porosity expressed as a percentage, and N... void To segment and identify the number of aperture pixels, N total This represents the total number of pixels in the welding area.
[0038] In one implementation, the specific method of step S6 is as follows:
[0039] Step S6 compares the porosity obtained by the calculated identification method with the porosity obtained by manual statistics, calculates the error between the two, and considers the method to be effective when the error meets the following conditions:
[0040] Error = |Pmethod -P manual |<Δ
[0041] Among them, P method P is the porosity calculated based on neural network recognition. manual The porosity is calculated using manual statistical methods, and Δ is a predetermined error threshold. When the error value is less than the predetermined threshold Δ, the identification method is considered to be effective and reliable.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] This invention combines DCGAN-based data augmentation technology with semantic segmentation methods to generate high-quality simulated data, thereby enhancing the diversity and robustness of the dataset. It aims to solve the problem of small dataset size and high acquisition cost of lock plate weld seams in industry, thus significantly improving the accuracy and efficiency of porosity identification. It is suitable for the evaluation and control of lock plate welding quality in industrial inspection and has broad application prospects. Attached Figure Description
[0044] Figure 1 This is a flowchart illustrating an embodiment of the present invention;
[0045] Figure 2 This is a schematic diagram of the locking plate welding structure of an embodiment of the present invention;
[0046] Figure 3 This is a diagram of the DCGAN network model of an embodiment of the present invention. Detailed Implementation
[0047] To enable those skilled in the art to have a clearer understanding of the present invention, the present invention will be further described in detail below with reference to embodiments. The following will be in conjunction with the accompanying drawings. Figure 1 The following detailed description of specific embodiments of the invention is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0048] like Figure 1The diagram illustrates a method for identifying the porosity of lock plate welds based on a DCGAN network and semantic segmentation technology, as described in this invention. The method's design principle is as follows: X-ray detection is used to generate and record images by penetrating the lock plate welding area with X-rays, obtaining two-dimensional porosity images. An experimental dataset of lock plate welds is constructed, followed by image preprocessing, including grayscale conversion, image correction, and cropping. The experimental dataset is divided into training and testing sets. The DCGAN network is trained based on the images in the training set. The trained model is used to generate images to expand the training set, establishing a semantic segmentation Attention U-Net neural network. The expanded training set is then used for training based on cross-validation. The trained model is then used to identify porosity on the testing set. The ratio of the number of identified porosity pixels to the total number of pixels in the welding area is used to calculate the porosity. Finally, the number of pixels in the test set images is manually counted to calculate the porosity, which is then compared with the porosity calculated by the neural network to verify the effectiveness of the method. Figure 2 This is a schematic diagram of the locking plate welding structure according to an embodiment of the present invention. Figure 3 This is a diagram of the DCGAN network model of an embodiment of the present invention.
[0049] In this example, a method for identifying the porosity of locking lamination welds based on DCGAN networks and semantic segmentation technology includes the following steps:
[0050] I. Obtaining images of the weld gaps of the locking plate
[0051] X-ray inspection is used to generate and record images by penetrating the welded locking plate with X-rays, thus obtaining two-dimensional pore images. An experimental dataset of the locking plate weld is constructed. When using the X-ray method to inspect pores, the locking plate should be placed completely parallel to ensure that the length and width ratio of the obtained two-dimensional pore image is consistent.
[0052] II. Image Preprocessing
[0053] First, the images obtained from the experiment are converted to grayscale, and then the grayscale images are binarized to generate binary images.
[0054]
[0055] Where T is the selected grayscale threshold, I gray (x,y) is the initial grayscale image, I binary (x, y) is a binarized image. Next, the contour with the largest area is detected in the binary image:
[0056]
[0057] Among them, C max To obtain the maximum contour, C is the set of contours, c i For the i-th contour in the set, A(ci ) is the outline c i Given the area of the rectangle, calculate its minimum bounding rectangle and obtain the coordinates of its four vertices:
[0058] {P1,P2,P3,P4}=MinRect(C max )
[0059] Where {P1,P2,P3,P4} is the set of vertices of the minimum bounding rectangle of the maximum contour, and then ensure that the vertices are arranged in a specified order:
[0060] {P'1,P'2,P'3,P'4}=Sort({P1,P2,P3,P4})
[0061] Where {P'1,P'2,P'3,P'4} are the sorted vertex coordinates, and finally, for image I... gray Perform perspective transformation to obtain the corrected image I. corrected Then, the corrected images are cropped to remove irrelevant backgrounds. Finally, the processed image dataset is divided into training and test sets.
[0062] III. Data Extension Based on DCGAN Network
[0063] The DCGAN network is trained using images from the training set. The trained model is then used to generate images to augment the training set. This is a data augmentation method based on generative adversarial networks (GANs). Its principle is to generate new, high-quality images through adversarial training between the generator (G) and discriminator (D). The generated images can then be used as part of the augmented dataset to enhance the diversity of the training data and improve the training performance of the semantic segmentation model. The Adam optimization algorithm is employed. This algorithm dynamically adjusts the learning rate by calculating the first and second momentum of the gradient, significantly improving the training efficiency of the generator and discriminator and the stability of model convergence. Its update formula is:
[0064] m t =β1m t-1 +(1-β1)g t
[0065]
[0066] IV. Among them, m t Let m be the first-order momentum of the gradient. t-1 Let v be the first-order momentum from the previous moment. t Let v be the second momentum of the squared gradient. t-1 Let α be the second-order momentum at the previous moment, β1 and β2 be the decay coefficients of the first and second-order momentum, ε be a small constant to prevent the denominator from being zero, and g be the second-order momentum at the previous moment. t Let θ be the current gradient.t θ represents the model parameters at the current time step. t+1 These are the model parameters for the next time step.
[0067] V. Attention U-Net Model Training and Optimization
[0068] A semantic segmentation model, Attention U-Net, was built and trained using an augmented training set via cross-validation to optimize model performance. The network structure is similar to the standard U-Net model, including an encoder, decoder, and skip connections. The key difference is that Attention U-Net introduces an attention mechanism into the skip connections. For each skip connection, Attention U-Net provides the decoder with a weighted encoder feature map, which suppresses unimportant background features and highlights features in key regions. This network utilizes the attention mechanism to focus on the most important parts of the image, thereby improving segmentation accuracy. Using an augmented training set and a cross-validation strategy, the model was trained to improve segmentation accuracy under different image conditions.
[0069] V. Porosity Calculation
[0070] The trained model is then used to identify pores on a test set. The porosity is calculated by dividing the number of identified pore pixels into the total number of pixels in the welding area. The porosity is calculated as follows:
[0071]
[0072] Where P is the porosity expressed as a percentage, and N... void To segment and identify the number of aperture pixels, N total This represents the total number of pixels in the welding area.
[0073] VI. Verification of Calculation Results
[0074] The porosity is calculated by manually counting the pixels in the test set images and comparing it with the porosity calculated by the neural network. The error between the two is calculated, and the method is considered effective when the error meets the following condition:
[0075] Error = | P method -P manual |<Δ
[0076] Among them, P method P is the porosity calculated based on neural network recognition. manual The porosity is calculated using manual statistical methods, and Δ is a predetermined error threshold. When the error value is less than the predetermined threshold Δ, the identification method is considered to be effective and reliable.
[0077] The above embodiments are merely illustrative of the principles and functions of the present invention and are not intended to limit the invention. Any person skilled in the art can make adjustments or modifications to the above embodiments without departing from the spirit and scope of the invention. Therefore, any equivalent changes or adjustments made by those with ordinary knowledge in the art without departing from the core ideas and technical solutions disclosed in the present invention should be included within the scope of the claims of the present invention.
Claims
1. A method for identifying the porosity of a lock plate weld based on DCGAN and semantic segmentation technology, characterized in that, The steps include the following: Step S1: using X-ray detection method to penetrate the welded locking piece by X-rays, generating and recording images to obtain a two-dimensional pore picture, and constructing an experimental data set of the locking piece weld; Step S2: picture preprocessing, including grayscale processing, picture correction based on perspective transformation, and cropping, the image correction operation first binarizes the grayscale image to generate a binary image: where T is a selected gray scale threshold, I gray (x,y) is the initial gray scale image, I binary (x,y) is the binary processed image, then the largest area contour is detected in the binary image: Wherein, C max is the maximum contour obtained, C is the contour set, c i is the i-th contour in the set, A(c i ) is the area of the contour c i , and based on this, the minimum circumscribed rectangle is calculated, and the four vertex coordinates of the rectangle are obtained. {P1,P2,P3,P4} = MinRect(C max ) Wherein, {P1, P2, P3, P4} is the vertex set of the minimum circumscribed rectangle of the maximum contour, and then the vertices are arranged in the specified order: {P1', P2', P3', P4'} = Sort({P1, P2, P3, P4}) Wherein, {P1', P2', P3', P4'} is the ordered vertex coordinates, and finally the initial image I gray is subjected to perspective transformation to obtain the corrected image I corrected ; Step S3: dividing the experimental data set into a training set and a test set, using the pictures of the training set to train the DCGAN network, and using the trained model to generate picture expansion training set; Step S4: establishing a semantic segmentation model Attention U-Net, and training the model through cross-validation using the expanded training set to optimize the model performance; Step S5: identifying the trained model on the test set, calculating the porosity by dividing the number of segmented pore pixels by the total number of pixels in the welding area; Step S6: manually counting the pixel points of the test set picture to calculate the porosity, and comparing it with the porosity calculated by the neural network recognition to verify the effectiveness of the method.
2. The method of claim 1, wherein: The DCGAN network used in step S3 adopts the Adam optimization algorithm, which dynamically adjusts the learning rate by calculating the first and second moments of the gradient, and its update formula is: m t = β1m t-1 + (1 - β1)g t where m t is the first order momentum of the gradient, m t-1 is the first order momentum of the previous time step, v t is the second order momentum of the squared gradient, v t-1 is the second order momentum of the previous time step, a is the learning rate, b1, b2 are the decay coefficients for the first and second order momentum, e is a small constant to prevent division by zero, g t is the current gradient, q t is the model parameter of the current time step, q t+1 is the model parameter of the next time step.
3. The method of claim 1, wherein: The semantic segmentation neural network Attention U-Net used in step S4 is similar in structure to the standard U-Net, containing an encoder, a decoder, and a skip connection. The difference is that Attention U-Net introduces an attention mechanism in the skip connection, which provides a weighted encoder feature map for the decoder for each skip connection. This can suppress unimportant background features and highlight key region features. The network focuses on the most important parts of the image using the attention mechanism, thereby improving segmentation accuracy. The expanded training set is used to train the model using a cross-validation strategy to improve the segmentation accuracy of the network under different image conditions.
4. The method of claim 1, wherein: The porosity calculation method in step S5 is: where P is the porosity expressed in percentage, N void is the number of segmented identified pore pixels, N total is the total number of pixels of the weld area.
5. The method of claim 1, wherein: In step S6, the porosity calculated by the recognition method is compared with the porosity obtained by manual statistics, and the error between the two is calculated. When the error meets the following conditions, the method is considered effective: Error = |P method - P manual | < Δ wherein P method is the porosity calculated based on the neural network recognition, P manual is the porosity calculated by the artificial statistical method, and Δ is a predetermined error threshold value. When the error value is less than the predetermined threshold value Δ, it is considered that the recognition method has effectiveness and reliability.
Citation Information
Patent Citations
Plastic part welding seam detection method based on DCGAN significant feature sample expansion pretreatment
CN114018951A
Buckwheat grain image segmentation method based on ResCo-UNet
CN117893763A