Weld defect detection image enhancement method

By constructing a weld defect enhancement network and combining technical means such as reverse image processing and self-adjusting curve processing, the problem of insufficient clarity and contrast of weld images is solved, and the accuracy of weld defect detection is significantly improved.

CN119559105APending Publication Date: 2025-03-04ZHEJIANG GONGSHANG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411529366.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In the prior art, the clarity of obtaining weld images is limited and the contrast is poor, resulting in misjudgment in the judgment of weld defect type and dimensional measurement.

Method used

A method for detecting image enhancement of weld defects is proposed. By constructing a weld defect enhancement network, the image is subjected to four-layer convolution and three-layer deconvolution processing, combined with reverse image processing and self-adjusting curve processing, the loss function is used to perform multi-faceted image enhancement.

Benefits of technology

It effectively improves the contrast between weld defects and background, reduces misjudgment, and improves the accuracy and reliability of weld quality inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559105A_ABST
    Figure CN119559105A_ABST
Patent Text Reader

Abstract

The invention discloses a weld defect detection image enhancement method. The method comprises the following steps: S1, inputting an image I, constructing a weld defect enhancement network, performing four-layer convolution and three-layer deconvolution processing on the image I, calculating a reverse image I 'through I' = 1-I, performing five-layer convolution processing on the reverse image I ', and adding an obtained result and a processing result of the image I; s2, dividing the addition result by two to obtain an average image, segmenting the average image into eight parts, performing self-adjustment curve and reverse image self-adjustment curve processing on the eight segmented images, and combining output three-channel curve parameter mapping to obtain final parameter mapping of each processing; and S3, fitting a self-adjusting curve processing result through an amplitude controller, calling a loss function to enhance the eight segmented images, and restoring and outputting an enhanced image. According to the method, the contrast of the weld defect and the background and the definition of the image are enhanced, and the visual effect of the weld defect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of welding detection, and in particular to an image enhancement method for welding defect detection. Background Art

[0002] Welding technology is widely used in various key fields such as infrastructure manufacturing, aerospace, metallurgical industry, petrochemical industry, national defense science and technology, and equipment manufacturing. Welding can be divided into gas welding, resistance welding, arc welding, induction welding, laser welding, etc. according to the process, and can be divided into automatic welding, semi-automatic welding, and manual welding according to the welding method. During welding, welded parts may have appearance defects and internal defects due to the influence of production equipment and production processes. For example, appearance defects such as weld nodules, undercuts, welding deformation and dents can be directly identified by the naked eye, but internal defects such as lack of fusion, lack of penetration, cracks, slag inclusions and pores will reduce the quality of welded products. Welding failure can be caused by corrosion and fatigue damage in daily application, or even lead to system collapse, and even catastrophic consequences.

[0003] At present, most small and medium-sized enterprises still rely on manual inspection. The problems with manual inspection are that different inspectors have slightly different understandings and implementations of the assessment standards, and the shape and size of the defects are usually measured directly on the film by inspectors using a vernier caliper, and the accuracy needs to be improved. In addition, long-term and multi-batch inspection work will cause eye fatigue, thereby increasing the probability of missed detection and misjudgment. Therefore, it is imperative to develop an automatic inspection system based on computer vision technology. To automatically detect weld defects, you must first obtain a digital weld defect image.

[0004] There are two main ways to obtain digital weld defect images at this stage. One is to obtain a film of the welding condition through an X-ray machine, and then scan the film into a digital image through an image scanner. The other is to directly obtain the digital weld image through an X-ray machine, a radiographic imaging board, and a digital image acquisition card.

[0005] However, the digital weld images obtained by these two methods have the problem of limited clarity, especially when the density of the weld defect part causes the color contrast between the various weld defects after imaging and the background to be low, which can easily lead to subsequent misjudgment in the type judgment and size measurement of the weld defect. Summary of the invention

