Weld defect detection method and system
By combining adaptive pseudo-color coding and lighting rendering techniques with a wavelet transform-based YOLO detection network, the problem of insufficient depth map feature representation is solved, improving the accuracy and robustness of welding defect detection, especially the ability to identify subtle defects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG AOPUTE TECH CO LTD
- Filing Date
- 2026-03-26
- Publication Date
- 2026-07-03
AI Technical Summary
Existing welding defect detection methods suffer from insufficient depth map feature representation, low visual contrast, and lack of surface normal information, resulting in low defect detection accuracy, particularly in the inability to identify subtle defects in the depth direction.
Adaptive pseudo-color coding and lighting rendering techniques are employed. Color mapping is performed by constructing a lookup table based on the cumulative distribution function of the depth map. Pixel-level normal vectors are calculated and lighting rendering is carried out. Combined with the YOLO defect detection network based on wavelet transform, the geometric features and feature information of the weld surface are enhanced.
It significantly improves the accuracy and robustness of weld defect detection, especially the ability to identify subtle defects in the depth direction, enhances the representation of the three-dimensional geometric features of the weld surface, and improves visual contrast and feature representation.
Smart Images

Figure CN122335701A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of welding inspection technology, and in particular to methods and systems for detecting welding defects. Background Technology
[0002] Welding quality directly affects the safety and reliability of products, and accurate detection of weld defects is a key aspect of quality control.
[0003] Traditional weld inspection methods primarily utilize two-dimensional grayscale or color images, but the complex texture and reflectivity of the weld surface make defect features difficult to discern. While depth maps can provide three-dimensional geometric information, directly using depth maps for defect detection presents the following problems: First, depth maps are typically represented in grayscale, resulting in low visual contrast, making it difficult to effectively identify minute changes in depth values. Most existing pseudo-color encoding methods employ fixed mapping rules, failing to consider the differences in weld depth distribution and thus unable to achieve adaptive enhancement.
[0004] Second, depth maps only contain depth information and lack surface normal information, so they cannot effectively represent the three-dimensional geometry of the weld and are insufficient in expressing surface defects such as protrusions and depressions.
[0005] Third, existing methods directly input depth maps into the detection network, failing to fully exploit the feature representation potential of depth information, resulting in low defect detection accuracy, especially insufficient ability to identify subtle defects in the depth direction.
[0006] Therefore, there is a need for a weld defect detection method that can fully utilize depth information and improve feature representation capabilities. Summary of the Invention
[0007] The purpose of this invention is to provide a welding defect detection method and system to solve the problems of insufficient depth map feature representation capability and low defect detection accuracy in the prior art.
[0008] To achieve this objective, the present invention adopts the following technical solution: In a first aspect, the present invention provides a method for detecting welding defects, which includes the following steps: S1. Obtain the depth map of the weld seam on the workpiece; S2. Adaptive pseudo-color encoding is performed on the depth map to obtain a pseudo-color image, wherein a lookup table is constructed based on the cumulative distribution function of the depth map, and the depth value is mapped to the color value through the lookup table; S3. Calculate pixel-level normal vectors based on the depth map, and perform illumination rendering on the pseudo-color image according to the pixel-level normal vectors to obtain a rendered image; S4. Input the rendered image into the defect detection network and output the defect detection result.
[0009] Preferably, step S1 specifically includes: S11. Obtain the original depth map of the weld seam of the workpiece; S12. Denoise the original depth map; S13. Perform bilateral filtering on the denoised depth map to preserve edge information while smoothing out noise.
[0010] Preferably, in step S2, adaptive pseudo-color encoding is performed through the following steps: A mapping function is constructed based on the statistical distribution characteristics of the depth map, such that the distribution of the mapped color values in the color space has a monotonic correspondence with the distribution of the depth values in the depth space.
[0011] Specifically, step S2 includes: S21. Calculate the depth distribution histogram of the depth map; S22. The histogram is summed and normalized to obtain the cumulative distribution function; S23. Map the value of the cumulative distribution function to a preset color index range to construct a lookup table; S24. Perform pseudo-color encoding on the depth map according to the lookup table.
[0012] Further, in step S21, the interval width of the histogram is calculated using the Freedman-Diaconis rule. The interval width h is determined by the interquartile range (IQR) of the depth values, and the formula for calculating the IQR is: h = 2 × IQR × N (-1 / 3) , Where N is the total number of pixels in the depth map, IQR = Q3 - Q1, Q1 is the first quartile, and Q3 is the third quartile.
[0013] Preferably, in step S22, the cumulative distribution function CDF(d) is calculated using the following formula: CDF(d) = Σ(i=d) min to d)H(i) / N, Where d is the depth value, H(i) is the number of pixels with depth value equal to i, and N is the total number of pixels in the depth map. min This represents the minimum depth value of the depth map.
[0014] Preferably, in step S23, the lookup table uses a segmented gradient mapping rule to map the depth value to RGB three-channel color values.
[0015] Preferably, the segmented gradient mapping rule includes: The depth value is divided into K intervals, where K ranges from [5, 20]. Assign a base color to each interval; Linear interpolation is performed between adjacent intervals to achieve a gradual transition. The interpolation formula is as follows: For the k-th interval, the base color is determined by the following formula: R k =255×f R (k / K), G k =255×f G (k / K), B k =255×f B (k / K), Among them, f R f G f B This is a preset color mapping function with a value range of [0,1].
[0016] Preferably, in step S3, pixel-level normal vectors are calculated based on the depth map, and the pseudo-color image is luminance modulated based on the pixel-level normal vectors.
[0017] Preferably, in step S3, the pixel-level normal vector is calculated through the following steps: Construct neighborhoods for the pixels in the depth map; Calculate the diagonal vector within the neighborhood; The normal vector is obtained by performing a cross product on the diagonal vectors. The normal vector is then normalized.
[0018] Preferably, the pixel-level normal vector is calculated using the following formula: For a pixel (x, y), calculate the two diagonal vectors: v1=(Δx,Δx,d(x+Δx,y+Δy)-d(x-Δx,y-Δy)), v2=(-Δx,Δx,d(x-Δx,y+Δy)-d(x+Δx,y-Δy)), Calculate the normal vector: n = v1 × v2, Normalization: N = n / ||n|| Where d(x,y) is the depth value of pixel (x,y), Δx is the neighborhood radius, which takes values from 1 to 3 pixels, × represents the vector cross product operation, and ||n|| represents the Euclidean norm of vector n.
[0019] Preferably, in step S3, the Phong lighting model is used for lighting rendering, and the lighting rendering using the Phong lighting model specifically includes: Calculate ambient light intensity, diffuse light intensity, and specular light intensity; The overall illumination intensity is obtained by weighted superposition of the ambient light intensity, diffuse light intensity, and specular light intensity. The pseudo-color image is modulated pixel by pixel based on the overall illumination intensity.
[0020] Furthermore, the overall illumination intensity I is calculated using the following formula: I=ka·Ia+kd·(N·L)+ks·(R·V) ns , Where ka is the ambient light coefficient, Ia is the ambient light intensity, kd is the diffuse reflection coefficient, N is the pixel-level normal vector, L is the light source direction vector, ks is the specular reflection coefficient, R is the reflection direction vector, V is the viewing direction vector, and ns is the specular index, ranging from 5 to 50. R is calculated using the following formula: R = 2(N·L)NL.
[0021] Furthermore, the ambient light coefficient ka ranges from [0.05, 0.5], the diffuse reflection coefficient kd ranges from [0.3, 0.8], and the specular reflection coefficient ks ranges from [0.1, 0.5].
[0022] Preferably, in step S4, the defect detection network is based on the YOLO series single-stage target detection network architecture; Wavelet transform processing is embedded in the feature extraction process of the backbone network of the defect detection network. Inverse wavelet upsampling is used in the neck network feature fusion process of the defect detection network.
[0023] Preferably, the wavelet transform processing specifically includes the following steps: Orthogonal wavelet filter banks are used to perform multi-scale frequency domain decomposition on the input feature map to obtain low-frequency and high-frequency components. Perform depthwise convolution on the low-frequency components and the high-frequency components respectively; The convolutional components are subjected to inverse wavelet transform to reconstruct the feature map. The reconstructed feature map is convolved point by point to obtain the output feature map.
[0024] Preferably, the inverse wavelet upsampling process specifically includes the following steps: The input feature map is split into component features of multiple scales; Inverse wavelet transform is performed on the high-frequency components at each scale to iteratively reconstruct the low-frequency approximation; The number of channels in the reconstructed feature map is adjusted by pointwise convolution.
[0025] Preferably, step S4 further includes: Non-maximum suppression processing is performed on multiple candidate detection boxes output by the defect detection network to remove overlapping redundant detection boxes; Filter out low-confidence detection results based on a preset confidence threshold.
[0026] Preferably, the defect detection result includes defect type and defect location, and the defect type includes at least one of cold solder joint, fish-scale solder joint, protrusion, burst point, pinhole and pit.
[0027] In a second aspect, the present invention provides a welding defect detection system, comprising: The depth image acquisition module is used to acquire the depth map of the weld seam on the workpiece. An image preprocessing module is used to perform adaptive pseudo-color encoding and illumination rendering on the depth map. The image preprocessing module is configured to: construct a lookup table based on the cumulative distribution function of the depth map, map depth values to color values through the lookup table, calculate pixel-level normal vectors based on the depth map, and perform illumination modulation on the pseudo-color image based on the pixel-level normal vectors. The defect detection module is used to detect defects in the rendered image.
[0028] Preferably, the depth image acquisition module is a structured light camera, a time-of-flight camera, or a binocular stereo vision camera.
[0029] Thirdly, the present invention provides a computer-readable storage medium storing program code, which, when executed by a processor, implements the welding defect detection method described above.
[0030] Compared with the prior art, the present invention has the following beneficial effects: This invention employs an adaptive pseudo-color encoding method. Firstly, it constructs a lookup table based on the cumulative distribution function of the depth map for adaptive pseudo-color encoding. This automatically adjusts the color mapping relationship according to the actual depth distribution of each depth map, resulting in more uniform and obvious color differences between different depth values. This effectively improves the visual contrast and feature representation of the depth map, making it more adaptable to the depth characteristics of different welds compared to pseudo-color encoding methods with fixed mapping rules. Secondly, by calculating pixel-level normal vectors and performing lighting rendering, the depth information is converted into lighting effects with varying brightness, further enhancing the geometric features of the weld surface, such as convexities and depressions. This provides richer and more significant feature information for subsequent deep learning detection networks. Thirdly, inputting the image processed by adaptive pseudo-color encoding and lighting rendering into the defect detection network significantly improves the accuracy and robustness of defect detection compared to directly using the original depth map, especially demonstrating better recognition capabilities for subtle defects in the depth direction.
[0031] The present invention has other features and advantages, which will be apparent from or will be set forth in detail in the accompanying drawings and following detailed description, which together serve to explain the particular principles of the invention. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a flowchart of the welding defect detection method provided in Embodiment 1 of the present invention.
[0034] Figure 2 This is a schematic diagram illustrating the principle of the Phong coloring method guided by normal vectors in Embodiment 1 of the present invention.
[0035] Figure 3 This is a schematic diagram of the four-grid neighborhood and diagonal vector of pixel P(x,y) in Embodiment 1 of the present invention.
[0036] Figure 4 This is a comparative diagram of the original depth map, pseudo-color image, and rendered result image in Embodiment 1 of the present invention, wherein (a) is the original depth map, (b) is the pseudo-color image, and (c) is the rendered result image.
[0037] Figure 5This is a schematic diagram of the Yolo-WaveletTiny model structure in Embodiment 1 of the present invention.
[0038] Figure 6 This is a schematic diagram of the WDSConv module structure in Embodiment 1 of the present invention.
[0039] Figure 7 This is a schematic diagram of the IWUpSample module structure in Embodiment 1 of the present invention.
[0040] Figure 8 This is a distribution diagram of the number of various defects in Embodiment 1 of the present invention.
[0041] Figure 9 This is a structural block diagram of the welding defect detection system provided in Embodiment 2 of the present invention. Detailed Implementation
[0042] To illustrate the possible application scenarios, technical principles, implementable specific solutions, and achievable objectives and effects of this application in detail, the following description, in conjunction with the listed specific embodiments and accompanying drawings, provides a detailed explanation. The embodiments described herein are merely illustrative of the technical solutions of this application and are therefore intended to limit the scope of protection of this application.
[0043] Please see Figures 1-8 The welding defect detection method in this embodiment includes the following steps: S1. Obtain the depth map of the weld seam on the workpiece.
[0044] In this embodiment, the depth map is acquired using a depth image acquisition device. This device can be a 3D measurement device such as a structured light camera, a time-of-flight camera, or a binocular stereo vision camera. These devices acquire distance information from each point on the weld surface of the workpiece to the camera using different measurement principles, thus forming a depth map. Specifically, the depth map is usually represented in matrix form, where the value of each pixel represents the depth value of that point.
[0045] Furthermore, step S1 specifically includes: S11. Obtain the original depth map of the weld seam on the workpiece. In this embodiment, the original depth image data of the weld seam area can be directly obtained through a depth measuring device.
[0046] S12. Denoise the original depth map.
[0047] The original depth map inevitably contains measurement noise. Denoising processing uses methods such as median filtering or Gaussian filtering to remove random noise and isolated noise points.
[0048] S13. Perform bilateral filtering on the denoised depth map to preserve edge information while smoothing out noise.
[0049] Understandably, bilateral filtering considers both spatial distance and pixel value differences, enabling it to smooth noise while preserving edge information. In this embodiment, the spatial domain standard deviation is set to 3-5 pixels, and the value domain standard deviation is adaptively adjusted according to the dynamic range of the depth map.
[0050] After the above preprocessing, a high-quality depth map is obtained, laying the foundation for subsequent pseudo-color coding and feature extraction.
[0051] S2. Adaptive pseudo-color encoding is performed on the depth map to obtain a pseudo-color image. A lookup table is constructed based on the cumulative distribution function of the depth map, and the depth values are mapped to color values through the lookup table.
[0052] The adaptive pseudo-color coding in step S2 includes the following four main steps: The first step is to calculate the depth distribution histogram (S21) to determine the statistical characteristics of the depth values; The second step is to construct the cumulative distribution function (S22) to achieve the normalization mapping of depth values; The third step is to create a lookup table (S23) to map the normalized values to color indices. The fourth step is to perform pseudo-color encoding (S24) to convert the depth map into an RGB three-channel image.
[0053] The above steps ensure the adaptability of the color mapping, enabling welds with different depth distributions to achieve optimal visual contrast. Specifically: Adaptive pseudo-color coding automatically adjusts the mapping relationship between depth values and color values based on the actual depth distribution characteristics of each depth map, resulting in a more uniform color distribution and higher visual contrast.
[0054] Furthermore, in step S2, adaptive pseudo-color coding is performed through the following steps: A mapping function is constructed based on the statistical distribution characteristics of the depth map, so that the distribution of the mapped color values in the color space has a monotonic correspondence with the distribution of the depth values in the depth space.
[0055] It is understandable that the monotonic correspondence means that if the depth value d1 is less than d2, then the mapped color index c1 is also less than c2, thus ensuring the consistency of the depth order in the color space.
[0056] Furthermore, step S2 specifically includes: S21. Calculate the depth distribution histogram of the depth map.
[0057] The depth distribution histogram counts the frequency of each depth value in the depth map. It first determines the range of depth values [dmin, dmax], then divides this range into several intervals and counts the number of pixels in each interval.
[0058] This embodiment uses the Freedman-Diaconis rule to calculate the interval width h of the histogram. The calculation formula is as follows: h = 2 × IQR × N (-1 / 3) , Where N is the total number of pixels in the depth map, and IQR is the interquartile range, defined as IQR = Q3 - Q1, where Q1 is the first quartile and Q3 is the third quartile.
[0059] The Freedman-Diaconis rule can adaptively adjust the interval width according to the actual distribution of the data, achieving a balance between preserving effective information and suppressing noise.
[0060] S22. Perform cumulative summation and normalization on the histogram to obtain the cumulative distribution function.
[0061] The cumulative distribution function CDF(d) is defined as the proportion of pixels with a depth value less than or equal to d, and its calculation formula is as follows: CDF(d) = Σ(i=d) min tod)H(i) / N, Where H(i) is the number of pixels with a depth value equal to i, N is the total number of pixels in the depth map, and d min CDF(d) is the minimum depth value of the depth map, and its range is [0,1]. It is a monotonically increasing function.
[0062] Understandably, the cumulative distribution function maps arbitrary depth values to uniform probability values, which is equivalent to histogram equalization and can automatically enhance image contrast.
[0063] S23. Map the values of the cumulative distribution function to a preset color index range and construct a lookup table.
[0064] In this embodiment, the lookup table is a one-dimensional array that stores the color value corresponding to each depth value, with the color index range set to [0, C]. max ], C max It is usually set to 255. For a depth value d, its corresponding color index c is calculated using the following formula: c=C max ×CDF(d), The correspondence between depth value d and color index c is stored in a lookup table.
[0065] Furthermore, the interval k in which it belongs is determined based on the color index c: k= c / (C max / K) , in, This indicates rounding down, and the value of k ranges from [0, K-1].
[0066] For a color index c within interval k, its corresponding RGB value is calculated using linear interpolation: Let c k =k×(C max / K) is the starting index of the k-th interval. c {k+1} =(k+1)×(C max / K) is the starting index of the (k+1)th interval. The interpolation parameter t is then calculated as follows: t=(cc k ) / (c {k+1} -c k ), The final RGB value is: R(c) = (1-t) × Rk + t × R {k+1} , G(c) = (1-t) × Gk + t × G {k+1} , B(c) = (1-t) × Bk + t × B {k+1} .
[0067] The lookup table in this embodiment uses a segmented gradient mapping rule to map depth values to RGB three-channel color values.
[0068] Specifically, the piecewise gradient mapping rules include: The depth value is divided into K intervals, with K ranging from [5, 20]. The choice of K requires a trade-off between color richness and smoothness of transition.
[0069] Assign a base color to each interval.
[0070] Linear interpolation is performed between adjacent intervals to achieve a gradual transition.
[0071] Furthermore, for the k-th interval, the base color is determined by the following formula: R k =255×f R (k / K), G k =255×f G (k / K), B k =255×f B (k / K), Among them, f R f G f BThis is a preset color mapping function with a value range of [0,1].
[0072] For a depth value d, if d falls within the k-th interval, its corresponding RGB color value is calculated by linear interpolation.
[0073] S24. Perform pseudo-color encoding on the depth map according to the lookup table.
[0074] For each pixel in the depth map, the corresponding RGB color value is obtained by looking up the lookup table based on its depth value d, and then assigned to the corresponding pixel in the pseudo-color image.
[0075] like Figure 4 As shown, the original depth map (a) is processed by adaptive pseudo-color encoding to obtain a pseudo-color image (b), which is then rendered by lighting to obtain the rendered result image (c). The CDF-based adaptive pseudo-color image has higher visual contrast, and the color differences between different depth regions are more obvious.
[0076] S3. Calculate pixel-level normal vectors based on the depth map, and perform lighting rendering on the pseudo-color image according to the pixel-level normal vectors to obtain the rendered image.
[0077] Understandably, the purpose of lighting rendering is to further enhance the three-dimensional geometric features of the weld surface. By introducing a lighting model, the changes in brightness and darkness of light illuminating the three-dimensional surface are simulated, making defects such as protrusions and depressions more obvious.
[0078] Furthermore, in step S3, pixel-level normal vectors are calculated based on the depth map, and brightness modulation is applied to the pseudo-color image based on the pixel-level normal vectors.
[0079] A pixel-level normal vector is a three-dimensional unit vector that represents the direction of the surface normal to the depth map at a pixel point, that is, the direction perpendicular to the tangent plane at that point.
[0080] Further, in step S3, the pixel-level normal vector is calculated through the following steps: Construct neighborhoods for pixels in the depth map; Calculate the diagonal vector within the neighborhood; The cross product of the diagonal vectors is used to obtain the normal vector; Normalize the normal vector.
[0081] like Figure 3 As shown, for pixel P(x,y), a four-grid neighborhood is constructed with a neighborhood radius of Δx. Points on the two diagonals of the neighborhood are selected to construct two three-dimensional vectors.
[0082] Furthermore, the pixel-level normal vector is calculated using the following formula: For a pixel (x, y), calculate the two diagonal vectors: v1=(Δx,Δx,d(x+Δx,y+Δy)-d(x-Δx,y-Δy)), v2=(-Δx,Δx,d(x-Δx,y+Δy)-d(x+Δx,y-Δy)), Calculate the normal vector: n = v1 × v2, Here, "×" represents the cross product operation, and the cross product result n is a vector perpendicular to the plane containing v1 and v2, and its direction follows the right-hand rule.
[0083] Normalization: N = n / ||n|| ||n|| represents the Euclidean norm (also called the L2 norm or modulus) of vector n. The calculation is as follows: ||n||=√(nx²+ny²+nz²).
[0084] The normalized normal vector N=(Nx,Ny,Nz) satisfies ||N||=1, and is calculated as follows: Nx = nx / ||n|| Ny = ny / ||n|| Nz=nz / ||n||.
[0085] Where d(x,y) is the depth value of pixel (x,y), Δx is the neighborhood radius, which takes values from 1 to 3 pixels, × represents the vector cross product operation, and ||n|| represents the Euclidean norm of vector n.
[0086] The choice of neighborhood radius Δx requires a trade-off between computational accuracy and noise resistance. For example, Δx=1 provides high accuracy but is sensitive to noise, while Δx=3 provides good noise resistance but may result in the loss of details. In this embodiment, Δx is preferably set to 2.
[0087] For boundary pixels, methods such as mirror filling, constant filling, or ignoring the boundary can be used. This embodiment uses constant filling, setting the depth value outside the boundary to the depth value at the boundary.
[0088] Furthermore, in step S3, the Phong lighting model is used for lighting rendering, specifically including: Calculate ambient light intensity, diffuse light intensity, and specular light intensity; The overall illumination intensity is obtained by weighted superposition of ambient light intensity, diffuse light intensity, and specular light intensity; The pseudo-color image is modulated pixel by pixel based on the overall illumination intensity.
[0089] like Figure 2As shown, the Phong lighting model decomposes lighting into three components: Indirect lighting in an ambient light simulation scene, the ambient light component is: Iambient = ka × Ia.
[0090] Diffuse light simulates the scattering of light by a rough surface. The intensity of diffuse light is proportional to the cosine of the angle between the surface normal vector N and the light source direction vector L: Idiffuse=kd×(N·L).
[0091] Here, "·" represents the vector dot product (also known as the inner product). For unit vectors N and L, The dot product N·L is calculated as follows: N·L = Nx × Lx + Ny × Ly + Nz × Lz. The result is equal to the cosine of the angle between the two vectors, i.e., N·L=cos(θ).
[0092] When N and L are in the same direction, N·L=1 (the surface faces the light source directly, and diffuse reflection is strongest); When perpendicular, N·L=0 (the surface is sideways to the light source, and there is no diffuse reflection); Conversely, N·L = -1 (the surface is facing away from the light source).
[0093] Specular reflection simulates the specular reflection of light on a smooth surface, producing a highlight effect: Ispecular = ks × (R·V) ns .
[0094] Furthermore, the overall illuminance I is calculated using the following formula: I=ka·Ia+kd·(N·L)+ks·(R·V) ns , Where ka is the ambient light coefficient, Ia is the ambient light intensity, kd is the diffuse reflection coefficient, N is the pixel-level normal vector, L is the light source direction vector, ks is the specular reflection coefficient, R is the reflection direction vector, V is the viewing direction vector, and ns is the specular index, with a value of 5-50.
[0095] The reflection direction vector R is calculated using the following formula: R = 2(N·L)NL, This formula is based on the law of optical reflection and represents the direction of incident light L after being reflected by the normal vector N.
[0096] Furthermore, the ambient light coefficient ka ranges from [0.05, 0.5], the diffuse reflectance coefficient kd ranges from [0.3, 0.8], and the specular reflectance coefficient ks ranges from [0.1, 0.5].
[0097] These parameters have been experimentally verified to produce optimal visual results in weld inspection scenarios.
[0098] In actual implementation, the light source direction L and the viewing direction V are preset. In this embodiment, the light source direction L and the viewing direction V are both set to (0,0,1), that is, the light source shines vertically downwards, and the observer observes vertically downwards from directly above.
[0099] The pseudo-color image is modulated pixel-by-pixel based on the overall illumination intensity. For each pixel in the pseudo-color image, its RGB color value is multiplied by the illumination intensity of that pixel to obtain the rendered color value.
[0100] For a pixel with coordinates (x, y) in a pseudo-color image, let its RGB value after pseudo-color encoding be (R0, G0, B0), and the illumination intensity of this pixel be I(x, y). Then the RGB value (R', G', B') after lighting rendering is calculated as follows: R'(x,y)=R0(x,y)×I(x,y), G'(x,y)=G0(x,y)×I(x,y), B'(x,y)=B0(x,y)×I(x,y).
[0101] To avoid color value overflow (exceeding 255), I(x,y) is usually normalized to the [0,1] interval, or the result is truncated: R'(x,y)=min(255,R0(x,y)×I(x,y)).
[0102] like Figure 4 As shown in (c), after lighting rendering, the three-dimensionality of the weld surface is enhanced, the raised parts show highlights, the recessed parts show shadows, and the defect features are more obvious.
[0103] The illumination parameters are adjusted according to the surface characteristics of the weld. The preferred parameter combination used in this embodiment is ka=0.15, kd=0.65, ks=0.25, ns=20, Ia=1.0. For different weld types, the diffuse reflection coefficient kd (0.3-0.8) and the specular reflection coefficient ks (0.1-0.5) can be adjusted.
[0104] S4. Input the rendered image into the defect detection network and output the defect detection results.
[0105] like Figure 5As shown, this embodiment refers to the YOLO defect detection network embedded with wavelet transform as Yolo-WaveletTiny (Yolo-WT for short). The defect detection network is based on the YOLO series of single-stage object detection network architectures. It can be understood that YOLO transforms the object detection task into a regression problem, directly predicting bounding box coordinates and class probabilities from image pixels, achieving end-to-end training and detection. The overall structure of the defect detection network includes three parts: a backbone network, a neck network, and a detection head.
[0106] Furthermore, wavelet transform processing is embedded in the feature extraction process of the backbone network of the defect detection network.
[0107] Wavelet transform can simultaneously extract low-frequency global information and high-frequency detail information of an image, and has a stronger multi-scale feature extraction capability compared with ordinary convolution.
[0108] Furthermore, the wavelet transform processing in this embodiment specifically includes the following steps, such as... Figure 6 As shown, the WDSConv (Wavelet Depthwise Separable Conv) module is based on the architecture design of depthwise separable convolution. It replaces the depthwise convolution layer with a single-level wavelet convolution, and then linearly combines the output of the single-level wavelet convolution through pointwise convolution. While keeping the model lightweight, it improves the model's ability to capture multi-scale spatial features.
[0109] For a given feature map X, the Haar wavelet transform (WT) in two-dimensional space is implemented through a depthwise convolution operation with a stride of 2. The filter bank used includes a low-pass filter fLL and high-pass filters fLH, fHL, and fHH. Filtering and reducing the low-frequency and high-frequency components of the input signal using wavelet transform is essentially performing a multi-filter depthwise convolution operation on the input X, outputting four-scale component features XLL, XLH, XHL, and XHH. Here, XLL represents the low-frequency component of X, while XLH, XHL, and XHH represent its high-frequency components in the horizontal, vertical, and diagonal directions, respectively.
[0110] Subsequently, a small-kernel depthwise convolution is performed on the four component features obtained from wavelet decomposition, where W is the weight tensor of the k×k depth convolution kernel, and its input channel number is four times that of X. This operation not only achieves convolutional separation between frequency components but also expands their receptive field.
[0111] Since the filter kernel forms an orthogonal normalized basis, the inverse wavelet transform (IWT) can be achieved through transposed convolution, which reconstructs the convolved component features into a feature map Y with the same size as the original input.
[0112] Next, the original image X is convolved and then added to Y to obtain the result image of the depth convolution step. Finally, the result image of the depth convolution step is linearly combined by point-by-point convolution to obtain the final output feature map F.
[0113] This embodiment uses Haar wavelets as the basis functions of the orthogonal wavelet filter bank. Haar wavelets are the simplest orthogonal wavelets, with filter coefficients of only {1 / √2,1 / √2} and {1 / √2,-1 / √2}. They have low computational complexity, are sensitive to edge and abrupt signals, are suitable for extracting edge features of weld defects, and meet the conditions for complete reconstruction. After inverse transformation, the original signal can be accurately recovered.
[0114] Furthermore, inverse wavelet upsampling is employed during the feature fusion process of the neck network in the defect detection network. The neck network is responsible for fusing the multi-scale features output by the backbone network.
[0115] Furthermore, the inverse wavelet upsampling processing in this embodiment specifically includes the following steps, such as... Figure 7 As shown, the IWUpSample (Inverse Wavelet Upsample) module replaces the traditional interpolation upsampling method with multi-scale inverse wavelet transform. It completes accurate feature reconstruction through a Haar wavelet orthogonal filter bank, and then achieves channel dimension adaptation through lightweight pointwise convolution. While maintaining the lightweight characteristics of the model without adding any new trainable parameters, it effectively preserves high-frequency details such as defect edges and textures, improving the model's ability to represent features of small-scale defects.
[0116] First, the input feature map is split into i channels. Each split is based on the channel organization rules of multi-scale wavelet analysis, dividing it into four scale-consistent component features, including a low-frequency component XLL and high-frequency components XLH, XHL, and XHH. i C0 represents the channel expansion factor corresponding to the i-th layer wavelet analysis, where C0 is the number of basic channels for a single component.
[0117] Then, starting from the highest scale i, the high-frequency components of each scale are traversed in reverse order to perform inverse wavelet transform (IWT) to reconstruct a more refined low-frequency approximation. The IWT operation for each scale j can be accomplished by transposed convolution, reconstructing the high-frequency components XLH, XHL, XHH and the low-frequency component XLL into a lower-frequency approximation of the next level.
[0118] After i iterations, the reconstructed features at the original resolution are obtained. Finally, the channels are adjusted by 1×1 pointwise convolution to obtain the final output feature map.
[0119] Compared to traditional bilinear interpolation, inverse wavelet upsampling can better recover high-frequency detail information and improve the detection capability of small target defects.
[0120] The detection heads predict the bounding boxes and categories of the targets based on the fused feature maps. Each detection head outputs a feature map, predicting several candidate boxes for each pixel. Each candidate box includes: bounding box coordinates, confidence score, and class probability.
[0121] The network was trained using a labeled weld defect dataset, and the network parameters were optimized through backpropagation. After training, the network can directly output the location and type of defects from the rendered image end-to-end.
[0122] Training dataset creation: The collected raw depth maps were processed to generate pseudo-color images and rendered results. Three datasets were constructed, each with 581 images. The defect categories include inveracious soldering, fish-scale welding, bumps, bursts, pinholes, and pits. The distribution of the number of each defect category is shown in the attached figure. Figure 8 As shown. The image size is uniformly 640×640; it is divided into training set, validation set and test set in an 8:1:1 ratio. The labelImg software is used to complete the dataset annotation, and finally the original depth map defect dataset, pseudo-color defect dataset and rendered defect dataset are obtained.
[0123] Experimental Environment and Training Parameter Settings: The depth-normal vector guided lighting rendering method of this invention is implemented based on the OpenCV 4.11.0 computer vision library, using C++11 as the programming language; the deep learning program of this invention is implemented based on the PyTorch 2.5.1 deep learning framework, with the corresponding CUDA version 11.8 and Python 3.10 as the programming language. The GPU used in the experiment was an NVIDIA GeForce RTX3060 with 12 GB of video memory, and the CPU was an i5-12500. During model training, no pre-trained weights were used; the YOLO model was trained from scratch. The training hyperparameter settings are shown in Table 1: Table 1 Training parameter settings Evaluation metrics: The defect detection evaluation metrics used in this experiment include precision, recall, average precision (AP), and average average precision (mAP), with the latter serving as the primary evaluation standard. These metrics are defined as follows: Precision = TP / (TP + FP) Recall = TP / (TP + FN) AP=∫p(r)dr, mAP=(1 / n)×ΣAPi, Here, TP represents the number of true positives, FP represents false positives, and FN represents false negatives. p(r) is the precision-recall curve, and n represents the total number of categories. AP quantifies the detection precision of a single category, while mAP averages the precision across all categories.
[0124] In addition, the number of parameters is used to evaluate the number of parameters in the model, reflecting the total number of trainable parameters in the network architecture. GFLOPs (floating-point operations per second) is used to measure the computational complexity of the model, representing the total number of floating-point operations performed during the model's operation. The lower the GFLOPs value, the lower the computational complexity and the less resource consumption.
[0125] To better understand this invention, the depth-normal vector guided lighting rendering method of this embodiment will be explained and verified through multiple examples below.
[0126] Case 1 To verify the feasibility and superiority of the depth-normal vector guided lighting rendering method proposed in this invention in enhancing the texture feature recognition of defect areas and helping the model accurately distinguish between defective and normal areas, the YOLOv11n detection model was used to train on the original depth map defect dataset, pseudo-color defect dataset, and rendered defect dataset, and the evaluation metrics were compared. The comparison results of each method are shown in Table 2: Table 2 Comparison results of various methods Experimental data fully demonstrate that the depth-normal vector guided lighting rendering method can significantly improve the overall performance of weld defect detection, and its advantages are significant compared to the original depth map and the traditional pseudo-color coding method. 1. In terms of core detection accuracy metrics, the model corresponding to the rendered image dataset achieved an mAP@50 of 85.7%, which is 6.7 percentage points and 6.0 percentage points higher than the original depth map dataset and pseudo-color image dataset, respectively; the mAP@50-95 reached 42.9%, which is 6.5 percentage points and 5.8 percentage points higher than the original depth map and pseudo-color image, respectively. This indicates that the rendered image can effectively enhance the feature representation of the defect area and improve the model's ability to identify weld defects. 2. In terms of balancing defect detection completeness and recognition accuracy, the Recall index of the rendered image dataset reached 81.1%, which is significantly higher than that of the original depth map and pseudo-color map, effectively reducing the risk of missing small defects and low-contrast defects; at the same time, the Precision index remained at a high level of 82.9%, which is much higher than that of the original depth map, achieving synergistic optimization of detection rate and accuracy. 3. Comparing the detection performance of the original depth map and the pseudo-color map, it can be seen that although the traditional pseudo-color encoding can slightly improve precision, it significantly sacrifices recall. The original depth map has a low overall index due to the lack of texture feature recognition. This further highlights the technical advantage of the rendering method of this invention, which can simultaneously preserve depth information and enhance texture details.
[0127] In summary, the depth-normal-guided lighting rendering method successfully solves the core problems of missing texture features in the original depth map and imbalance in feature representation in traditional pseudo-color maps by fusing depth information with normal-guided lighting modulation. It can provide more discriminative input features for deep learning detection models and effectively help the models accurately distinguish between defects and normal areas.
[0128] Case 2 To evaluate the technical effectiveness and synergistic effects of each module in YOLO-WT, the WDSConv and IWUpSample modules were gradually introduced into the baseline model YOLOv11n to verify their effectiveness. Ablation experiments used a rendered defect dataset. Table 3 shows the impact of adding or removing each module on the evaluation metrics: Table 3 Ablation Experiment Results for Each Module Experimental results show that the two modules have a clear division of labor and synergistic gains in improving model performance: First, when the IWUpSample module is introduced alone, the model's mAP@50 increases from 85.7% to 87.2% and mAP@50-95 increases from 42.9% to 43.7%, with both accuracy indicators showing positive growth. This verifies that the feature reconstruction mechanism based on inverse wavelet transform of this module can effectively preserve high-frequency details of defects, optimize the fusion of high and low-level features, and significantly improve the model's defect detection accuracy. Second, when the WDSConv module is introduced alone, the number of model parameters increases from... The model size decreased from 2.59M to 2.26M, and the computational cost (GFLOPS) decreased from 6.4 to 5.8, demonstrating a significant lightweighting effect. Although some accuracy indicators fluctuated slightly, it provided lightweight computational support for the deployment of the model in industrial real-time scenarios. Thirdly, when the two modules were introduced in tandem, the model achieved an optimal balance between accuracy and lightweighting. The mAP@50 reached 88.4%, an improvement of 2.7 percentage points from the baseline, and the precision improved to 87.0%, an improvement of 4.1 percentage points from the baseline. At the same time, the number of parameters was controlled at a lightweight level of 2.28M, and the computational cost remained at 6.0 GFLOPS. This fully demonstrates that the multi-scale feature decomposition capability of the WDSConv module and the accurate feature reconstruction capability of the IWUpSample module complement each other, effectively avoiding the performance shortcomings of a single module.
[0129] In summary, the ablation experiment verified the design rationality, technical effectiveness, and synergistic advantages of the WDSConv and IWUpSample modules. Together, they constitute the core technical support for the YOLO-WT network to balance detection accuracy and real-time performance, providing experimental evidence for the precise and lightweight implementation of welding defect detection in industrial scenarios.
[0130] Case 3 To verify the superiority of this model in weld defect detection, its detection performance was compared with other mainstream lightweight defect detection methods. The comparative experiment used a rendered defect dataset. The comparison results are shown in Table 4: Table 4 Comparison of Experimental Results for Various Detection Algorithms The experimental results fully demonstrate the significant superiority and scenario adaptability of the YOLO-WT model: First, in terms of core detection accuracy metrics, the YOLO-WT model's mAP@50 and Precision metrics are higher than all comparative models, effectively improving the accuracy of weld defect identification and reducing the critical risk of false detection in industrial quality control scenarios. Second, in terms of lightweight design, the YOLO-WT model has only 2.28M parameters and a computational complexity (GFLOPS) of 6.0, achieving significant lightweighting compared to most comparative models and representing the minimum among all comparative models. This provides core support for the low-hardware-cost deployment of the model in industrial scenarios.
[0131] In summary, the YOLO-WT model proposed in this invention successfully achieves both model lightweighting and improved detection performance through the collaborative design of a wavelet transform lightweight network architecture. Its overall performance is significantly better than the current mainstream cutting-edge lightweight defect detection models.
[0132] Based on Case Studies 1, 2, and 3, the YOLO-WT model proposed in this invention successfully achieves both model lightweighting and improved detection performance through the collaborative design of a depth-normal vector-guided defect feature enhancement mechanism and a wavelet transform lightweight network architecture. Its overall performance significantly outperforms current mainstream lightweight defect detection models. This model can be directly adapted to the industrial field deployment requirements of weld defect detection, possessing excellent engineering application value and feasibility, and providing an efficient and reliable technical solution for the automated and precise detection of weld defects.
[0133] Furthermore, step S4 further includes: Non-maximum suppression is applied to multiple candidate detection boxes output by the defect detection network to remove overlapping redundant detection boxes.
[0134] Non-maximum suppression sorts all candidate boxes by confidence level, selects the candidate box with the highest confidence level, and deletes other candidate boxes with high overlap with it. This process is repeated until all candidate boxes have been processed. The specific parameter settings for non-maximum suppression are as follows: IoU threshold: set to 0.45. When the intersection-union ratio of two detection boxes is greater than 0.45, the detection box with higher confidence is retained.
[0135] Confidence threshold: set to 0.25, detection boxes with a confidence level below 0.25 are filtered out.
[0136] Category NMS: Perform NMS separately for each defect category.
[0137] Filter out low-confidence detection results based on a preset confidence threshold.
[0138] Set a confidence threshold and filter out detection boxes with a confidence level below that threshold.
[0139] After nonmaximum suppression and confidence filtering, the final defect detection result is obtained.
[0140] Furthermore, the defect detection results include the defect type and defect location.
[0141] The location of the defect is given in the form of a bounding box, including the coordinates of the center point, width, and height.
[0142] The defect types in this embodiment include at least one of the following: cold solder joint, fish-scale solder joint, protrusion, burst, pinhole, and pit. Through the synergistic effect of adaptive pseudo-color coding and lighting rendering, the features of the aforementioned defects are significantly enhanced, providing strong support for accurate identification by deep learning networks.
[0143] The welding defect detection method in this embodiment makes full use of the three-dimensional geometric information of the depth map, significantly improves the feature representation through adaptive pseudo-color coding and lighting rendering, and combines with the improved YOLO detection network to achieve rapid and accurate detection of weld defects.
[0144] Example 2 like Figure 9 As shown, this embodiment provides a welding defect detection system, applied to the welding defect detection method described in the embodiment. The welding defect detection system includes: The depth image acquisition module 10 is used to acquire the depth map of the weld seam of the workpiece.
[0145] The depth image acquisition module 10 can employ 3D measurement equipment such as a structured light camera, a time-of-flight camera, or a binocular stereo vision camera. A structured light camera calculates depth by projecting structured light and analyzing distortion; a time-of-flight camera calculates depth by measuring the round-trip time of light pulses; and a binocular stereo vision camera calculates depth based on the principle of parallax.
[0146] The image preprocessing module 20 is used to perform adaptive pseudo-color encoding and illumination rendering on the depth map. The image preprocessing module is configured to: construct a lookup table based on the cumulative distribution function of the depth map, map the depth values to color values through the lookup table, calculate pixel-level normal vectors based on the depth map, and perform illumination modulation on the pseudo-color image based on the pixel-level normal vectors.
[0147] The image preprocessing module 20 implements the functions of steps S1-S3 in Embodiment 1, including denoising, bilateral filtering, pseudo-color encoding, normal vector calculation, and lighting rendering.
[0148] The defect detection module 30 is used to perform defect detection on the rendered image.
[0149] The defect detection module 30 implements the function of step S4 in Embodiment 1, including YOLO-based deep learning network detection, nonmaximum suppression, and confidence filtering.
[0150] The welding defect detection system in this embodiment acquires depth data through a depth image acquisition module, enhances the image through an image preprocessing module, and achieves intelligent detection through a defect detection module, enabling it to quickly and accurately identify weld defects.
[0151] Example 3 This embodiment provides a computer-readable storage medium storing program code. When executed by a processor, the program code implements the various steps of the welding defect detection method described in Embodiment 1. The computer-readable storage medium facilitates the storage, transmission, and deployment of the method of this invention, enabling its flexible integration into different hardware platforms and software systems.
[0152] Combination Figures 1-9This invention, on the one hand, constructs a lookup table based on the cumulative distribution function of the depth map for adaptive pseudo-color encoding. This automatically adjusts the color mapping relationship according to the actual depth distribution of each depth map, making different depth values visually more uniform and obvious in color difference, effectively improving the visual contrast and feature representation of the depth map. Compared with pseudo-color encoding methods with fixed mapping rules, it is more adaptable to the depth characteristics of different welds. On the other hand, by calculating pixel-level normal vectors and performing lighting rendering, the depth information is converted into lighting effects with brightness variations, further enhancing the geometric features of the weld surface, such as convexity and concavity, providing richer and more significant feature information for subsequent deep learning detection networks. Furthermore, inputting the image processed by adaptive pseudo-color encoding and lighting rendering into the defect detection network can significantly improve the accuracy and robustness of defect detection compared to directly using the original depth map, especially showing better recognition ability for subtle defects in the depth direction.
[0153] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting welding defects, characterized in that, Includes the following steps: S1. Obtain the depth map of the weld seam on the workpiece; S2. Adaptive pseudo-color encoding is performed on the depth map to obtain a pseudo-color image, wherein a lookup table is constructed based on the cumulative distribution function of the depth map, and the depth value is mapped to the color value through the lookup table; S3. Calculate pixel-level normal vectors based on the depth map, and perform illumination rendering on the pseudo-color image according to the pixel-level normal vectors to obtain a rendered image; S4. Input the rendered image into the defect detection network and output the defect detection result.
2. The welding defect detection method as described in claim 1, characterized in that, Step S1 specifically includes: S11. Obtain the original depth map of the weld seam of the workpiece; S12. Denoise the original depth map; S13. Perform bilateral filtering on the denoised depth map to preserve edge information while smoothing out noise.
3. The welding defect detection method as described in claim 1, characterized in that, In step S2, adaptive pseudo-color encoding is performed through the following steps: A mapping function is constructed based on the statistical distribution characteristics of the depth map, such that the distribution of the mapped color values in the color space has a monotonic correspondence with the distribution of the depth values in the depth space.
4. The welding defect detection method as described in claim 1, characterized in that, Step S2 specifically includes: S21. Calculate the depth distribution histogram of the depth map; S22. The histogram is summed and normalized to obtain the cumulative distribution function; S23. Map the value of the cumulative distribution function to a preset color index range to construct a lookup table; S24. Perform pseudo-color encoding on the depth map according to the lookup table.
5. The welding defect detection method as described in claim 4, characterized in that, In step S21, the interval width of the histogram is calculated using the Freedman-Diaconis rule. The interval width h is determined by the interquartile range (IQR) of the depth values. The formula for calculating the interquartile range (IQR) of the depth values is as follows: h=2×IQR×N (-1 / 3) , Where N is the total number of pixels in the depth map, IQR = Q3 - Q1, Q1 is the first quartile, and Q3 is the third quartile.
6. The welding defect detection method as described in claim 4, characterized in that, In step S22, the cumulative distribution function CDF(d) is calculated using the following formula: CDF(d)=Σ(i=d min tod)H(i) / N, Where d is the depth value, H(i) is the number of pixels with depth value equal to i, and N is the total number of pixels in the depth map. min This represents the minimum depth value of the depth map.
7. The welding defect detection method as described in claim 4, characterized in that, In step S23, the lookup table uses a segmented gradient mapping rule to map the depth value to RGB three-channel color values.
8. The welding defect detection method as described in claim 7, characterized in that: The segmented gradient mapping rules include: The depth value is divided into K intervals, where K ranges from [5, 20]. Assign a base color to each interval; Linear interpolation is performed between adjacent intervals to achieve a gradual transition. The interpolation formula is as follows: For the k-th interval, the base color is determined by the following formula: R k =255×f R (k / K), G k =255×f G (k / K), B k =255×f B (k / K), Among them, f R f G f B This is a preset color mapping function with a value range of [0,1].
9. The welding defect detection method as described in claim 1, characterized in that, In step S3, pixel-level normal vectors are calculated based on the depth map, and brightness modulation is performed on the pseudo-color image based on the pixel-level normal vectors.
10. The welding defect detection method as described in claim 1, characterized in that, In step S3, the pixel-level normal vector is calculated through the following steps: Construct neighborhoods for the pixels in the depth map; Calculate the diagonal vector within the neighborhood; The normal vector is obtained by performing a cross product on the diagonal vectors. The normal vector is then normalized.
11. The welding defect detection method as described in claim 10, characterized in that, The pixel-level normal vector is calculated using the following formula: For a pixel (x, y), calculate the two diagonal vectors: v1=(Δx,Δx,d(x+Δx,y+Δy)-d(x-Δx,y-Δy)), v2=(-Δx,Δx,d(x-Δx,y+Δy)-d(x+Δx,y-Δy)), Calculate the normal vector: n = v1 × v2, Normalization: N = n / ||n|| Where d(x,y) is the depth value of pixel (x,y), Δx is the neighborhood radius, which takes values from 1 to 3 pixels, × represents the vector cross product operation, and ||n|| represents the Euclidean norm of vector n.
12. The welding defect detection method as described in claim 1, characterized in that, In step S3, the Phong lighting model is used for lighting rendering. Specifically, the use of the Phong lighting model for lighting rendering includes: Calculate ambient light intensity, diffuse light intensity, and specular light intensity; The overall illumination intensity is obtained by weighted superposition of the ambient light intensity, diffuse light intensity, and specular light intensity. The pseudo-color image is modulated pixel by pixel based on the overall illumination intensity.
13. The welding defect detection method as described in claim 12, characterized in that, The overall light intensity I is calculated using the following formula: I=ka·Ia+kd·(N·L)+ks·(R·V) ns , Where ka is the ambient light coefficient, Ia is the ambient light intensity, kd is the diffuse reflection coefficient, N is the pixel-level normal vector, L is the light source direction vector, ks is the specular reflection coefficient, R is the reflection direction vector, V is the viewing direction vector, and ns is the specular index, ranging from 5 to 50. R is calculated using the following formula: R = 2(N·L)NL.
14. The welding defect detection method as described in claim 13, characterized in that, The ambient light coefficient ka ranges from [0.05, 0.5], the diffuse reflection coefficient kd ranges from [0.3, 0.8], and the specular reflection coefficient ks ranges from [0.1, 0.5].
15. The welding defect detection method as described in claim 1, characterized in that, In step S4, the defect detection network is based on the YOLO series single-stage target detection network architecture; Wavelet transform processing is embedded in the feature extraction process of the backbone network of the defect detection network. Inverse wavelet upsampling is used in the neck network feature fusion process of the defect detection network.
16. The welding defect detection method as described in claim 15, characterized in that, The wavelet transform process specifically includes the following steps: Orthogonal wavelet filter banks are used to perform multi-scale frequency domain decomposition on the input feature map to obtain low-frequency and high-frequency components. Perform depthwise convolution on the low-frequency components and the high-frequency components respectively; The convolutional components are subjected to inverse wavelet transform to reconstruct the feature map. The reconstructed feature map is convolved point by point to obtain the output feature map.
17. The welding defect detection method as described in claim 15, characterized in that, The inverse wavelet upsampling process specifically includes the following steps: The input feature map is split into component features of multiple scales; Inverse wavelet transform is performed on the high-frequency components at each scale to iteratively reconstruct the low-frequency approximation; The number of channels in the reconstructed feature map is adjusted by pointwise convolution.
18. The welding defect detection method as described in claim 1, characterized in that, Step S4 further includes: Non-maximum suppression processing is performed on multiple candidate detection boxes output by the defect detection network to remove overlapping redundant detection boxes; Filter out low-confidence detection results based on a preset confidence threshold.
19. The welding defect detection method as described in claim 1, characterized in that, The defect detection results include defect type and defect location. The defect type includes at least one of the following: cold solder joint, fish-patterned solder joint, protrusion, burst point, pinhole, and pit.
20. A welding defect detection system, characterized in that, include: The depth image acquisition module is used to acquire the depth map of the weld seam on the workpiece. An image preprocessing module is used to perform adaptive pseudo-color encoding and illumination rendering on the depth map. The image preprocessing module is configured to: construct a lookup table based on the cumulative distribution function of the depth map, map depth values to color values through the lookup table, calculate pixel-level normal vectors based on the depth map, and perform illumination modulation on the pseudo-color image based on the pixel-level normal vectors. The defect detection module is used to detect defects in the rendered image.
21. The welding defect detection system as described in claim 20, characterized in that, The depth image acquisition module is a structured light camera, a time-of-flight camera, or a binocular stereo vision camera.
22. A computer-readable storage medium, characterized in that, The device stores program code that, when executed by a processor, implements the welding defect detection method according to any one of claims 1 to 19.