Intelligent X-ray weld defect detection method based on weld line sensing and reversible domain mapping
By using a method based on weld line sensing and reversible domain mapping, the problem of discontinuous feature extraction in weld inspection is solved, enabling high-precision automated detection of bending weld defects and improving the accuracy and reliability of the detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies lack prior knowledge of weld direction in weld inspection, resulting in discontinuous feature extraction, defect morphology being cut off or misidentified along the weld direction, and low efficiency and poor stability of manual inspection, making it difficult to meet the requirements of high-reliability manufacturing quality control.
An intelligent X-ray weld defect detection method based on weld line perception and reversible domain mapping is adopted. By constructing a direction-aware deformable pyramid and a curvature-gated cross-scale attention module, the curved weld is mapped to the weld alignment coordinate domain, directly regressing the defect center position, direction length and width. A multi-task joint optimization strategy is used to achieve accurate positioning of the defect in the original image.
It significantly improves the detection accuracy and positioning precision of weak texture and small-size defects under bending weld conditions, and realizes automated and highly reliable non-destructive testing of welds.
Smart Images

Figure CN121707944A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent welding quality inspection and industrial non-destructive testing technology, specifically involving an intelligent X-ray weld defect detection method based on weld line sensing and reversible domain mapping. Background Technology
[0002] Internal defects in welds (such as cracks, porosity, slag inclusions, and lack of fusion) directly affect the mechanical strength and service safety of welded structures, and are key indicators for quality control in industrial manufacturing. Currently, X-ray inspection is still widely used for weld inspection in engineering sites, and the results rely on manual visual interpretation of grayscale images. However, weld X-ray images present the following typical difficulties: (1) The weld is curved or non-linear, making it difficult for traditional convolution models to establish a consistent observation reference system; (2) Defects are usually long and thin with weak contrast along the weld direction and are easily submerged by weld texture or noise artifacts. (3) Traditional detection methods based on rectangular candidate boxes do not consider the curvature and directional continuity of welds, which can easily lead to defect fracture detection or repeated detection. (4) Manual inspection has significant drawbacks such as strong subjectivity, low efficiency and poor stability, making it difficult to meet the quality control requirements of high-reliability manufacturing.
[0003] With the development of deep learning, weld defect detection methods based on convolution or Transformer have gradually emerged. However, they generally assume that the weld is a straight line or a static structure, ignoring the geometric priors and directional consistency constraints of the weld. Therefore, when facing curved welds and weak texture defect scenarios, they still have problems such as high false negative rate, broken target shape and positioning misalignment.
[0004] Therefore, how to combine the geometric features of the weld centerline with the visual features of the image to achieve physically consistent feature representation and structurally intact defect detection is a key technical problem that urgently needs to be solved. Summary of the Invention
[0005] The technical problem to be solved by the present invention is that, in the above-mentioned prior art, the lack of prior knowledge of the weld direction leads to discontinuous feature extraction, and the defect morphology is cut off or misidentified along the weld direction.
[0006] To address the aforementioned issues, this invention proposes an intelligent X-ray weld defect detection method based on weld line perception and reversible domain mapping. The core of this method is to map the curved weld to the weld alignment coordinate domain, construct a direction-aware deformable pyramid and curvature-gated cross-scale attention, directly regress the defect center position, directional length, and width in the weld alignment domain, and achieve accurate positioning of the defect in the original image through inverse alignment mapping transformation and tangent / normal scale recovery.
[0007] To achieve the above-mentioned technical objectives, the technical solution adopted by the present invention is as follows: An intelligent X-ray weld defect detection method based on weld line sensing and reversible domain mapping includes: A standardized dataset with geometric semantic constraints was constructed. Grayscale X-ray images of the weld area were collected, and the weld area was cropped and grayscale normalized preprocessed. Weld defect instances and weld centerline trajectories were jointly labeled. A hybrid backbone network for weld line perception is constructed: the image is transformed to the weld-aligned coordinate domain by sequentially passing through a frequency band reweighting enhancement module, a weld line-guided coordinate transformation module, a direction-aware deformable pyramid module, and a curvature-gated cross-scale attention module, and extracting multi-scale defect features that have curvature adaptation and direction consistency with the physical structure of the weld. Design a multi-task joint optimization strategy: Construct a joint loss function that integrates classification loss and region regression loss, and introduce log-variance uncertainty modeling to achieve adaptive weighting of loss and automatic calibration of detection confidence; The defect prediction results are restored to the original image coordinate system by using the inverse transformation of the weld seam domain alignment mapping. The non-maximum suppression algorithm of weld seam direction clustering is used to cluster and remove redundancy from the candidate boxes, and the category, location and shape information of the defects are output.
[0008] Furthermore, the specific process of acquiring grayscale X-ray images of the weld area and performing weld area cropping and grayscale normalization preprocessing includes: Image acquisition and weld area cropping: The original grayscale X-ray image of the weld area is acquired by industrial X-ray flaw detection equipment, and the weld area is coarsely located and cropped to reduce background interference and invalid areas; Gray-level normalization and image quality enhancement: Histogram equalization or gamma correction is performed on the cropped image to normalize the gray-level values to the [0,1] range, thereby enhancing the contrast between the weld and defect areas.
[0009] Furthermore, the specific process of jointly annotating weld defect instances and weld centerline trajectories includes: Constructing a training label dataset: cropped weld seam images The centerline trajectory of the weld is marked using multi-segment polyline or spline fitting. And to obtain a defect semantic mask by performing instance-level mask annotation on the weld defect area. In this context, a pixel value of 0 indicates no defects. To represent different defect types, we obtain N training sample sets containing images, centerline trajectories, and defect masks. .
[0010] Furthermore, the frequency band reweighting enhancement module specifically includes: Preprocessed X-ray weld image The image is divided into K×K local blocks in a non-overlapping manner, with dimensions H×W, where H is the image height, W is the image width, and K is the side length of the local block. There are a total of B blocks. The b-th block is denoted as: Perform a two-dimensional discrete cosine transform (2D-DCT) on each block to obtain the corresponding local spectrum. This includes the low-frequency region representing the overall brightness trend of the image, the mid-frequency region describing weld texture, edge details, and local structural changes, and the high-frequency region containing noise, scan patterns, and grid line artifacts. Adaptive weights for learning frequency bands are generated using a lightweight gating network. Each frequency component is weighted according to its own weight, and low-frequency components are preserved, mid-frequency components are enhanced, and high-frequency components are suppressed to obtain the reweighted spectrum. ; Mapping the adjusted frequency domain representation back to the pixel domain: The adjusted frequency domain representation is mapped back to the pixel domain using the inverse two-dimensional discrete cosine transform (iDCT). Reconstruct the image patches and stitch them back to the original image to obtain the enhanced weld image. ,in , ,symbol This indicates element-wise multiplication. This indicates a block concatenation operation.
[0011] Furthermore, the weld line guiding coordinate transformation module specifically includes: Design a weld centerline feature sensing network to enhance the frequency domain of the weld image. As input, features are extracted through shallow convolution, enhanced residual features, and fused through channel attention. The shallow convolution uses a 7×7 kernel in the first layer and a 3×3 kernel in the second layer for feature extraction. The residual feature enhancement includes three residual blocks, each of which uses a standard convolution, normalization, activation, convolution, normalization structure. The input is directly added to the output through skip connections. The channel attention fusion module is used to highlight structural features related to the weld line and suppress irrelevant background textures to obtain the centerline enhanced feature map R. The output R is then processed by the Skeleton algorithm, a differentiable thin line extraction algorithm based on the response map, to obtain a single-pixel width weld centerline coordinate sequence C. The extracted coordinate points are topologically sorted according to the weld direction to form a continuous centerline trajectory. The centerline coordinate sequence C is obtained by subtracting the coordinate differences of adjacent points to obtain the weld direction vector. and normal vector Local directional basis matrix ; Original image coordinates Mapped to the alignment domain coordinates along the weld centerline direction The calculation formula is: ,in, Indicates the pixel coordinates of the weld centerline. Indicates the position along the weld direction. Indicates the offset perpendicular to the weld direction; Using a differentiable grid sampling function Obtain weld alignment area image ; Finally, align the weld seam to the image. The input is a Transformer backbone network, which consists of multiple stacked encoders. Each encoder is responsible for performing a global feature association and channel representation enhancement in the weld alignment domain, thereby extracting high-level semantic information such as defect morphology, texture, density gradient, and distribution along the weld direction layer by layer, resulting in a high-level semantic feature map after alignment with the weld centerline domain. .
[0012] Furthermore, the orientation-aware deformable pyramid module specifically includes: High-level semantic feature map after alignment with the weld centerline region Inputting the multi-scale feature pyramid DMFP-Net, composed of downsampling layers, yields multi-layer features ranging from high to low resolution. The calculation formula is as follows: ;in, Indicates the first Layer feature map, To indicate high-resolution details, Representing medium-resolution semantic structure, FPN represents the feature pyramid structure, indicating low-resolution details. Feature maps at each scale The orientation-aware deformable convolution DA-DCN is introduced above, and the sampling position offset of the deformable convolution is... Local directional field of weld With normal field Joint prediction, the migration field is calculated as follows ,in, This indicates a learnable convolutional kernel. Indicates feature concatenation operation; Subsequently, directional guided feature sampling is performed to focus the features on the continuous defect texture along the weld structure direction, rather than the pixel neighborhood affected by the weld curvature, resulting in directionally aligned multi-scale features: ;in, Indicates the convolution kernel weights. Indicates the sampling location; To enhance semantic consistency across scales, the multi-scale features after orientation alignment at each layer are... Perform cross-scale fusion to obtain the fused same-scale feature representation: ,in, This indicates bilinear interpolation upsampling. This represents a downsampling convolution with a stride of 2; Finally, DMFP-Net outputs a fused multi-scale feature pyramid set: This set will serve as the input for the next step, the curvature-gated cross-scale attention module.
[0013] Furthermore, the curvature-gated cross-scale attention module specifically includes: Calculate the local curvature reflecting the degree of weld bending based on the coordinate difference between adjacent points. ,according to Dynamically adjust the curvature-adaptive attention window length The calculation formula is: ;in, Indicates the basic attention window length. This represents the adjustment factor used to control the sensitivity of the attention window to changes in weld curvature: the straighter the weld, the better. The smaller the window, the longer it is, thus capturing long cracks; the more curved the weld, The larger the window, the shorter it becomes; Using weld tangential vector and normal vector Constructed directional basis matrix Rotate the attention window to align with the weld seam orientation: merging the multi-scale feature pyramid set. As input, where Semantic modeling for elongated cracks and regions with abrupt changes in thickness. Used to provide a global structural reference, the high-level semantic feature map of each layer is aligned with the weld centerline domain through the differentiable grid sampling function GridSample. The direction domain mapping and resampling are calculated using the following formula: ; in This indicates the feature map after the direction domain mapping in coordinates. eigenvalues at that location Indicates the pixel coordinates of the weld centerline. Indicates the position along the weld direction. Indicates the offset perpendicular to the weld direction; High-level semantic feature map after alignment with weld centerline region A linear transformation is performed, followed by the calculation of self-attention weights based on a scaled dot product attention mechanism and feature aggregation to obtain orientation consistency perception features that take into account weld curvature. ,in These represent the query, key, and value vectors, respectively, with d representing the feature dimension. This represents the spatiotemporal adaptive attention matrix; The directional consistency perception feature will take into account the weld curvature. High-level semantic feature map aligned with the weld centerline region Based on the features at the corresponding scale, multi-scale defect features with curvature adaptation and orientation consistency are obtained. .
[0014] Furthermore, the specific process of the multi-task joint optimization strategy includes: Setting up a defect classification branch, the operation of which includes: processing multi-scale defect features from the backbone network that have curvature adaptation and orientation consistency. The feature map is obtained by performing a 1×1 convolution. This is used to compress channel dimensions and aggregate semantic information; for Global average pooling is used to obtain the feature vector. ,Will Input a fully connected layer and output the probability of at least one of the following categories: defect, crack, porosity, and inclusion. ; A regression branch for the geometric parameters of the defect region is set up to directly regress the alignment domain coordinates along the weld centerline to the true values of the defect geometric parameters. The regression branch aims to learn the defect parameters in the alignment domain, and its supervision signal is calculated using the following formula: ; in, Indicates the position of the defect center within the alignment domain. Indicates the length of the defect along the weld direction. Indicates the width of the defect perpendicular to the weld. Indicates the defect direction angle. For confidence level, For category prediction; The operation of the regression branch includes: processing multi-scale defect features from the backbone network that have curvature adaptation and orientation consistency. 3×3 convolution is performed to enhance local spatial correlation and extract defect morphology and texture, resulting in an enhanced intermediate feature map. ,right A 1×1 convolution is performed to achieve channel compression and directly regress geometric parameters. The regression yields the predicted values of the alignment domain defect parameters. The region regression loss By calculating the predicted value Compared with the true value The differences between them are obtained; The model is trained using a joint loss function, the formula for which the joint loss function is calculated is as follows: ; in, Indicates the overall joint loss; Indicates classification loss; For regional regression loss; Represents the log-variance of the classification task; Represents the log-variance of the regression task; Represents the uncertainty regularization term; For classification loss, cross-entropy loss is used, and the calculation formula is as follows: ; Where K is the number of defect categories, Encoding for the true category, The probability of the k-th class predicted by the model; For the regional regression loss, the spatial parameters of the regression defect using Smooth L1 loss are calculated using the following formula: ; Where N is the number of valid samples, and These are the predicted and actual regional parameters, respectively.
[0015] Furthermore, the defect prediction results are restored to the original image coordinate system using the inverse transformation of the weld seam domain alignment mapping. A non-maximum suppression algorithm for weld seam orientation clustering is then used to cluster and remove redundancy from the candidate boxes, outputting the defect category, location, and shape information. The specific process includes: Centerline domain alignment mapping is ,in Represents the coordinates of the original image. To determine the alignment domain coordinates along the weld centerline, the coordinates are... The formula for mapping back to the original coordinate system is: ,in This is achieved by finding the centerline parameters and normal direction vectors, including the local curvature, and combining them with bilinear interpolation, to ensure that the coordinates are consistent with the actual geometry of the weld when restoring the coordinates. Defect length predicted by the regression head in the aligned domain coordinate system ,Width Along the tangential direction of the weld respectively with normal direction The formula for calculating the recovery is: , ,in This represents the tangential unit vector obtained by the difference between adjacent points on the centerline. This represents the normal unit vector obtained by rotating the tangential vector counterclockwise by 90°. The formula for calculating the orientation angle of each candidate defect is: ,in, The tangential vector component represents the weld location where the defect center point is located. Indicates the principal direction angle of the defect; Clustering is performed based on directional similarity, and the calculation formula is as follows: ,in, This represents the set of candidate defects that are consistent in the k-th direction. Indicates the average orientation angle within the cluster. This represents the orientation angle threshold, with a value ranging from 5° to 15°. For any two candidate boxes within the same directional cluster group and , along the tangential direction of the weld The formula for calculating the overlap ratio along the weld direction by performing a one-dimensional projection is as follows: ,in This represents the length of the projection overlap between the two candidate boxes in the tangential direction. and These are the lengths of the two along the weld direction, when , The value range is 0.5–0.7. If the above formula is satisfied, then it is determined that... and For structures belonging to the same continuous defect structure, prediction results with higher confidence levels are retained; The final output of structured defect information is as follows: ,in This represents the index variable, indicating the predictions obtained from the network. Enumerate the candidate defects. Indicates the defect category, Indicates the confidence level of the defect. Indicates the parameters of the defect bounding box. Indicates the direction angle of the candidate defect.
[0016] The present invention has the following beneficial effects: This invention provides an intelligent X-ray weld defect detection method based on weld line sensing and reversible domain mapping. Utilizing an innovative weld line sensing hybrid network architecture, it explicitly models the physical structure and spatial distribution priors of the weld through mechanisms such as frequency domain enhancement, weld geometry alignment, and curvature adaptive attention. This effectively overcomes the detection challenges of weak texture and small-sized defects under curved weld conditions, significantly improving the recognition accuracy and positioning precision of typical defects such as porosity and cracks, and achieving automated and highly reliable non-destructive testing of welds. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the intelligent X-ray weld defect detection method based on weld line sensing and reversible domain mapping proposed in this invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0019] Although the steps in this invention are arranged by reference numerals, this is not intended to limit the order of the steps. Unless the order of the steps is explicitly stated or the execution of a step requires other steps as a basis, the relative order of the steps can be adjusted. It is understood that the term "and / or" as used herein refers to and covers any and all possible combinations of one or more of the associated listed items.
[0020] This invention acquires grayscale X-ray images of the weld area and jointly annotates the weld centerline trajectory and defect mask to construct a standardized training dataset with geometric semantic constraints. A hybrid neural network architecture for weld line perception, incorporating frequency band reweighting enhancement, weld centerline domain alignment, orientation-aware deformable pyramids, and curvature-gated cross-scale attention, is designed to explicitly construct a nonlinear mapping relationship between the original weld image and multi-scale semantic features of defects. The network is trained end-to-end using a joint loss function composed of detection task loss and centerline consistency constraints, achieving collaborative optimization of defect category discrimination and spatial localization. The trained model is deployed in an automatic welding quality detection system, performing forward inference on real-time acquired X-ray images and combining a post-processing strategy of weld orientation clustering to continuously output defect detection results with accurate category, location, and morphological information. This invention achieves stable and accurate identification of slender, weakly textured weld defects under curved weld conditions, significantly improving the automation and reliability of weld non-destructive testing.
[0021] like Figure 1 As shown, the present invention proposes an intelligent X-ray weld defect detection method based on weld line sensing and reversible domain mapping, which specifically includes the following steps: A standardized dataset with geometric semantic constraints was constructed. Grayscale X-ray images of the weld area were collected, and the weld area was cropped and grayscale normalized preprocessed. Weld defect instances and weld centerline trajectories were jointly labeled. As a preferred embodiment, the specific process of acquiring grayscale X-ray images of the weld area and performing weld area cropping and grayscale normalization preprocessing includes: image acquisition and weld area cropping: acquiring the original grayscale X-ray image of the weld area using industrial X-ray flaw detection equipment, and performing coarse cropping on the weld area to reduce background interference and invalid areas; grayscale normalization and imaging quality enhancement: performing histogram equalization or gamma correction on the cropped image to normalize the grayscale values to the [0,1] range, thereby enhancing the contrast between the weld and defect areas.
[0022] As a preferred implementation, the specific process of jointly labeling weld defect instances and weld centerline trajectories includes: constructing a training label dataset: processing cropped weld images... The centerline trajectory of the weld is marked using multi-segment polyline or spline fitting. And to obtain a defect semantic mask by performing instance-level mask annotation on the weld defect area. In this context, a pixel value of 0 indicates no defects. To represent different defect types, we obtain N training sample sets containing images, centerline trajectories, and defect masks. .
[0023] In this implementation, a unified preprocessing workflow (pruning, normalization) ensures the consistency of training data and improves the model's generalization ability; through and The joint annotation allows the model to learn both weld structure and defect features simultaneously, avoiding the problem of traditional models "ignoring weld geometry and misjudging defects in bending areas"; it provides comprehensive supervision for the later model to learn weld structure and defect features, and is the core data foundation for the invention to achieve high-precision detection of bending weld defects.
[0024] A hybrid backbone network for weld line perception is constructed: the image is transformed to the weld-aligned coordinate domain by sequentially passing through a frequency band reweighting enhancement module, a weld line-guided coordinate transformation module, a direction-aware deformable pyramid module, and a curvature-gated cross-scale attention module, and extracting multi-scale defect features that have curvature adaptation and direction consistency with the physical structure of the weld. As a preferred embodiment, the frequency band reweighting enhancement module specifically includes: Local frequency domain transformation: transforming the preprocessed X-ray weld image The image is divided into K×K local blocks in a non-overlapping manner, with dimensions H×W, where H is the image height, W is the image width, and K is the side length of the local block. There are a total of B blocks. The b-th block is denoted as: Perform a two-dimensional discrete cosine transform (2D-DCT) on each block to obtain the corresponding local spectrum. This includes the low-frequency region representing the overall brightness trend of the image, the mid-frequency region describing weld texture, edge details, and local structural changes, and the high-frequency region containing noise, scan patterns, and grid line artifacts. Frequency band partitioning and learnable frequency band weights: Generate adaptive weights for learnable frequency bands using a lightweight gating network. The calculation formula is as follows: ; in, This represents a lightweight network consisting of two fully connected layers and ReLU, used to adaptively generate frequency band weights based on block content. This is represented as a Sigmoid activation, with output control weights of 0–1. These correspond to the degree of suppression / enhancement of low-frequency, mid-frequency, and high-frequency components, respectively. To preserve the overall structure in low frequencies, enhance texture in mid frequencies, and suppress noise in high frequencies, each frequency component is weighted according to its weight, resulting in a reweighted spectrum. , where the symbol This indicates element-wise multiplication; Then, the inverse two-dimensional discrete cosine transform (iDCT) is invoked to map the adjusted frequency domain representation back to the pixel domain: ; in, This represents the two-dimensional discrete cosine inverse transform, which restores the frequency domain to the pixel domain. This operation preserves low frequencies to maintain overall structural integrity; enhances mid-frequency frequencies to improve weld texture and highlight defect edges; and suppresses high frequencies to eliminate noise, scan lines, and grid artifacts.
[0025] Finally, all reconstructed blocks were stitched back to the original image, and the enhanced weld image was reconstructed from all reconstructed blocks in their original positions. The calculation formula is: ; in, The enhanced weld image is characterized by a clearer weld outline, enhanced contrast of small defects, and significantly reduced noise and artifacts, providing a more reliable input for subsequent weld line alignment and defect detection. This indicates a block stitching operation, which involves rearranging and stitching all processed local image blocks back to their original spatial layout according to their block position index in the original image, thereby obtaining a complete enhanced image.
[0026] In this embodiment, X-ray weld images typically contain low-frequency scattering haze artifacts (such as brightness drift caused by uneven thickness) and high-frequency periodic stripe artifacts (such as detector grid lines and scanning noise). These artifacts can obscure weld texture details and weaken the discernibility of small-sized defects (such as porosity and slag inclusions). Therefore, this step constructs a frequency band reweighting enhancement module based on image frequency domain statistical decomposition and a learnable frequency band reweighting mechanism to improve the input image quality and provide a more stable texture representation for subsequent modules.
[0027] In a preferred embodiment, the weld line guiding coordinate transformation module specifically includes: Design a weld centerline feature sensing network to enhance the frequency domain of the weld image. As input, through shallow convolutional feature extraction, residual feature enhancement, and channel attention fusion, a lightweight centerline perception model that is sensitive to weak weld texture is formed. The overall structure of WCF-Net can be represented as follows: ; in, This represents the weld image after frequency domain enhancement. This represents a centerline enhancement feature map; The shallow convolutional feature extraction module consists of two convolutional layers, specifically designed to capture the primary visual features of the weld seam image. The first layer uses a large 7×7 convolutional kernel to expand the receptive field and capture the macroscopic direction of the weld seam; the second layer uses a 3×3 convolutional kernel for detail enhancement. The residual feature enhancement module contains three residual blocks, each employing a standard "convolution-normalization-activation-convolution-normalization" structure, with skip connections directly adding the input to the output. This design effectively alleviates the gradient vanishing problem in deep networks while enhancing the texture difference between the weld seam and the background. The channel attention fusion module is used to highlight structural features related to the weld seam line, suppress irrelevant background textures, and obtain the centerline enhanced feature map R. The output R is then processed by the Skeleton algorithm, a differentiable thin-line extraction algorithm based on the response map, to obtain the coordinate sequence C of the weld centerline with a single pixel width. The calculation formula is as follows: ; in, The algorithm iteratively erodes the boundary pixels of the binary image, retains the centerline pixels that meet specific conditions, and finally obtains a single-pixel width weld centerline coordinate sequence. The extracted coordinate points are topologically sorted according to the weld direction to form a continuous centerline trajectory. The centerline coordinate sequence C is obtained by subtracting the coordinate differences of adjacent points to obtain the weld direction vector. and normal vector Local directional basis matrix ; in , This represents the pixel coordinates of the weld centerline; the perpendicular direction of the direction vector is the normal vector.
[0028] Original image coordinates Mapped to the alignment domain coordinates along the weld centerline direction The calculation formula is: ,in, Indicates the pixel coordinates of the weld centerline. Indicates the position along the weld direction. This indicates the offset perpendicular to the weld direction; in this way, the curved weld is "straightened," and the network can stably observe changes in defect texture. Using a differentiable grid sampling function Obtain weld alignment area image ; Finally, align the weld seam to the image. The input is a Transformer backbone network, which consists of multiple stacked encoders. Each encoder is responsible for performing a global feature association and channel representation enhancement in the weld alignment domain, thereby extracting high-level semantic information such as defect morphology, texture, density gradient, and distribution along the weld direction layer by layer, resulting in a high-level semantic feature map after alignment with the weld centerline domain. .
[0029] In this embodiment, weld defects are often distributed along the weld centerline. When the weld is inclined or curved, the observation range of ordinary convolution and attention is fixed and cannot follow the weld direction, so it is easy to miss the defects. Therefore, a weld line-guided coordinate transformation module is constructed to transform the image to an aligned coordinate domain centered on the weld, so that the network always understands the features from the "view along the weld line".
[0030] As a preferred embodiment, the orientation-aware deformable pyramid module specifically includes: High-level semantic feature map after alignment with the weld centerline region Inputting the multi-scale feature pyramid DMFP-Net, composed of downsampling layers, yields multi-layer features ranging from high to low resolution. The calculation formula is as follows: ;in, Indicates the first Layer feature map, To indicate high-resolution details, Representing medium-resolution semantic structure, FPN represents the feature pyramid structure, indicating low-resolution details. To enable feature sampling to adaptively expand along the weld direction and normal, at each scale feature map The orientation-aware deformable convolution DA-DCN is introduced above, and the sampling position offset of the deformable convolution is... Local directional field of weld With normal field Joint prediction, the migration field is calculated as follows ,in, This indicates a learnable convolutional kernel. Indicates feature concatenation operation; Subsequently, directional guided feature sampling is performed to focus the features on the continuous defect texture along the weld structure direction, rather than the pixel neighborhood affected by the weld curvature, resulting in directionally aligned multi-scale features: ;in, Indicates the convolution kernel weights. Indicates the sampling location; To enhance semantic consistency across scales, the multi-scale features after orientation alignment at each layer are... Perform cross-scale fusion to obtain the fused same-scale feature representation: ,in, This indicates bilinear interpolation upsampling. This represents a downsampling convolution with a stride of 2; Finally, DMFP-Net outputs a fused multi-scale feature pyramid set: This set will serve as the input for the next step, the curvature-gated cross-scale attention module.
[0031] In this embodiment, the weld seam alignment area image In this model, defects such as weld texture, pores, and slag inclusions exhibit significant characteristics of multi-scale, irregular shapes, and blurred boundaries. To enhance the model's ability to represent uncertain deformations, this step constructs a direction-aware deformable pyramid module (DMFP-Net) to achieve cross-scale feature capture and deformation alignment.
[0032] As a preferred embodiment, the curvature-gated cross-scale attention module specifically includes: Based on the difference in coordinates between adjacent points Calculate the local curvature that reflects the degree of weld bending. The calculation formula is: ; in, It represents the local curvature of the weld at position t, reflecting the degree of weld bending; according to Dynamically adjust the curvature-adaptive attention window length The calculation formula is: ;in, Indicates the basic attention window length. This represents the adjustment factor used to control the sensitivity of the attention window to changes in weld curvature: the straighter the weld, the better. The smaller the window, the longer it is, thus capturing long cracks; the more curved the weld, The larger the weld bead, the shorter the window becomes; this prevents a long, thin defect that is originally continuous from being mistakenly cut into several segments due to weld bends, thus avoiding misidentification as multiple small defects. The curvature-adaptive attention window length is obtained. Then, the attention window needs to be moved along the weld direction and rotated to align with the weld direction in order to achieve continuous modeling of elongated defects and regions with abrupt changes in thickness. Using weld tangential vector and normal vector Constructed directional basis matrix Rotate the attention window to align with the weld seam orientation: merging the multi-scale feature pyramid set. As input, where Semantic modeling for elongated cracks and regions with abrupt changes in thickness. Used to provide a global structural reference.
[0033] The semantic feature map of each layer after alignment with the weld centerline domain is obtained by using the differentiable grid sampling function GridSample. The direction domain mapping and resampling are calculated using the following formula: ; in, This indicates the feature map after the direction domain mapping in coordinates. eigenvalues at that location Indicates the pixel coordinates of the weld centerline. Indicates the position along the weld direction. Indicates the offset perpendicular to the weld direction; This indicates the same-scale features after fusion; this operation makes the attention receptive field no longer fixed as a square, but dynamically rotates with the weld direction; Subsequently, the high-level semantic feature map after alignment with the weld centerline domain was processed. Perform a linear transformation; the calculation formula is as follows: ; in, Represents a learnable linear transformation matrix. These represent the query, key, and value vectors, respectively, and d represents the feature dimension. Then, based on the scaling dot product attention mechanism, self-attention weights are calculated and features are aggregated to obtain orientation consistency perception features considering weld curvature. The calculation formula is: ; ; in, This represents the spatiotemporal adaptive attention matrix; The directional consistency perception feature will take into account the weld curvature. High-level semantic feature map aligned with the weld centerline region Based on the features at the corresponding scale, multi-scale defect features with curvature adaptation and orientation consistency are obtained. .
[0034] In this embodiment, the output multi-scale feature pyramid is used as the basis. As input, each layer of feature map undergoes directional domain mapping and resampling. Among these steps... Primarily used for semantic modeling of elongated cracks and regions with abrupt changes in thickness, specifically... For high-resolution detail layers, it captures minute texture changes on the weld surface (such as crack tips and pore edges), and provides fine feature support for areas with abrupt changes in thickness; and The medium-resolution semantic layer extracts the morphological structure and semantic information of defects (such as the continuous distribution of elongated cracks and the regional contour of slag inclusions), which is the core of elongated defect modeling. For the low-resolution global layer, it provides contextual information about the overall weld structure (such as weld orientation and global background interference) to avoid misjudgment of local features and calibrate the global consistency of detection results. Through multi-scale feature division and directional allocation, weld geometry prior guidance, and addressing the technical pain points of traditional weld defect detection models that ignore the physical structure of the weld and the inconsistency between feature extraction and defect distribution, its essence is to align the multi-scale feature pyramid with the weld tangential direction. weld normal direction Local curvature By integrating physical priors and through orientation domain mapping and resampling, the feature extraction process explicitly adapts to the spatial orientation and curvature of the weld, providing a precise input basis for subsequent curvature adaptive attention aggregation; thus significantly improving the automation and reliability of weld nondestructive testing.
[0035] In summary, this network architecture aims to extract multi-scale features of defects in the weld alignment coordinate domain (i.e., the image domain after straightening a curved weld) through frequency domain enhancement, weld centerline alignment, multi-scale feature extraction, and curvature adaptive attention. The overall process is as follows: Input is a preprocessed grayscale X-ray image. Output is multi-scale features with weld line perception and reversible domain mapping, used for subsequent defect detection and segmentation. This network employs an encoder structure, enhancing its ability to perceive weakly textured weld lines through multi-level feature extraction and attention mechanisms.
[0036] Design a multi-task joint optimization strategy: Construct a joint loss function that integrates classification loss and region regression loss, and introduce logarithmic variance uncertainty modeling to achieve adaptive weighting of loss and automatic calibration of detection confidence; The weld defect detection task has the characteristics of "multi-form, small scale, and distribution along the weld line". In order to balance pixel-level positioning accuracy and semantic classification consistency, this embodiment designs a dual output head: a defect semantic segmentation head and a defect type discrimination head.
[0037] As a preferred implementation method, the multi-task joint optimization strategy specifically includes the following process: First, the dual-branch output head design: (1) Defect classification branch: A defect classification branch is set up to determine whether there are defects in the weld and the type of defects. The operation of the classification branch includes: processing multi-scale defect features with curvature adaptation and direction consistency from the backbone network. The feature map is obtained by performing a 1×1 convolution. This is used to compress channel dimensions and aggregate semantic information. The calculation formula is as follows: ; right Global average pooling is used to obtain a single feature vector. ; Will Input a fully connected layer and output the probability of at least one of the following categories: defect, crack, porosity, and inclusion. ,in, Represents the classification weight matrix. The classification bias vectors are all learned automatically during model training. This represents a multi-class normalization function used to convert a linear output into a class probability distribution; (2) Defect region geometric parameter regression branch: used to predict the precise spatial location and geometric dimensions of defects in the weld alignment domain. To maintain spatial resolution and ensure that the features can cover the continuous texture information in the weld direction, this embodiment adopts a two-stage structure of local feature enhancement and geometric parameter regression.
[0038] Alignment domain coordinates along the weld centerline direction Direct regression of the true values of defect geometric parameters The regression branch aims to learn the defect parameters in the alignment domain, and its supervision signal is calculated using the following formula: ; in, Indicates the position of the defect center within the alignment domain. Indicates the length of the defect along the weld direction (alignment area scale). Indicates the width of the defect in the direction perpendicular to the weld (alignment area scale). Indicates the defect orientation angle (compensating for minor tilt angles). For confidence level, For category prediction; The operation of the regression branch includes: processing multi-scale defect features from the backbone network that have curvature adaptation and orientation consistency. 3×3 convolution is performed to enhance local spatial correlation and extract defect morphology and texture, resulting in an enhanced intermediate feature map. ,right A 1×1 convolution is performed to achieve channel compression and directly regress geometric parameters. The regression yields the predicted values of the alignment domain defect parameters. The region regression loss By calculating the predicted value Compared with the true value The differences between them are obtained; Next, we design a joint loss function based on log-variance uncertainty.
[0039] Specifically, the model obtains the defect category prediction results at the output. Defect region parameter prediction results .in, This represents the probability distribution of belonging to each defect category. The spatial parameters representing the defect area (such as center position, length, width, or bounding box coordinates) are respectively labeled as category label p and region actual parameter b.
[0040] Since there is a strong coupling between category determination and region localization, if the category prediction is inaccurate, the region regression is meaningless; if the region localization is inaccurate, the classification confidence will decrease. To more effectively balance the learning process of these two tasks, this embodiment abandons the traditional method of manually adjusting the fixed loss weights and introduces an adaptive weighted joint loss function based on log-variance uncertainty. (1) Define the trainable uncertainty parameter. Let be the classification loss. and regional regression loss Trainable log-variance parameters are introduced, with an initial value of 0 and an initial variance of 1.
[0041] ; Among them, the variance of the classification task The logarithm of is used as a trainable parameter, named The variance of the regression task The logarithm is also used as a trainable parameter, named .
[0042] (2) Construct an adaptive weighted joint loss function. An automatic weighted joint loss function based on the learned variance is adopted, and its calculation formula is as follows: ; in, Indicates the overall joint loss; Indicates classification loss; For regional regression loss; Represents the log-variance of the classification task; Represents the log-variance of the regression task; The adaptive weights represent the classification loss, which are used when the classification task has uncertainty. When the weight increases, the weight decreases accordingly, thereby reducing the contribution of the classification task to the total loss and preventing the high-uncertainty task from dominating the training. The adaptive weights representing the regression loss function the same way as the classification weights: regression uncertainty. Increasing the weight decreases the weight. This allows the model to automatically balance its importance with the classification task based on the difficulty and reliability of the regression task; This represents the uncertainty regularization term; without it, the model might increase indefinitely. To drive the loss weights close to zero, thereby "escaping" the real task ( and ( ) learning.
[0043] (3) Define the loss function For classification loss, used to determine the presence and type of defects, cross-entropy loss is employed, and the calculation formula is as follows: ; Where K is the number of defect categories, Encoding for the true category, This represents the probability of the k-th class predicted by the model.
[0044] To accurately predict the location and shape of defects in the weld, the region regression loss is used. The Smooth L1 loss is employed to regress the spatial parameters of the defects, and the calculation formula is as follows: ; Where N is the number of valid samples, and These are the predicted and actual regional parameters, respectively; This loss is used to reduce the impact of outliers on training, making the training process more stable. It helps the model learn the continuous distribution characteristics of defects along the weld direction, effectively improving positioning accuracy.
[0045] During the inference phase, the learned uncertainty is used to assess the confidence level of the model's original predictions. Calibration is performed to make it closer to the true accuracy; the calculation formula is as follows: ; in, This represents the calibrated confidence level. The learned classification uncertainty is introduced. (i.e., variance), which is the original, often overly optimistic, prediction probability. A smoothing process is performed. This calibration process effectively reduces the occurrence of high-confidence false positives, making the confidence score output by the model more consistent with its localization and classification accuracy in practical applications, thereby significantly improving the reliability of the entire detection system.
[0046] This embodiment achieves deep collaboration between the classification and localization branches through the aforementioned joint training strategy: the classification branch enhances its ability to discriminate defect semantics by leveraging the geometric context provided by the localization branch; while the localization branch, guided by the classification features, improves the accuracy of shape and position estimation. This end-to-end collaborative optimization mechanism effectively suppresses the missed detection of small-scale cracks and the false detection of non-defect textures, thereby significantly improving the overall reliability of weld defect identification.
[0047] The defect prediction results are restored to the original image coordinate system by using the inverse transformation of the weld seam domain alignment mapping. The non-maximum suppression algorithm of weld seam direction clustering is used to cluster and remove redundancy from the candidate boxes, and the category, location and shape information of the defects are output. As a preferred embodiment, the centerline domain alignment mapping is as follows: ,in Represents the coordinates of the original image. To determine the alignment domain coordinates along the weld centerline, the coordinates are... The formula for mapping back to the original coordinate system is: ,in This is achieved by finding the centerline parameters and normal direction vectors, including the local curvature, and combining them with bilinear interpolation, to ensure that the coordinates are consistent with the actual geometry of the weld when restoring the coordinates. Defect length predicted by the regression head in the aligned domain coordinate system ,Width Along the tangential direction of the weld respectively with normal direction The formula for calculating the recovery is: , ,in This represents the tangential unit vector obtained by the difference between adjacent points on the centerline. This represents the normal unit vector obtained by rotating the tangential vector counterclockwise by 90°; this step ensures that the restored size of the defect is consistent with the weld direction, avoiding morphological distortion caused by weld bending; Weld defects typically present as linear structures extending along the weld direction. The formula for calculating the direction angle of each candidate defect is as follows: ,in, The tangential vector component represents the weld location where the defect center point is located. Indicates the principal direction angle of the defect; Clustering is performed based on directional similarity, and the calculation formula is as follows: ,in, This represents the set of candidate defects that are consistent in the k-th direction. Indicates the average orientation angle within the cluster. This represents the orientation angle threshold, with a value ranging from 5° to 15°. Redundancy suppression of candidate defect regions is determined based on the projection overlap relationship along the weld tangential direction. Specifically, for any two candidate boxes within the same directional cluster group... and , along the tangential direction of the weld The formula for calculating the overlap ratio along the weld direction by performing a one-dimensional projection is as follows: ,in This represents the length of the projection overlap between the two candidate boxes in the tangential direction. and These are the lengths of the two along the weld direction, when , The value range is 0.5–0.7. If the above formula is satisfied, then it is determined that... and For structures belonging to the same continuous defect structure, prediction results with higher confidence levels are retained; The final output of structured defect information is as follows: ,in This represents the index variable, indicating the predictions obtained from the network. Enumerate the candidate defects. Indicates the type of defect (such as porosity, cracks, inclusions, etc.). Indicates the confidence level of the defect. This represents the parameters of the defect bounding box (center coordinates, width, height, and orientation angle). This indicates the orientation angle of the candidate defect. This result can be directly used for weld quality grade assessment and automatic closed-loop adjustment of welding process parameters.
[0048] In summary, the construction and training of an intelligent X-ray weld defect detection network based on weld line perception and reversible domain mapping has been achieved. This invention improves upon traditional convolutional neural networks by utilizing an innovative hybrid neural network architecture, including frequency band reweighting enhancement, weld centerline domain alignment, direction-aware deformable pyramids, and curvature-gated cross-scale attention. This enables the model to explicitly utilize the weld's geometric structure and physical priors, achieving stable and accurate identification of weak-texture and small-sized defects in curved welds.
[0049] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0050] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for intelligent detection of X-ray weld defects based on weld line sensing and reversible domain mapping, characterized in that, Includes the following steps: A standardized dataset with geometric semantic constraints was constructed. Grayscale X-ray images of the weld area were collected, and the weld area was cropped and grayscale normalized preprocessed. Weld defect instances and weld centerline trajectories were jointly labeled. A hybrid backbone network for weld line perception is constructed: the image is transformed to the weld-aligned coordinate domain by sequentially passing through a frequency band reweighting enhancement module, a weld line-guided coordinate transformation module, a direction-aware deformable pyramid module, and a curvature-gated cross-scale attention module, and extracting multi-scale defect features that have curvature adaptation and direction consistency with the physical structure of the weld. Design a multi-task joint optimization strategy: Construct a joint loss function that integrates classification loss and region regression loss, and introduce log-variance uncertainty modeling to achieve adaptive weighting of loss and automatic calibration of detection confidence; The defect prediction results are restored to the original image coordinate system by using the inverse transformation of the weld seam domain alignment mapping. The non-maximum suppression algorithm of weld seam direction clustering is used to cluster and remove redundancy from the candidate boxes, and the category, location and shape information of the defects are output.
2. The intelligent detection method for X-ray weld defects based on weld line sensing and reversible domain mapping according to claim 1, characterized in that: The specific process of acquiring grayscale X-ray images of the weld area and performing weld area cropping and grayscale normalization preprocessing includes: Image acquisition and weld area cropping: The original grayscale X-ray image of the weld area is acquired using industrial X-ray flaw detection equipment, and the weld area is coarsely located and cropped to reduce background interference and invalid areas; Gray-level normalization and image quality enhancement: Histogram equalization or gamma correction is performed on the cropped image to normalize the gray-level values to the [0,1] range, thereby enhancing the contrast between the weld and defect areas.
3. The intelligent detection method for X-ray weld defects based on weld line sensing and reversible domain mapping according to claim 2, characterized in that: The specific process of jointly annotating weld defect examples and weld centerline trajectories includes: Constructing a training label dataset: cropped weld seam images The centerline trajectory of the weld is marked using multi-segment polyline or spline fitting. And to obtain a defect semantic mask by performing instance-level mask annotation on the weld defect area. In this context, a pixel value of 0 indicates no defects. To represent different defect types, we obtain N training sample sets containing images, centerline trajectories, and defect masks. .
4. The intelligent detection method for X-ray weld defects based on weld line sensing and reversible domain mapping according to claim 1, characterized in that: The frequency band reweighting enhancement module specifically includes: Preprocessed X-ray weld image The image is divided into K×K local blocks in a non-overlapping manner, with dimensions H×W, where H is the image height, W is the image width, and K is the side length of the local block. There are a total of B blocks. The b-th block is denoted as: Perform a two-dimensional discrete cosine transform (2D-DCT) on each block to obtain the corresponding local spectrum. This includes the low-frequency region representing the overall brightness trend of the image, the mid-frequency region describing weld texture, edge details, and local structural changes, and the high-frequency region containing noise, scan patterns, and grid line artifacts. Adaptive weights for learning frequency bands are generated using a lightweight gating network. Each frequency component is weighted according to its own weight, and low-frequency components are preserved, mid-frequency components are enhanced, and high-frequency components are suppressed to obtain the reweighted spectrum. ; Mapping the adjusted frequency domain representation back to the pixel domain: The adjusted frequency domain representation is mapped back to the pixel domain using the inverse two-dimensional discrete cosine transform (iDCT). Reconstruct the image patches and stitch them back to the original image to obtain the enhanced weld image. ,in , ,symbol This indicates element-wise multiplication. This indicates a block concatenation operation.
5. The intelligent X-ray weld defect detection method based on weld line sensing and reversible domain mapping according to claim 4, characterized in that: The weld line guide coordinate transformation module specifically includes: Design a weld centerline feature sensing network to enhance the frequency domain of the weld image. As input, features are extracted through shallow convolution, enhanced residual features, and fused through channel attention. The shallow convolution uses a 7×7 kernel in the first layer and a 3×3 kernel in the second layer for feature extraction. The residual feature enhancement includes three residual blocks, each of which uses a standard convolution, normalization, activation, convolution, normalization structure. The input is directly added to the output through skip connections. The channel attention fusion module is used to highlight structural features related to the weld line and suppress irrelevant background textures to obtain the centerline enhanced feature map R. The output R is then processed by the Skeleton algorithm, a differentiable thin line extraction algorithm based on the response map, to obtain a single-pixel width weld centerline coordinate sequence C. The extracted coordinate points are topologically sorted according to the weld direction to form a continuous centerline trajectory. The centerline coordinate sequence C is obtained by subtracting the coordinate differences of adjacent points to obtain the weld direction vector. and normal vector Local directional basis matrix ; Original image coordinates Mapped to the alignment domain coordinates along the weld centerline direction The calculation formula is: ,in, Indicates the pixel coordinates of the weld centerline. Indicates the position along the weld direction. Indicates the offset perpendicular to the weld direction; Using a differentiable grid sampling function Obtain weld alignment area image ; Finally, align the weld seam to the image. The input is a Transformer backbone network, which consists of multiple stacked encoders. Each encoder is responsible for performing a global feature association and channel representation enhancement in the weld alignment domain, thereby extracting high-level semantic information such as defect morphology, texture, density gradient, and distribution along the weld direction layer by layer, resulting in a high-level semantic feature map after alignment with the weld centerline domain. .
6. The intelligent detection method for X-ray weld defects based on weld line sensing and reversible domain mapping according to claim 5, characterized in that: The orientation-aware deformable pyramid module specifically includes: High-level semantic feature map after alignment with the weld centerline region Inputting the multi-scale feature pyramid DMFP-Net, composed of downsampling layers, yields multi-layer features ranging from high to low resolution. The calculation formula is as follows: ;in, Indicates the first Layer feature map, To indicate high-resolution details, Representing medium-resolution semantic structure, FPN represents the feature pyramid structure, indicating low-resolution details. Feature maps at each scale The orientation-aware deformable convolution DA-DCN is introduced above, and the sampling position offset of the deformable convolution is... Local directional field of weld With normal field Joint prediction, the migration field is calculated as follows ,in, This indicates a learnable convolutional kernel. Indicates feature concatenation operation; Subsequently, directional guided feature sampling is performed to focus the features on the continuous defect texture along the weld structure direction, rather than the pixel neighborhood affected by the weld curvature, resulting in directionally aligned multi-scale features: ;in, Indicates the convolution kernel weights. Indicates the sampling location; To enhance semantic consistency across scales, the multi-scale features after orientation alignment at each layer are... Perform cross-scale fusion to obtain the fused same-scale feature representation: ,in, This indicates bilinear interpolation upsampling. This represents a downsampling convolution with a stride of 2; Finally, DMFP-Net outputs a fused multi-scale feature pyramid set: This set will serve as the input for the next step, the curvature-gated cross-scale attention module.
7. The intelligent detection method for X-ray weld defects based on weld line sensing and reversible domain mapping according to claim 6, characterized in that: The curvature-gated cross-scale attention module specifically includes: Calculate the local curvature reflecting the degree of weld bending based on the coordinate difference between adjacent points. ,according to Dynamically adjust the curvature-adaptive attention window length The calculation formula is: ;in, Indicates the basic attention window length. This represents the adjustment factor used to control the sensitivity of the attention window to changes in weld curvature: the straighter the weld, the better. The smaller the window, the longer it is, thus capturing long cracks; the more curved the weld, The larger the window, the shorter it becomes; Using weld tangential vector and normal vector Constructed directional basis matrix Rotate the attention window to align with the weld seam orientation: merging the multi-scale feature pyramid set. As input, where Semantic modeling for elongated cracks and regions with abrupt changes in thickness. Used to provide a global structural reference, the high-level semantic feature map of each layer is aligned with the weld centerline domain through the differentiable grid sampling function GridSample. The direction domain mapping and resampling are calculated using the following formula: ; in This indicates the feature map after the direction domain mapping in coordinates. eigenvalues at that location Indicates the pixel coordinates of the weld centerline. Indicates the position along the weld direction. Indicates the offset perpendicular to the weld direction; High-level semantic feature map after alignment with weld centerline region A linear transformation is performed, followed by the calculation of self-attention weights based on a scaled dot product attention mechanism and feature aggregation to obtain orientation consistency perception features that take into account weld curvature. ,in These represent the query, key, and value vectors, respectively, with d representing the feature dimension. This represents the spatiotemporal adaptive attention matrix; The directional consistency perception feature will take into account the weld curvature. High-level semantic feature map aligned with the weld centerline region Based on the features at the corresponding scale, multi-scale defect features with curvature adaptation and orientation consistency are obtained. .
8. The intelligent detection method for X-ray weld defects based on weld line sensing and reversible domain mapping according to claim 1, characterized in that: The specific process of the multi-task joint optimization strategy includes: Setting up a defect classification branch, the operation of which includes: processing multi-scale defect features from the backbone network that have curvature adaptation and orientation consistency. 1×1 convolution is performed to obtain the feature map. This is used to compress channel dimensions and aggregate semantic information; for Global average pooling is used to obtain the feature vector. ,Will Input a fully connected layer and output the probability of at least one of the following categories: defect, crack, porosity, and inclusion. ; A regression branch for the geometric parameters of the defect region is set up to directly regress the alignment domain coordinates along the weld centerline to the true values of the defect geometric parameters. The regression branch aims to learn the defect parameters in the alignment domain, and its supervision signal is calculated using the following formula: ; in, Indicates the position of the defect center within the alignment domain. Indicates the length of the defect along the weld direction. Indicates the width of the defect perpendicular to the weld. Indicates the defect direction angle. For confidence level, For category prediction; The operation of the regression branch includes: processing multi-scale defect features from the backbone network that have curvature adaptation and orientation consistency. 3×3 convolution is performed to enhance local spatial correlation and extract defect morphology and texture, resulting in an enhanced intermediate feature map. ,right A 1×1 convolution is performed to achieve channel compression and directly regress geometric parameters. The regression yields the predicted values of the alignment domain defect parameters. The region regression loss By calculating the predicted value Compared with the true value The differences between them were obtained; The model is trained using a joint loss function, the formula for which the joint loss function is calculated is as follows: ; in, Indicates the overall joint loss; Indicates classification loss; For regional regression loss; Represents the log-variance of the classification task; Represents the log-variance of the regression task; Represents the uncertainty regularization term; For classification loss, cross-entropy loss is used, and the calculation formula is as follows: ; Where K is the number of defect categories, Encoding for the true category, The probability of the k-th class predicted by the model; For the regional regression loss, the spatial parameters of the regression defect using Smooth L1 loss are calculated using the following formula: ; Where N is the number of valid samples, and These are the predicted and actual regional parameters, respectively.
9. The intelligent detection method for X-ray weld defects based on weld line sensing and reversible domain mapping according to claim 1, characterized in that: The defect prediction results are restored to the original image coordinate system using the inverse transformation of the weld seam domain alignment mapping. A non-maximum suppression algorithm based on weld seam direction clustering is then used to cluster and remove redundancy from the candidate boxes, outputting the defect category, location, and shape information. The specific process includes: Centerline domain alignment mapping is ,in Represents the coordinates of the original image. To determine the alignment domain coordinates along the weld centerline, the coordinates are... The formula for mapping back to the original coordinate system is: ,in This is achieved by finding the centerline parameters and normal direction vectors, including the local curvature, and combining them with bilinear interpolation, to ensure that the coordinates are consistent with the actual geometry of the weld when restoring the coordinates. Defect length predicted by the regression head in the aligned domain coordinate system ,Width Along the tangential direction of the weld respectively with normal direction The formula for calculating the recovery is: , ,in This represents the tangential unit vector obtained by the difference between adjacent points on the centerline. This represents the normal unit vector obtained by rotating the tangential vector counterclockwise by 90°. The formula for calculating the orientation angle of each candidate defect is: ,in, The tangential vector component represents the weld location where the defect center point is located. Indicates the principal direction angle of the defect; Clustering is performed based on directional similarity, and the calculation formula is as follows: ,in, This represents the set of candidate defects that are consistent in the k-th direction. Indicates the average orientation angle within the cluster. This represents the orientation angle threshold, with a value ranging from 5° to 15°. For any two candidate boxes within the same directional cluster group and , along the tangential direction of the weld The formula for calculating the overlap ratio along the weld direction by performing a one-dimensional projection is as follows: ,in This represents the length of the projection overlap between the two candidate boxes in the tangential direction. and These are the lengths of the two along the weld direction, when , The value range is 0.5–0.
7. If the above formula is satisfied, then it is determined that... and For structures belonging to the same continuous defect structure, prediction results with higher confidence levels are retained; The final output of structured defect information is as follows: ,in This represents the index variable, indicating the predictions obtained from the network. Enumerate the candidate defects. Indicates the defect category, Indicates the confidence level of the defect. Indicates the parameters of the defect bounding box. Indicates the direction angle of the candidate defect.
Citation Information
Cited By
A method and system for identifying defects in pipeline welds
CN122134731A
A method for automatic identification and defect screening of cylindrical shell welds
CN122199548A
A method for automatic identification and defect screening of cylindrical shell welds
CN122199548B