[0006] In order to solve the problem of limited clarity and poor contrast of weld images obtained in the prior art, the present invention proposes a weld defect detection image enhancement method.

[0007] The specific technical solution is as follows: A weld defect detection image enhancement method, comprising:

[0008] S1: Input image I, build a weld defect enhancement network, perform four-layer convolution and three-layer deconvolution processing on image I, calculate the reverse image I' through I'=1-I, perform five-layer convolution processing on the reverse image I', and add the obtained result to the processing result of image I;

[0009] S2: Divide the addition result by two to obtain an average image, and divide the average image into eight parts, perform self-adjustment curve and reverse image self-adjustment curve processing on the eight divided images, and combine the output three-channel curve parameter mapping to obtain the final parameter mapping for each processing;

[0010] S3: Fit the processing results of the self-adjusting curve through the amplitude controller, call the loss function to enhance the eight segmented images, and restore and output the enhanced images.

[0011] Furthermore, the processing of the image I includes: performing three-layer convolution and three-layer deconvolution operations on the image I, superimposing the first layer of convolution and the third layer of deconvolution, superimposing the second layer of convolution and the second layer of deconvolution, and skipping the convolution layer using the Tanh activation function in the last layer.

[0012] Furthermore, the convolution processing of the reverse image I' includes: performing four layers of convolution on the reverse image I' using the Relu function activation, and skipping the convolution layer using the Tanh activation function in the last layer.

[0013] Furthermore, the processing of image I also includes: introducing a CBAM attention mechanism after the first deconvolution layer, the second deconvolution layer, and the third deconvolution layer of image I.

[0014] Furthermore, the processing of the reverse image I' also includes: introducing a CBAM attention mechanism after the third convolution layer and the fourth convolution layer of the reverse image I'.

[0015] Furthermore, the loss function formula is:

[0016] L total =L local +L ot +L mooth +L up ,

[0017] Among them, L total is the total loss, L local is the local enhancement loss, L ot is the brightness control loss, L mooth is the contrast loss, L up Light continuity loss.

[0018] Furthermore, the self-adjusting curve formula is:

[0019]

[0020] Where A is a parameter map with the same size as the given image, LE n (x) is the enhanced image of the input image, x is the pixel coordinate, β is the amplitude controller whose value is controlled by a piecewise function, and A(x) is a curve parameter map.

[0021] Furthermore, the formula of the reverse image self-adjustment curve is:

[0022]

[0023] where X is a parameter map with the same size as the inverse image of a given image, and K n (x) is the enhanced image of the input image, x is the pixel coordinate, α∈[-2,2] is an adjustable parameter, and B(x) is the curve parameter map of the inverse image.

[0024] Furthermore, the amplitude controller fits the amplitude values ​​of different distributions through the amplitude curve. The amplitude curve formula is as follows:

[0025]

[0026] The above technical solution has the following advantages or technical effects:

[0027] 1. The present invention avoids the risk of overfitting in image processing by introducing an asymmetric weld image enhancement network. Through a network model with high generalization ability, the network model can better adapt to weld defect image recognition and processing tasks in different scenarios.

[0028] 2. The present invention enhances the contrast between weld defects and the background, making weld defects more prominent in the image, improving the visualization effect of weld defects, and facilitating subsequent analysis and processing; reducing misjudgment of weld defect types and size measurement, improving the accuracy and reliability of weld quality detection, and providing more powerful support for subsequent weld repair or improvement.

[0029] 3. The present invention applies reverse image processing, which can better focus on the details of the weld image, and combined with the corresponding self-adjusting curve, it can better enhance the details of the dark area and achieve the effect of enhancing the contrast.

[0030] 4. The present invention provides a new loss function, which further improves the image processing effect by performing all-round enhancement from multiple key aspects such as weld image clarity, image density, and weld-background contrast, providing strong technical support for application scenarios such as weld quality inspection and automated welding.

