Lock plate weld porosity identification method based on DCGAN network and semantic segmentation technology
By combining DCGAN network and semantic segmentation technology, the problems of difficulty in obtaining data and low segmentation accuracy in lock sheet welding porosity detection are solved, and high-precision porosity identification and welding quality evaluation are achieved.
Patent Information
- Application Number
- CN202411773999.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-12-05
AI Technical Summary
The prior art has problems in the detection of lock sheet welding porosity, which leads to inaccurate welding quality evaluation.
Using a method based on DCGAN network and semantic segmentation technology, pore images are generated through X-ray detection, image preprocessing and data expansion are carried out, Attention U-Net neural network is established, and the porosity is calculated using cross-verification training model.
It significantly improves the accuracy and efficiency of porosity recognition, and is suitable for the evaluation and control of lock sheet welding quality in industrial inspection, solving the problems of small data set size and high acquisition cost.
Smart Images

Figure CN119625313A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of porosity identification technology, and specifically to a lock plate weld porosity identification method based on DCGAN network and semantic segmentation technology. Background Art
[0002] Locking plates are key connecting components in many engineering structures, especially in welded assemblies in bridges, ships, buildings, and large-scale mechanical equipment. Locking plates are mainly responsible for bearing, connecting, and transmitting forces. Their quality and reliability will directly affect the safety and service life of the entire structure. In order to achieve this function, locking plates usually need to be welded together to form a whole that meets the requirements of bearing and fatigue resistance.
[0003] As the core process of locking piece connection, welding is crucial in the entire working system. It not only ensures the tight connection between the locking pieces, but also ensures the strength and durability of the weld, and can withstand complex external loads for a long time. However, in actual operation, the welding process is easily affected by material properties, process parameters and environmental conditions, which may lead to defects such as porosity, lack of fusion, and cracks in the weld area. Among them, porosity, as one of the common defects in the welding process, will significantly weaken the load-bearing capacity and fatigue performance of the weld. Excessive porosity may also cause stress concentration, accelerate weld failure, and ultimately affect the working stability of the locking piece. Therefore, accurately detecting the porosity in the weld and calculating the porosity are key parts to ensure welding quality and reliability of locking piece connection.
[0004] At present, X-ray nondestructive testing technology is a common method for welding defect detection. It can generate two-dimensional images by penetrating the welding area with rays to display internal defects such as pores. However, traditional porosity assessment methods usually rely on manual statistics after simple image processing technology, which is not only time-consuming and labor-intensive, but also its accuracy is affected by subjective factors. With the development of deep learning, semantic segmentation technology can accurately segment the target area in the image and has been widely used in image recognition. However, the semantic segmentation model based on the encoder-decoder architecture is relatively complex, with a large number of parameters, and the training process requires a large number of labeled samples. However, in industrial applications, such as the detection of porosity in lock plate welds, it is costly to obtain sufficient high-quality labeled data, and there is a problem of uneven data distribution, which makes it difficult to train a sufficiently accurate semantic segmentation network model. Therefore, it is particularly important to propose an accurate and fast porosity detection method. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a lock plate weld porosity identification method based on DCGAN network and semantic segmentation technology to solve the problem that the current lock plate welding porosity image data is difficult to obtain and the pore segmentation accuracy is low. First, the X-ray detection method is used to penetrate the lock plate welding area through the rays, generate and record the image, obtain a two-dimensional pore image, and construct an experimental data set of the lock plate weld. Then, the image preprocessing is performed, including grayscale processing, image correction and cropping. The experimental data set is divided into a training set and a test set. The DCGAN network is trained based on the images of the training set. The trained model is used to generate an image expansion training set, and a semantic segmentation Attention U-Net neural network is established. The expanded training set is used for training based on cross-validation. The trained model is identified on the test set, and the porosity is calculated by the ratio of the number of pore pixels identified by segmentation to the total number of pixels in the welding area. Finally, the pixels of the test set image are manually counted to calculate the porosity, which is compared with the porosity calculated by the neural network recognition to verify the effectiveness of the method.
[0006] The purpose of the present invention is to achieve this through the following technical solution: a method for identifying the porosity of a lock plate weld based on a DCGAN network and semantic segmentation technology, comprising the following steps:
[0007] Step 1: Use X-ray detection to penetrate the welded lock piece, generate and record images, obtain a two-dimensional pore image, and construct an experimental data set of the lock piece weld;
[0008] Step 2: Image preprocessing, including grayscale processing, image correction based on perspective transformation, and cropping;
[0009] Step 3: Divide the experimental data set into a training set and a test set, use the images in the training set to train the DCGAN network, and use the trained model to generate images to expand the training set;
[0010] Step 4: Build a semantic segmentation model Attention U-Net and use the expanded training set to train it through cross-validation to optimize model performance;
[0011] Step 5: The trained model is used to identify the test set, and the porosity is calculated by the ratio of the number of pore pixels identified by segmentation to the total number of pixels in the welding area;
[0012] Step 6: Manually count the pixels of the test set images to calculate the porosity, and compare it with the porosity calculated by neural network recognition to verify the effectiveness of this method.
[0013] In one embodiment, the specific method of step S1 is as follows:
[0014] Step S1: When using the X-ray method to detect pores, the locking plates should be placed completely parallel so that the ratio of the length and width of the obtained two-dimensional pore image is consistent.
[0015] In one embodiment, the specific method of step S2 is as follows:
[0016] Step S2.1. First, grayscale the image obtained in the experiment 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 binary image, and then the contour with the largest area is detected in the binary image:
[0020]
[0021] Among them, 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 contour c i Based on the area of , calculate its minimum enclosing rectangle and obtain the coordinates of the four vertices of the rectangle:
[0022] {P1,P2,P3,P4}=MinRect(C max )
[0023] Among them, {P1, P2, P3, P4} is the minimum circumscribed rectangle vertex set of the maximum contour, and then ensure that the vertices are arranged in the specified order:
[0024] {P'1,P'2,P'3,P'4}=Sort({P1,P2,P3,P4})
[0025] Among them, {P'1, P'2, P'3, P'4} are the sorted vertex coordinates. Finally, for image I gray Perform perspective transformation to obtain the corrected image I corrected ;
[0026] Step S2.3. Crop the rectified image to remove irrelevant background.
[0027] In one embodiment, the specific method of step S3 is as follows:
[0028] Step S3.1. Use the DCGAN network to expand the training data set. This is a data expansion method based on the generative adversarial network. The principle is to generate new high-quality images through adversarial training of the generator G and the discriminator D. The final generated images can be used as part of the expanded data set to enhance the diversity of training data and improve the training effect of the semantic segmentation model.
[0029] Step S3.2. Expand the images generated by the DCGAN network into the training set and construct a training dataset containing the expanded data.
[0030] In one embodiment, 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, including an encoder, a decoder, and a skip connection. The difference is that Attention U-Net introduces an attention mechanism in the skip connection. For each skip connection, Attention U-Net provides a weighted encoder feature map to the decoder, which can suppress unimportant background features and highlight the features of key areas. The network uses the attention mechanism to focus on the most important part of the image, thereby improving the segmentation accuracy;
[0032] Step S4.2. Use the expanded training set and adopt a cross-validation strategy to train the model to improve the segmentation accuracy of the network under different image conditions.
[0033] In one embodiment, the specific method of step S5 is as follows:
[0034] Step S5.1. Use the trained Attention U-Net network model to identify the images in the test set and obtain a two-dimensional pore segmentation map;
[0035] Step S5.2. The porosity is calculated by the ratio of the number of pore pixels identified by segmentation to the total number of pixels in the welding area. The porosity is calculated as follows:
[0036]
[0037] Where P is the porosity expressed in percentage, N void is the number of pore pixels identified by segmentation, N total is the total number of pixels in the welding area.
[0038] In one embodiment, the specific method of step S6 is as follows:
[0039] Step S6 compares the porosity calculated by the identification method with the porosity obtained by manual statistics, and calculates the error between the two. When the error meets the following conditions, the method is considered to be effective:
[0040] Error = |Pmethod -P manual |<Δ
[0041] Among them, P method is the porosity calculated based on neural network recognition, P manual is the porosity calculated by manual statistical method, Δ is the predetermined error threshold, and 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] The present invention combines the data expansion technology based on the DCGAN network with the semantic segmentation method to generate high-quality simulation data to enhance the diversity and robustness of the data set. It aims to solve the problem of small scale and high acquisition cost of industrial lock plate weld data sets, thereby 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. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of a flow chart of an embodiment of the present invention;
[0045] Figure 2 This is a schematic diagram of the welding structure of the lock piece of an embodiment of the present invention;
[0046] Figure 3 This is a DCGAN network model diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to enable those skilled in the art to have a clearer understanding and knowledge of the present invention, the present invention is further described in detail below in conjunction with the embodiments. Figure 1 Describe the specific embodiment of the present invention, it should be noted that the following detailed description is illustrative, and is intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs.
[0048] like Figure 1As shown, a method for identifying the porosity of a lock plate weld based on a DCGAN network and semantic segmentation technology of the present invention is designed as follows: an X-ray detection method is used to penetrate the lock plate welding area through the rays, an image is generated and recorded, and a two-dimensional pore image is obtained. An experimental data set of the lock plate weld is constructed, and then image preprocessing is performed, including grayscale processing, image correction and cropping. The experimental data set is divided into a training set and a test set. The DCGAN network is trained based on the images in the training set. The trained model is used to generate an image expansion training set, and a semantic segmentation Attention U-Net neural network is established. The expanded training set is used for training based on cross-validation. The trained model is identified on the test set, and the porosity is calculated by the ratio of the number of pore pixels identified by segmentation to the total number of pixels in the welding area. Finally, the pixels of the test set image are manually counted to calculate the porosity, which is compared with the porosity calculated by the neural network recognition to verify the effectiveness of the method. Figure 2 This is a schematic diagram of the welding structure of the lock piece of an embodiment of the present invention. Figure 3 This is a DCGAN network model diagram of an embodiment of the present invention.
[0049] In this example, a method for identifying the porosity of a lock plate weld based on a DCGAN network and semantic segmentation technology includes the following steps:
[0050] 1. Get the image of the pores in the weld of the lock piece
[0051] The X-ray detection method is used to penetrate the welded lock plate, generate and record images, obtain a two-dimensional pore picture, and construct an experimental data set of the lock plate weld. When using the X-ray method to detect porosity, the lock plates should be placed completely parallel so that the ratio of the length and width of the obtained two-dimensional pore map is consistent.
[0052] 2. Image Preprocessing
[0053] First, the image obtained from the experiment is grayed out, and then the grayscale image is binarized to generate a binary image:
[0054]
[0055] Where, T is the selected grayscale threshold, I gray (x, y) is the initial grayscale image, I binary (x, y) is a binary image, and then the contour with the largest area is detected in the binary image:
[0056]
[0057] Among them, C max is the maximum contour obtained, C is the contour set, c i is the i-th contour in the set, A(ci ) is the contour c i Based on the area of , calculate its minimum enclosing rectangle and obtain the coordinates of the four vertices of the rectangle:
[0058] {P1,P2,P3,P4}=MinRect(C max )
[0059] Among them, {P1, P2, P3, P4} is the minimum circumscribed rectangle vertex set of the maximum contour, and then ensure that the vertices are arranged in the specified order:
[0060] {P'1,P'2,P'3,P'4}=Sort({P1,P2,P3,P4})
[0061] Among them, {P'1, P'2, P'3, P'4} are the sorted vertex coordinates. Finally, for image I gray Perform perspective transformation to obtain the corrected image I corrected ; Then crop the corrected image to remove irrelevant background, and finally, divide the processed image dataset into training set and test set.
[0062] 3. Data expansion based on DCGAN network
[0063] The DCGAN network is trained based on the images in the training set, and the trained model is used to generate images to expand the training set. This is a data expansion method based on the generative adversarial network. The principle is to generate new high-quality images through adversarial training of the generator G and the discriminator D. The final generated images can be used as part of the expanded data set to enhance the diversity of training data and improve the training effect of the semantic segmentation model. The Adam optimization algorithm is used, which dynamically adjusts the learning rate by calculating the first-order momentum and second-order momentum of the gradient, significantly improving the training efficiency of the generator and discriminator and the stability of model convergence. The update formula is:
[0064] m t =β1m t-1 +(1-β1)g t
[0065]
[0066] 4. Among them, m t is the first-order momentum of the gradient, m t-1 is the first-order momentum at the previous moment, v t is the second-order momentum of the square of the gradient, v t-1 is the second-order momentum at the previous moment, α is the learning rate, β1, β2 are the attenuation coefficients of the first-order and second-order momentum, ε is a small constant to prevent the denominator from being zero, and g t is the current gradient, θt is the model parameter of the current time step, θ t+1 is the model parameter for the next moment.
[0067] 5. Attention U-Net model training and optimization
[0068] A semantic segmentation model Attention U-Net is established, and the model performance is optimized by cross-validation training using an expanded training set. The structure of the network is similar to the standard U-Net network model, including an encoder, a decoder, and a skip connection. The difference is that Attention U-Net introduces an attention mechanism in the skip connection. For each skip connection, Attention U-Net provides a weighted encoder feature map to the decoder, which can suppress unimportant background features and highlight the features of key areas. The network uses the attention mechanism to focus on the most important parts of the image, thereby improving the segmentation accuracy. The model is trained using an expanded training set and a cross-validation strategy to improve the segmentation accuracy of the network under different image conditions.
[0069] 5. Porosity calculation
[0070] The trained model is identified on the test set, and the porosity is calculated by the ratio of the number of pore pixels identified by segmentation to the total number of pixels in the welding area. The porosity calculation method is:
[0071]
[0072] Where P is the porosity expressed in percentage, N void is the number of pore pixels identified by segmentation, N total is the total number of pixels in the welding area.
[0073] 6. Verification of calculation results
[0074] The porosity is calculated by manually counting the pixels of the test set images, and then compared with the porosity calculated by the neural network recognition. The error between the two is calculated. When the error meets the following conditions, the method is considered to be effective:
[0075] Error = | P method -P manual |<Δ
[0076] Among them, P method is the porosity calculated based on neural network recognition, P manual is the porosity calculated by manual statistical method, Δ is the predetermined error threshold, and 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 only for illustrating the principles and functions of the present invention, and are not intended to limit the present invention. Any person familiar with the art can adjust or modify the above embodiments without departing from the spirit and scope of the present invention. Therefore, any equivalent changes or adjustments made by a person with ordinary knowledge in the technical field without departing from the core ideas and technical solutions disclosed in the present invention should be included in 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: Step S1: using an X-ray detection method to penetrate the welded lock piece, generate and record an image, obtain a two-dimensional pore image, and construct an experimental data set of the lock piece weld; Step S2: image preprocessing, including grayscale processing, image correction based on perspective transformation, and cropping; Step S3: Divide the experimental data set into a training set and a test set, use the images in the training set to train the DCGAN network, and use the trained model to generate images to expand the training set; Step S4: Establish a semantic segmentation model Attention U-Net and use the expanded training set to train through cross-validation to optimize model performance; Step S5: The trained model is identified on the test set, and the porosity is calculated by the ratio of the number of pore pixels identified by segmentation to the total number of pixels in the welding area; Step S6: Manually count the pixels of the test set images to calculate the porosity, and compare it with the porosity calculated by the neural network recognition to verify the effectiveness of the method.
2. The method according to claim 1, characterized in that: The image correction operation in step S2 first performs binarization processing on the grayscale image to generate a binary image: Where, T is the selected grayscale threshold, I gray (x, y) is the initial grayscale image, I binary (x, y) is a binary image, and then the contour with the largest area is detected in the binary image: Among them, 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 contour c i Based on the area of , calculate its minimum enclosing rectangle and obtain the coordinates of the four vertices of the rectangle: {P1,P2,P3,P4}=MinRect(C max ) Among them, {P1, P2, P3, P4} is the minimum circumscribed rectangle vertex set of the maximum contour, and then ensure that the vertices are arranged in the specified order: {P′1,P′2,P′3,P′4}=Sort({P1,P2,P3,P4}) Among them, {P'1, P'2, P'3, P'4} are the sorted vertex coordinates. Finally, the initial image I gray Perform perspective transformation to obtain the corrected image I corrected .
3. The method according to claim 1, characterized in that: The DCGAN network augmented dataset is used in step S3, which is a data augmentation method based on a generative adversarial network. The principle is to generate new high-quality images through adversarial training of the generator G and the discriminator D. The final generated image can be used as part of the augmented dataset to enhance the diversity of training data and improve the training effect of the semantic segmentation model.
4. The method according to claim 1, characterized in that: The DCGAN network used in step S3 adopts the Adam optimization algorithm, which dynamically adjusts the learning rate by calculating the first-order momentum and second-order momentum of the gradient, significantly improving the training efficiency of the generator and discriminator and the stability of model convergence. The update formula is: m t =β1m t-1 +(1-β1)g t Among them, m t is the first-order momentum of the gradient, m t-1 is the first-order momentum at the previous moment, v t is the second-order momentum of the square of the gradient, v t-1 is the second-order momentum at the previous moment, α is the learning rate, β1, β2 are the decay coefficients of the first-order and second-order momentum, ε is a small constant to prevent the denominator from being zero, and g t is the current gradient, θ t is the model parameter of the current time step, θ t+1 is the model parameter for the next moment.
5. The method according to claim 1, characterized in that: The Attention U-Net semantic segmentation neural network used in step S4 has a structure similar to that of the standard U-Net, including an encoder, a decoder, and a skip connection. The difference is that the Attention U-Net introduces an attention mechanism in the skip connection. For each skip connection, the Attention U-Net provides a weighted encoder feature map for the decoder, which can suppress unimportant background features and highlight the features of key areas. The network uses the attention mechanism to focus on the most important part of the image, thereby improving the segmentation accuracy. The model is trained using the expanded training set and a cross-validation strategy to improve the segmentation accuracy of the network under different image conditions.
6. The method according to claim 1, characterized in that: The porosity calculation method in step S5 is: Where P is the porosity expressed in percentage, N void is the number of pore pixels identified by segmentation, N total is the total number of pixels in the welding area.
7. The method according to claim 1, characterized in that: In step S6, the porosity calculated by the identification 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 to be effective: Error = |P method -P manual |<Δ Among them, P method is the porosity calculated based on neural network recognition, P manual is the porosity calculated by manual statistical method, Δ is the predetermined error threshold, and when the error value is less than the predetermined threshold Δ, the identification method is considered to be effective and reliable.
Citation Information
Patent Citations
Stained invoice identification method
CN112800946A
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