[0031] 5. The present invention creatively introduces an amplitude controller, which can reduce the overexposure problem that is easily overlooked during the image enhancement process. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 is a flow chart of the method of the present invention;

[0033] Figure 2 is a schematic diagram of a weld defect enhancement network of the present invention;

[0034] Figure 3 It is a schematic diagram of the CBAM attention mechanism of the present invention. DETAILED DESCRIPTION

[0035] In order to make the technical solution of the present invention clearer, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0036] like Figure 1 As shown, a weld defect detection image enhancement method comprises:

[0037] S1: Input image I, build a weld defect enhancement network, perform four-layer convolution and three-layer deconvolution processing on image I, calculate the reverse image I' through I'=1-I, perform five-layer convolution processing on the reverse image I', and add the obtained result to the processing result of image I;

[0038] S2: Divide the addition result by two to obtain an average image, and divide the average image into eight parts, perform self-adjustment curve and reverse image self-adjustment curve processing on the eight divided images, and combine the output three-channel curve parameter mapping to obtain the final parameter mapping for each processing;

[0039] S3: Fit the processing results of the self-adjusting curve through the amplitude controller, call the loss function to enhance the eight segmented images, and restore and output the enhanced images.

[0040] In the actual image processing process, weld defects usually do not have paired data, so the conventional training model is prone to poor performance in the process of processing actual data, and there is a risk of overfitting. Therefore, the weld defect enhancement network used in the present invention does not rely on paired and unpaired training data, which can well avoid the risk of overfitting. The weld defect enhancement network is as follows: Figure 2 shown.

[0041] The weld defect enhancement network is used to perform convolution and deconvolution processing on the image and enhance the algorithm. It is equipped with a CBAM (Convolutional Block Attention Module) attention mechanism and an amplitude controller, which can effectively process the black area in the weld defect, improve the contrast between the tungsten-containing part and the connected area, effectively focus on and process the defect area, and reduce the overexposure effect caused by image enhancement, and enhance the recognition of weld images. The CBAM attention mechanism is as follows: Figure 3 As shown in the figure, after the input feature is input, the attention map is inferred along two separate dimensions of the channel attention model (Channel Attention Module) and the spatial attention model (Spatial Attention Module), and then the attention map and the input feature map are convolved to perform adaptive feature refinement, and finally the refined feature is output.

[0042] The specific process of weld defect detection image enhancement is as follows:

[0043] After the image I is input, three layers of continuous convolution and three layers of continuous deconvolution are performed on the input image. The three layers of convolution and three layers of deconvolution are performed in sequence, wherein the first layer of convolution and the third layer of deconvolution are superimposed, the second layer of convolution and the second layer of deconvolution are superimposed, and one layer of convolution is performed after the three layers of convolution and three layers of deconvolution. The last layer of convolution skips the connection convolution layer through the Than activation function. The reverse image is obtained by calculating I'=1-I, and the reverse image is subjected to four layers of continuous convolution with Relu activation function and one layer of convolution with Than activation function. The last layer of convolution skips the connection convolution layer through the Than activation function. The CBAM attention mechanism is introduced after the first layer of deconvolution, the second layer of deconvolution, and the third layer of deconvolution of the original image, and after the third convolution and the fourth convolution in the reverse image. The enhanced network of the original image and the enhanced network of the reverse image are shown in Tables 1 and 2 below:

[0044] Table 1: Original image enhancement network

[0045]

[0046]

[0047] In Table 1, conv means convolution, deconv means deconvolution, and stride means stride.

[0048] Table 2: Inverse Image Enhancement Network

[0049] name Convolutional layer type / stride enter Output Conv1(3*3) 3*3,stride=1 256*256*3 256*256*32 Conv2(5*5) 5*5,stride=2 256*256*32 256*256*32 Conv3(5*5) 5*5,stride=2 256*256*32 256*256*32 Conv4(5*5) 5*5,stride=2 256*256*64 256*256*32 Conv5(3*3) 3*3,stride=1 256*256*64 256*256*24

[0050] In Table 2, conv means convolution and stride means step size.

[0051] At this time, the final result of the original image output is a 256*256*24 image, and the final result of the reverse image output is a 256*256*24 image. The original image output result and the reverse image output result are added and divided by two to obtain the average image, which is a 256*256*24 image. The average image is divided into eight parts, that is, average image / n, n=8, and each part of the obtained segmented image has three channels. The final segmented image is a 256*256*3 image.

[0052] The eight segmented images are processed with a self-adjusting curve and a reverse image self-adjusting curve respectively.

[0053] In view of the fact that weld defect images have low contrast and are overall dark, the present invention proposes a curve that can automatically map dark light images to enhanced versions. The parameters of the adaptive curve are completely dependent on the input image. The formula of the self-adjusting curve is as follows:

[0054]

[0055] This curve allows each pixel value of the enhanced image to be within the normalized range [0,1] to avoid information loss due to overflow truncation. In addition, the curve is monotonic to preserve the contrast of adjacent pixels. Where A is a parameter map with the same size as the given image, LE n (x) is the enhanced image of the input image, x is the pixel coordinate, β is the amplitude controller, and its value is controlled by a piecewise function. A(x) is a curve parameter graph, so that in brighter areas, the image does not change; while in darker areas, the dark areas can be better enhanced.

[0056] After the eight segmented images are enhanced by the self-adjusting curve, there may be partial exposure, which affects the subsequent processing. The present invention also adds an amplitude controller after the segmented images are enhanced by the self-adjusting curve. The enhancement amplitudes of weld images with different exposure levels are not the same, so it is necessary to determine the optimal amplitudes of images with different exposure levels based on experiments. Taking into account the inevitable differences between image samples, the enhanced amplitude of images with the same exposure level has a specific pattern to follow. A simple and effective amplitude curve is used to fit the amplitude values ​​of different distributions, and noise can be suppressed to reduce overexposure. The amplitude controller fits the amplitude values ​​of different distributions through the amplitude curve. The amplitude curve formula is as follows:

[0057]

[0058] Since the weld image has limited clarity and the reverse image obtained by inputting the image is prone to lose details, the present invention proposes a reverse image self-adjustment curve, and the reverse image self-adjustment curve formula is as follows:

[0059]

[0060] where X is a parameter map with the same size as the inverse image of a given image, and K n (x) is the enhanced image of the input image, x is the pixel coordinate, α∈[-2,2] is an adjustable parameter, and B(x) is the curve parameter map of the inverse image. The self-adjusting curve can enhance the details of the dark area and better focus on the contrast information of the weld image.

[0061] After the convolution and deconvolution processing of the image and the convolution processing of the reverse image, the average image is reprocessed through the self-adjusting curve and amplitude controller, and the reverse image self-adjusting curve, the weld defect image can already show a good processing effect. The present invention also proposes a loss function to further enhance the eight processed segmented images. The loss function formula is as follows:

[0062] L total =L local +L ot +L mooth +L up ,

[0063] Among them, L total is the total loss, L local is the local enhancement loss, L ot is the brightness control loss, L mooth is the contrast loss, L up Light continuity loss.

[0064] The local enhancement loss method is: to address the problem of limited weld image clarity, a local enhancement loss is introduced. L(x) is the input image, maxL(x) is the maximum value of the input image pixel, b is the illumination adaptation constant, and the pixel value of the area is enlarged through the local enhancement loss function to achieve the purpose of enhancement. The local enhancement loss formula is as follows:

[0065]

[0066] The brightness control loss method is as follows: In order to reduce the brightness of the weld image due to the density problem, the enhanced image is divided into N areas of size 16*16, and the pixel points X in each local area are i With adjacent pixel X i-1 The calculation is then compared with the standard value A to control the brightness within a certain range. The brightness control loss formula is as follows:

[0067]

[0068] The contrast loss method is: Since the color contrast between the weld image defect and the background is low, in order to improve the contrast and make the image clearer, the following loss function is proposed: L(x) is the input image, ▽ h L is the horizontal derivative of the input image, ▽ v L is the vertical derivative of the input image, W is the weight matrix, α is the coefficient, ||x|| is the Laplace operator, and the contrast loss formula is as follows:

[0069]

[0070] The illumination coherence loss method is: the contrast between different densities of weld images and the background is quite different. In order to maintain the monotonic relationship between adjacent pixels, the illumination coherence loss is introduced to make the enhanced image have a certain continuity by adjusting the relationship between horizontal and vertical gradients. Among them, α is the vertical gradient balance, β is the horizontal gradient balance,

[0071] ▽ h A(x) is the horizontal derivative of the input image, ▽ v A(x) is the vertical derivative of the input image, and the illumination coherence loss formula is as follows:

[0072]

[0073] After the segmented image is processed again by the loss function, the eight loss images are merged and restored into one image, and the weld image enhancement result is output.

[0074] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A weld defect detection image enhancement method, characterized in that: include: S1: Input image I, build a weld defect enhancement network, perform four-layer convolution and three-layer deconvolution processing on image I, calculate the reverse image I' through I'=1-I, perform five-layer convolution processing on the reverse image I', and add the obtained result to the processing result of image I; S2: Divide the addition result by two to obtain an average image, and divide the average image into eight parts, perform self-adjustment curve and reverse image self-adjustment curve processing on the eight divided images, and combine the output three-channel curve parameter mapping to obtain the final parameter mapping for each processing; S3: Fit the processing results of the self-adjusting curve through the amplitude controller, call the loss function to enhance the eight segmented images, and restore and output the enhanced images.

2. A weld defect detection image enhancement method according to claim 1, characterized in that: The processing of the image I includes: performing three-layer convolution and three-layer deconvolution operations on the image I, superimposing the first layer of convolution and the third layer of deconvolution, superimposing the second layer of convolution and the second layer of deconvolution, and skipping the convolution layer using the Tanh activation function in the last layer.

3. The weld defect detection image enhancement method according to claim 1, characterized in that: The convolution processing of the reverse image I' includes: performing four layers of convolution on the reverse image I' using the Relu function activation, and skipping the convolution layer using the Tanh activation function in the last layer.

4. A weld defect detection image enhancement method according to claim 2, characterized in that: The processing of the image I also includes: introducing a CBAM attention mechanism after the first layer deconvolution, the second layer deconvolution and the third layer deconvolution of the image I.

5. A weld defect detection image enhancement method according to claim 3, characterized in that: The processing of the reverse image I' further includes: introducing a CBAM attention mechanism after the third convolution layer and the fourth convolution layer of the reverse image I'.

6. A weld defect detection image enhancement method according to claim 1, characterized in that: The loss function formula is: L total =L local +L ot +L mooth +L up , Among them, L total is the total loss, L local is the local enhancement loss, L ot is the brightness control loss, L mooth is the contrast loss, L up Light continuity loss.

7. A weld defect detection image enhancement method according to claim 1, characterized in that: The self-adjusting curve formula is: Where A is a parameter map with the same size as the given image, and LE n (x) is the enhanced image of the input image, x is the pixel coordinate, β is the amplitude controller whose value is controlled by a piecewise function, and A(x) is a curve parameter map.

8. The method for weld defect detection image enhancement according to claim 1, characterized in that: The reverse image self-adjustment curve formula is: where X is a parameter map with the same size as the inverse image of a given image, and K n (x) is the enhanced image of the input image, x is the pixel coordinate, α∈[-2,2] is an adjustable parameter, and B(x) is the curve parameter map of the inverse image.

9. A weld defect detection image enhancement method according to claim 7, characterized in that: The amplitude controller fits the amplitude values ​​of different distributions through the amplitude curve, and the amplitude curve formula is as follows: