A welding defect image recognition method based on CT scan images
Patent Information
- Application Number
- CN202610985874.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-03
- Publication Date
- 2026-10-20
AI Technical Summary
[0042]1、本发明通过UNet与注意力门控的条件随机场精炼分割,解决了焊接区域因热影响区灰度重叠和边界模糊导致的误分割问题,一方面,五层编码器逐级提取焊缝轮廓细节与语义区域特征,注意力门控利用解码器语义信息抑制母材背景响应,使分割边界误差较传统阈值法显著缩小;另一方面,全连接条件随机场能约束相邻像素标签一致性,消除概率图中的孤立噪声和边界锯齿,形态学闭运算自动填充焊缝内部因气孔低概率造成的孔洞,三维连通域最大体积筛选滤除母材高密度夹杂物碎片,使后续缺陷候选切片的采样范围精确限定于真实焊缝内部,减少了非焊缝区域的无效计算。
Smart Images

Figure FT_1
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a method for identifying welding defects based on CT scan images. Background Technology
[0002] Image recognition refers to the technology of using computer algorithms to process and analyze images, automatically extract features and identify specific targets or patterns. Existing technologies generally first perform Gaussian filtering to denoise and equalize the CT scan images, then delineate the boundaries of the welding area on two-dimensional slices one by one, then segment and extract suspected defect areas, observe the morphological characteristics of defects such as roundness and aspect ratio for empirical classification, and finally measure the defect size and evaluate the grade according to the standard.
[0003] Existing technologies cannot quantify the confidence level, data-driven classifiers have a high misclassification rate for morphological overlap defects, and lack an expert knowledge integration mechanism. Correction information generated during the classification process cannot be fed back to optimize the feature space or graph structure. Low-confidence misclassifications are directly included in the final report, and the model lacks the ability to self-identify knowledge blind spots for unknown defects. For example, in a weld, three pores of the same type are far apart in space and have large differences in initial features. When graph convolution classifies them independently, one of them is misclassified as tungsten inclusion. In the same weld, a series of pores distributed along the welding direction have the same feature gradient direction and sparse initial graph connections. During the first classification, some nodes have low clarity, triggering fuzz correction. After correction, the graph structure is not updated, and the same problem is easily reproduced in the next inference. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a welding defect image recognition method based on CT scan images. This method solves the technical problems in existing technologies, such as the high misjudgment rate of data-driven classifiers for morphological overlap defects, the inability of correction information generated during the classification process to be fed back to optimize the feature space or graph structure, and the direct inclusion of low-confidence misjudgments in the final report, resulting in inaccurate results.
[0005] To solve the above technical problems, the present invention provides the following technical solution: a welding defect image recognition method based on CT scan images, the method comprising the following steps: acquiring the original CT scan image of the target welding point, and generating a preprocessed image by preprocessing the original CT scan image through noise contrast;
[0006] Multi-scale decoding and stitching are performed on the preprocessed image to generate a coarse segmentation probability map. The coarse segmentation probability map is then encapsulated with a random field mask to obtain the welding area mask.
[0007] Residual features are extracted from the mask of the welding area to obtain a depth feature map. Based on the depth feature map, the defect feature vector is obtained by compression and encapsulation through transfer classification.
[0008] Based on the defect feature vector, the nodes are divided by feature similarity threshold to obtain the set of nodes that need to be corrected and the set of nodes that can be directly passed. Based on the set of nodes that need to be corrected and the set of nodes that can be directly passed, the defuzzification verification label is performed to obtain the verification defect type identification result.
[0009] Based on the results of the defect type identification, morphological defect assessment is performed to generate a defect assessment report.
[0010] The defect assessment report is evaluated and feedback is processed to obtain the model feedback report;
[0011] Among them, the defuzzification verification mark based on the node set to be corrected and directly through the node set includes: defuzzification based on the node set to be corrected and the defect feature vector to obtain the fuzzy inference result;
[0012] Gradient feedback processing is performed based on fuzzy inference results, node-level classification probabilities, and defect relationship graphs to obtain defect type identification results.
[0013] The defect type identification results are verified and blind zone marking is performed to obtain the verified defect type identification results.
[0014] Preferably, noise contrast preprocessing based on the original CT scan image includes: performing noise suppression processing on the original CT scan image to obtain a noise-reduced CT image;
[0015] Enhanced CT images are generated by performing contrast enhancement processing on denoised CT images.
[0016] The enhanced CT images are standardized to obtain preprocessed images.
[0017] Preferably, multi-scale decoding and stitching based on preprocessed images includes: generating multi-scale coded feature maps by performing multi-scale feature processing on the preprocessed images;
[0018] Attention-enhanced skip features are obtained by performing attention gating processing on multi-scale encoded feature maps.
[0019] The attention-enhanced jump features are decoded and concatenated to generate a coarse segmentation probability map.
[0020] Preferably, the coarse segmentation probability map is subjected to random field mask encapsulation processing, including: generating a segmentation refinement probability map by random field iterative inference based on the coarse segmentation probability map and the preprocessed image;
[0021] Morphological optimization is performed based on the segmentation and refinement probability map to obtain a binary mask for the welding area;
[0022] The welding area binary mask is encapsulated to obtain the welding area mask.
[0023] Preferably, residual feature extraction of the welding area mask includes: fine-tuning the welding area mask through a residual network to generate an initial feature extraction network;
[0024] Region slicing enhancement is performed based on the welding area mask and preprocessed image to obtain a defect candidate slice set;
[0025] Deep feature extraction is performed on the defect candidate slice set and the initial feature extraction network to obtain a deep feature map set.
[0026] Preferably, the compression and encapsulation based on the deep feature map set through transfer classification includes: supervised fine-tuning based on the deep feature map set through transfer classification to generate a defect feature vector set;
[0027] The global defect representation is aggregated based on the defect feature vector set to obtain the aggregated defect feature vector;
[0028] The aggregated defect feature vector is compressed and encapsulated to obtain the defect feature vector.
[0029] Preferably, the method of splitting the defect based on the defect feature vector through a feature similarity threshold includes: constructing a defect relationship diagram based on the defect feature vector and the welding area mask through feature similarity.
[0030] Graph convolution processing is performed based on the defect relationship graph to obtain node-level classification probability and classification clarity.
[0031] An adaptive threshold split is applied to the node-level classification probability and classification clarity to obtain the set of nodes that need correction and the set of nodes that can be directly passed.
[0032] Preferably, morphological defect assessment processing is performed based on the verification defect type identification results, including:
[0033] Based on the defect type identification results, morphological measurement processing is used to obtain defect quantification data;
[0034] The severity level is obtained by processing the defect quantification data to obtain the defect severity level;
[0035] Defect severity levels are assessed to generate defect assessment reports.
[0036] Preferably, the defect assessment report undergoes assessment and feedback processing, including:
[0037] Based on the defect assessment report, model performance indicators are obtained through model evaluation and analysis.
[0038] Bayesian hyperparameter processing is performed based on model performance metrics to obtain a set of tuning parameters.
[0039] A feedback report is generated from the optimized parameter set to obtain the model feedback report.
[0040] Preferably, the original CT scan image includes one or more of three-dimensional volume data, slice sequences, and scan metadata.
[0041] By employing the above technical solution, the present invention provides a method for identifying welding defects based on CT scan images, which has at least the following beneficial effects:
[0042] 1. This invention refines the segmentation of the weld area by using UNet and attention-gated conditional random fields, solving the problem of missegmentation caused by gray-scale overlap and boundary blurring in the heat-affected zone. On the one hand, the five-layer encoder extracts the weld contour details and semantic region features step by step, and attention gating uses the semantic information of the decoder to suppress the background response of the parent material, which significantly reduces the segmentation boundary error compared with the traditional thresholding method. On the other hand, the fully connected conditional random field can constrain the consistency of adjacent pixel labels, eliminate isolated noise and boundary jaggedness in the probability map, and the morphological closing operation automatically fills the pores inside the weld caused by the low probability of porosity. The maximum volume screening of the three-dimensional connected domain filters out high-density inclusion fragments in the parent material, so that the sampling range of subsequent defect candidate slices is accurately limited to the inside of the real weld, reducing the invalid calculation of non-weld areas.
[0043] 2. This invention addresses the issues of insufficient discriminative power and intra-class dispersion of welding defect features under small sample conditions by using staged fine-tuning of the pre-trained residual network and joint optimization with center loss. It not only achieves stable convergence of the network with only the fourth-stage high-level semantic features fine-tuned on the basis of pre-trained weights in a large natural image dataset, but also utilizes center loss to cluster similar defect features toward the class center, while maintaining inter-class separation with cross-entropy loss. Max pooling preserves the local salient morphology of defects, and average pooling preserves the global trend. After the two pooling methods are concatenated, they are mapped to a fixed dimension by L2 normalization, which reduces the overlapping area of morphologically similar defects such as pores and tungsten inclusions in the feature space, providing the graph neural network with compact intra-class and dimensionally unified node inputs.
[0044] 3. This invention solves the problems of confusion between similar defect morphologies and the inability to quantify classification confidence by employing a two-layer collaborative judgment method: self-evaluation of classification clarity using graph convolutional networks and knowledge-driven fuzzy inference. On one hand, the graph convolutional network utilizes the spatial location and feature similarity between defects for collaborative inference, while simultaneously outputting category probabilities and classification clarity indices. Fuzzy samples with clarity below a threshold are automatically diverted to the fuzzy inference module for secondary correction. On the other hand, fuzzy inference uses shape features such as roundness and aspect ratio as input, and performs knowledge-driven judgment through Gaussian membership functions. Evidence fusion orthogonally combines the probabilities of data and knowledge in the hypothesis space. Membership gradient feedback updates the graph edge weights, continuously strengthening the spatial connectivity of similar defects. This improves the classification accuracy of low-confidence defects compared to purely data-driven methods. Knowledge blind spot labeling provides key samples for model iteration.
[0045] 4. This invention solves the problems of large random errors in two-dimensional cross-section measurement and subjective inconsistencies in manual grading by automatically classifying defects through three-dimensional connected domain voxel counting and welding quality standard thresholds. It not only performs three-dimensional connected domain analysis on each defect within the welding area mask, obtaining the true volume by multiplying the number of voxels by the physical volume of a single voxel, and using the maximum Euclidean distance between any two points inside as the maximum spatial diameter, thus avoiding dimensional fluctuations in two-dimensional cross-sections caused by different selection positions, but also sets quantitative grading thresholds based on wall thickness for porosity, cracks, lack of fusion, and tungsten inclusions, automatically grading according to unified rules and generating an overall qualified judgment. Color-annotated images intuitively display the spatial distribution of defects, making defect assessments of different batches of weldments comparable, and providing standardized true dimensional values and grading conclusions for subsequent model performance analysis. Attached Figure Description
[0046] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0047] Figure 1 This is a flowchart of a welding defect image recognition method based on CT scan images according to the present invention. Detailed Implementation
[0048] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. This will allow for a full understanding of how the present application uses technical means to solve technical problems and achieve technical effects, and to facilitate its implementation.
[0049] Due to the high misclassification rate of existing data-driven classifiers for morphological overlap defects, and the inability of correction information generated during the classification process to optimize the feature space or graph structure, low-confidence misclassifications directly enter the final report, resulting in inaccurate results, please refer to [the relevant documentation / reference]. Figure 1 This embodiment provides a welding defect image recognition method based on CT scan images, which can reduce the false positive rate of overlapping defects, optimize the correction information, and improve the accuracy of the results. The method includes the following steps:
[0050] S1. Acquire the original CT scan image of the target welding point, and generate a preprocessed image based on the noise contrast preprocessing of the original CT scan image. Existing technologies blur the edges of small defects while denoising, global equalization is ineffective in enhancing low contrast areas and is subject to artifact interference, and differences in scanning parameters between different batches lead to inconsistent image grayscale and spatial scale.
[0051] To solve the above problems, the specific implementation steps are as follows:
[0052] S11. Noise suppression processing is performed on the original CT scan image to obtain a denoised CT image. In this step, for each voxel block in the original CT scan image, similar voxel blocks are found within a preset search window, and a set of similar blocks is obtained using the mean formula. Step 1: Weight calculation = e^-(squared Euclidean distance between the current block and similar blocks) / (squared filtering parameter); Step 2: Denoised voxel value = weight of all similar blocks multiplied by the weighted sum of their corresponding voxel values / weight normalization constant. The denoised CT image is formed after processing all voxels; 3D block matching filtering. Denoising is achieved by utilizing the self-similarity of the internal structure of the welding area in three-dimensional space. The filtering parameter h is set between 10 and 30 to control the balance between noise suppression and detail preservation. The search window size is usually set to 7×7×7 voxels to ensure sufficient similar block samples while controlling computational overhead. The original CT scan image includes three-dimensional volume data, slice sequences, and scan metadata. The three-dimensional volume data includes voxel gray values and voxel spatial coordinates. The slice sequences include axial slices, coronal slices, and sagittal slices. The scan metadata includes tube voltage, tube current, exposure time, voxel size, and scan slice thickness.
[0053] S12. Perform contrast enhancement processing on the denoised CT image to generate an enhanced CT image. In this step, the denoised CT image is first divided into several sub-blocks. Step 1: Sub-block equalization gray level = rounded ((cumulative distribution function value of the pixel gray level - minimum cumulative distribution function value of the sub-block) / (1 - minimum cumulative distribution function value of the sub-block) × (maximum gray level - 1)). Step 2: Boundary pixels between adjacent sub-blocks are fused by bilinear interpolation to obtain the enhanced CT image. Adaptive histogram equalization divides the image into 8×8 pixel sub-blocks, limiting the contrast amplification factor between 2 and 4 to suppress excessive noise enhancement, and the maximum gray level is 256. Local equalization can enhance the visibility of low-contrast defects such as pores and cracks in the welding area. Bilinear interpolation between sub-blocks eliminates artifacts at the splicing boundary, making the overall image transition natural. The enhanced image retains the gray level difference between the defects and the base material.
[0054] S13. Standardize the enhanced CT image to obtain a preprocessed image. In this step, the mean gray value of all pixels in the enhanced CT image is obtained through the mean formula, and the standard deviation of gray value is obtained through the standard deviation formula. Step 1: Standardized gray value = (original gray value - mean gray value) / standard deviation of gray value; Step 2: Interpolate the resolution of all slices to 256×256, and normalize the pixel spacing to the set standard to form the preprocessed image.
[0055] Standardization unifies the grayscale distribution of CT images acquired under different scanning parameters into a standard normal distribution with a mean of 0 and a standard deviation of 1, eliminating inconsistencies in overall image brightness and contrast caused by differences in tube voltage and tube current; a unified resolution of 256×256 pixels balances the preservation of defect details and the computational efficiency of the subsequent UNet network; and pixel spacing is normalized to 0.5 to 1.0 mm, making the spatial scale of different workpieces comparable.
[0056] This invention achieves effective suppression of CT image noise, clear presentation of low-contrast defects, and consistency of input formats across multiple batches of data through a progressive design that combines three-dimensional block matching filtering to denoise and preserve defect edges, adaptive histogram equalization to enhance local contrast, and Z-score standardization to unify grayscale and spatial scale. This enables segmentation to obtain an image foundation with high signal-to-noise ratio, distinguishable defects, and stable input distribution, freeing transfer learning feature extraction from input offset interference. This improves the robustness and generalization ability of the fully automatic welding defect recognition system from the image preprocessing stage.
[0057] S2. Based on the preprocessed image, multi-scale decoding and stitching are performed to generate a coarse segmentation probability map. The coarse segmentation probability map is encapsulated by a random field mask to obtain a welding area mask. Existing technologies cannot handle the grayscale overlap between the weld and the base material. Deep learning segmentation lacks attention guidance, resulting in background interference and rough boundaries. Two-dimensional layer-by-layer processing ignores the continuity of interlayer space, leading to segmentation breakage. Post-processing lacks three-dimensional connected component screening, causing false positive fragments to be mixed into the subsequent defect detection process.
[0058] To solve the above problems, the specific implementation steps are as follows:
[0059] S21. Based on the preprocessed image, multi-scale feature processing is performed to generate a multi-scale encoded feature map. The first step involves convolving the preprocessed image using a 3×3 kernel, followed by activation using a linear rectified function to obtain the first-layer feature map. Then, downsampling is performed using pooling to extract the maximum value from a local region. The second step uses the downsampled feature map as input to the next layer, repeating the convolution activation and pooling downsampling process four times to form a five-scale feature map pyramid from shallow to deep layers. The third step uses these five-scale feature maps to construct the multi-scale encoded feature map.
[0060] The UNet encoder extracts multi-scale features of welds through layer-by-layer convolution and downsampling. Shallow feature maps have high resolution and preserve the location details of minor defects such as cracks, while deep feature maps have large receptive fields and capture the semantic information of larger defects such as porosity and lack of fusion. The convolution kernel weights are initialized using the He method, and the variance of the weight distribution is 2 divided by the number of input channels, so that the variance of the activation values of each layer remains stable during forward propagation and avoids gradient vanishing in deep networks. The pooling window is 2×2 to halve the feature map size layer by layer, and the downsampling ratios of the five-layer coding structure are 2, 4, 8, 16, and 32 times respectively.
[0061] S22. Attention gating is performed based on multi-scale encoded feature maps to obtain attention-enhanced skip features. In this step, the first step is to perform linear transformations on the decoder upsampled features and the corresponding skip connection features using 1×1 convolutions, then add them element by element, add a bias, and then pass them through a sigmoid activation function to obtain attention coefficients. The second step is to calculate the attention-enhanced skip feature as the element-wise product of the skip connection features and the attention coefficients. Attention-enhanced features at all scales constitute the attention-enhanced skip feature set.
[0062] The additive attention gating mechanism uses semantic guidance information provided by the upsampled features of the decoder to spatially weight the skip connection features of the encoder. The sigmoid activation function compresses the attention coefficients to between 0 and 1. High-value regions correspond to weld contours and defect locations, while low-value regions correspond to the background of the base material, thereby suppressing the response of non-welded regions. The 1×1 convolution reduces the number of feature channels to half of the original to reduce computation.
[0063] S23. Decode and concatenate the attention-enhanced skip features to generate a coarse segmentation probability map. The first step involves transposing and upsampling the deepest feature, then concatenating the upsampled result with the corresponding scale features in the attention-enhanced skip feature set by channel. After two layers of convolution and activation, the current layer's restored features are obtained. This process is repeated layer by layer until the original resolution is restored. The second step is the coarse segmentation probability map: After performing a 1x1 convolution on the feature map restored to its original resolution, it is then mapped to a range of 0 to 1 using a sigmoid activation function. Each pixel value represents the probability that the pixel belongs to the welding area.
[0064] Transposed convolution upsampling gradually restores low-resolution deep features to high resolution by learning the inverse mapping. The kernel size is 2×2 and the stride is 2, which doubles the feature map size layer by layer. Skip connections concatenate the shallow detail features filtered by the encoder through attention gating with the deep semantic features upsampled by the decoder by channel. The number of channels after concatenation is the sum of the two. The sigmoid activation function compresses the output value to the range of 0 to 1. The closer the value is to 1, the higher the confidence that the pixel belongs to the welding area. 0.5 is the default judgment threshold.
[0065] S24. Based on the coarse segmentation probability map and the preprocessed image, generate a refined segmentation probability map through random field iterative inference. In this step, the first step is: Energy function = sum of univariate potentials of all pixels + sum of binary potentials of all pixel pairs, where univariate potential = -e^(natural logarithm of the original probability of the pixel in the coarse segmentation probability map), and binary potential = label compatibility function × summation of (each Gaussian kernel weight × corresponding Gaussian kernel function value). The second step is: decompose the posterior distribution into a product of independent distributions through mean field approximation, iteratively update the probability value of each pixel until convergence, and output the refined segmentation probability map.
[0066] Fully connected conditional random fields introduce spatial and color similarity constraints between pixels through binary potentials. The standard deviation of the spatial kernel in the Gaussian kernel is set to 10 to 30 to control the influence range of spatial proximity, and the standard deviation of the color kernel is set to 5 to 15 to control the sensitivity of grayscale similarity. The mean field iterations are usually set to 5 to 10 to converge. Each iteration updates the current probability distribution by convolving it with the Gaussian kernel. This refining process corrects isolated high-probability noise points in the coarse segmentation by surrounding low-probability regions. The label compatibility function uses the Potts model.
[0067] S25. Morphological optimization is performed based on the segmentation refinement probability map to obtain a binary mask for the welding area. In this step, the first step is to automatically calculate the optimal threshold using the maximum inter-class variance method to maximize the inter-class variance between the welding area and the background area. The second step is to assign a value to the binary mask: if the pixel value of the refined segmentation probability map is greater than or equal to the optimal threshold, the value is assigned as 1; otherwise, the value is assigned as 0. The third step is to perform morphological closing operation: first, the binary mask is expanded using circular structuring elements, and then the expansion result is eroded to eliminate small internal holes and obtain a smooth binary mask for the welding area.
[0068] The Otsu's method automatically determines the segmentation threshold based on the grayscale distribution of the probability map, eliminating the need for manual setting. It achieves the best results when the probability distribution of the welding area and the background is bimodal, while it degenerates into global mean segmentation when it is unimodal. In the morphological closing operation, setting the diameter of the circular structuring element to 5 pixels can effectively fill the segmentation holes smaller than 5 pixels caused by the low probability inside the pores, while not changing the outer contour boundary position of the welding area, thus avoiding the introduction of systematic bias into subsequent defect size measurements.
[0069] S26. Perform mask encapsulation processing on the binary mask of the welding area to obtain the welding area mask. In this step, three-dimensional connected component marking is performed on all two-dimensional slices of the binary mask of the welding area layer by layer. Spatially adjacent foreground voxels are classified into the same connected component and the voxel count of each connected component is calculated. Then, by comparing the voxel count of each connected component, the connected component with the largest volume is obtained. This connected component is used as the final welding area mask, which includes the mark of each voxel belonging to the weld and the boundary coordinates of the smallest circumscribed cuboid.
[0070] The 3D connected domain analysis adopts a 26-neighborhood connection method, that is, each voxel is connected to 26 neighboring voxels in the surrounding 3D space to determine connectivity, avoiding the omission of interlayer connected welding areas due to 2D layer-by-layer processing; retaining the largest connected domain can automatically filter out isolated small areas caused by high-density inclusions in the base material or scanning artifacts. These false positive areas usually have less than 5% of the number of voxels in the welding area; the output includes bounding box coordinates, which directly limits the spatial range of the sliding window sampling, reduces the amount of invalid calculation in non-welding areas, and ensures that all defect candidate slices are located inside the real weld.
[0071] This invention solves the problem of overlapping gray levels and blurred boundaries between the welded area and the base material in CT images, which traditional thresholding or edge detection cannot accurately segment. In practice, the gray level of the heat-affected zone of aluminum alloy welds is close to that of the weld, and global thresholding misclassifies it as a welded area, reducing the defect recognition accuracy by about 15%. This invention uses a UNet five-layer feature pyramid combined with attention gating, and uses the decoder semantics to guide the spatial weighting of encoder features, suppressing the background response of the base material. This not only improves the boundary segmentation accuracy, but also limits the defect candidate slices to the inside of the real weld, eliminating false alarms and invalid calculations in non-weld areas from the source.
[0072] This invention can maintain probability consistency with a univariate potential and constrain the smoothing of adjacent pixel labels with a binary potential. It eliminates isolated noise and smooths the boundaries through mean field iteration and fills small holes with linked morphological closing operations, ensuring the integrity and continuity of the mask in the welding area. This provides an accurate benchmark for subsequent defect quantification measurement and effectively solves the problems of isolated noise and jagged edges in the segmentation probability map, and mask holes and burrs caused by direct binarization. For example, after the segmentation of a weld, holes are caused by low probability of pores inside, with an edge error of 2 to 3 pixels.
[0073] In practice, this invention enables three-dimensional connected domain analysis to uniformly process all slices with 26 neighbor connections, retaining the largest volume connected domain as the welding area, eliminating interlayer fractures and false positive fragments, and outputting bounding boxes to limit the sampling range of the parent step three, thereby improving the accuracy and efficiency of the overall process. In practice, it effectively solves the problem of neglecting interlayer continuity in two-dimensional layer-by-layer processing, leading to segmentation fractures, and misjudging high-density inclusions in the base material as weld fragments. For example, in the case of thick-walled steel pipe CT, the weld fractures into two segments due to interlayer noise. Especially in the special case where random high-density inclusions inside the base material are misjudged as weld fragments in two-dimensional segmentation, the lack of interlayer spatial continuity constraints in two-dimensional layer-by-layer segmentation results in incomplete or impure welding area masks in three-dimensional space.
[0074] S3. Residual features are extracted from the mask of the welding area to obtain a depth feature map. Based on the depth feature map, the defect feature vector is obtained by compression and encapsulation through transfer classification. Existing technologies have limited ability to distinguish complex defect morphologies. Global feature extraction has a weak response to low-contrast defects, leading to missed detections. Variable-length slice features lack a unified aggregation mechanism and cannot be adapted to subsequent classification networks with fixed structures. There is a lack of dimensional connection design between feature extraction and downstream classifiers, resulting in a decrease in recognition accuracy after independent training.
[0075] To solve the above problems, the specific steps are as follows:
[0076] S31. Based on the welding area mask, fine-tune the residual network to generate the initial feature extraction network. In this step, the first step is to load the weights of a 50-layer residual network pre-trained on a large natural image dataset, freeze the weights of the first three convolutional layers to keep their values unchanged, and set the fourth stage and the fully connected layers to a trainable state. The second step is to add adapter weights and initialize them with random sampling from a normal distribution with a mean of 0 and a standard deviation of 0.01. The full network parameter set is the frozen weights plus the trainable weights, which constitute the initial feature extraction network.
[0077] The first three stages of the 50-layer residual network mainly extract common low-level features such as edges and textures. These features can be directly reused when transferred from natural images to CT grayscale images. Freezing them can prevent overfitting on small sample welding data. The fourth stage extracts high-level semantic features related to the task. The fully connected layer is responsible for classification decisions and maintains a trainable state to adapt to the shape of welding defects. The adapter standard deviation is randomly initialized with a small value of 0.01 to avoid gradient oscillation in the early stage of fine-tuning due to excessively large initial output values. This transfer learning strategy enables the feature extraction network to converge stably even with only a few hundred labeled welding defect slices.
[0078] S32. Based on the welding area mask and preprocessed image, perform region slicing enhancement to obtain a defect candidate slice set. In this step, the first step is to slide and extract slices of fixed size within the welding area mask bounding box with a preset step size. The average gray level of each slice is calculated; if the average gray level is lower than the surrounding background gray level threshold, the slice is marked as a defect candidate. The second step is to calculate the local contrast ratio as the local gray level standard deviation obtained through the standard deviation formula / the local gray level mean obtained through the mean formula. Contrast-limited adaptive histogram equalization is used to enhance the defect candidate slices. The third step is to construct a defect candidate slice set from all enhanced defect candidate slices.
[0079] The sliding window size is set to 64×64 pixels to cover the scale range of typical defects such as pores and cracks. The step size is set to 32 pixels to ensure 50% overlap between adjacent slices, avoiding truncation and missed detection when defects are located at the slice boundary. The background grayscale threshold is the overall mean of the welding area minus 0.5 times the standard deviation. Areas below this threshold correspond to low-density defects such as pores and cracks. Contrast-limited adaptive histogram equalization limits the local contrast amplification factor within the slice to between 2 and 3, enhancing the defect edges while avoiding excessive noise amplification.
[0080] S33. Perform deep feature extraction on the defect candidate slice set and the initial feature extraction network to obtain a deep feature map set. In this step, the first step is to feed each slice in the defect candidate slice set into the initial feature extraction network for forward computation block by block. The output of each residual block = input + residual function (input, weight of the block), where the residual function is composed of convolutional layer, batch normalization and linear rectified activation in sequence. The second step is to take the output of the last residual block and compress the spatial dimension through global average pooling to obtain a 2048-dimensional feature vector. The feature vectors of all slices constitute the deep feature map set.
[0081] Residual connections enable deep gradients to be directly propagated to shallow layers through skip addition, mitigating the degradation problem of the 50-layer network on small sample welding data. Batch normalization standardizes and stabilizes the training process for each batch of features, accelerating convergence. Global average pooling maps the feature maps of each channel to a single value, with a fixed output dimension of 2048, derived from the number of channels at the end of the fourth stage of the 50-layer residual network. The 2048-dimensional feature vector provides highly discriminative feature representations for subsequent center loss-supervised fine-tuning, while its fixed dimension allows subsequent feature aggregation operations to be directly concatenated without alignment.
[0082] S34. Based on the deep feature map set, fine-tune through transfer classification supervision to generate a defect feature vector set. In this step, the first step is: joint loss LH_ss = cross-entropy loss JC_ss + balance coefficient a × center loss ZX_ss, where cross-entropy loss JC_ss = -summation value, the summation value = the natural logarithm of the predicted probability corresponding to the true class of the sample, and then summing these logarithmic values for all samples. Center loss ZX_ss = 0.5 × the sum of the squared Euclidean distances between each sample feature vector and the corresponding class feature center. The second step is: using the joint loss LH_ss as the objective function, calculate the gradient of the loss with respect to the parameters of the initial feature extraction network through backpropagation, and use the gradient descent algorithm to iteratively update the network parameters so that the loss value gradually decreases until convergence. After fine-tuning, remove the classification head, and the feature vectors corresponding to each slice constitute the defect feature vector set QX_tz.
[0083] Cross-entropy loss drives the classification boundary to correctly separate categories such as pores, cracks, and non-fusion. Center loss reduces intra-class differences by clustering similar features towards the class center. The balance coefficient is set to 0.01 to 0.1 to ensure that the intra-class aggregation strength is 10% to 1% of the classification boundary learning to avoid excessively suppressing inter-class separability. The feature centers of each category are updated by moving average in each batch of training, and the momentum is set to 0.5 to ensure smooth center migration and avoid disturbance from abnormal samples in a single batch. After fine-tuning, the classification head is removed and 2048-dimensional feature vectors are retained as the embedded representation of defects. This feature vector set provides highly discriminative and intra-class compact input for subsequent feature aggregation and graph neural network node attributes.
[0084] Experimental data description: A weld CT dataset was used as the test object. This dataset contains 1200 labeled slices of four types of defects: porosity, cracks, lack of fusion, and tungsten inclusions. It is divided into training set and test set. Pure cross-entropy fine-tuning and the joint loss fine-tuning of this invention were used for 50 training rounds each. The results show that the classification accuracy of the test set after pure cross-entropy fine-tuning is 91.2%. The classification accuracy of the test set after joint loss fine-tuning of this invention is improved, and the intra-class compactness is greatly improved. In feature space visualization, joint fine-tuning reduces the overlap area of the two morphologically similar defect feature clusters of porosity and tungsten inclusions by about 1 / 3 after dimensionality reduction. This shows that the center loss effectively increases the feature distance of easily confused categories by clustering similar features towards the class center. At the same time, the balance coefficient of joint loss fine-tuning is set to 0.05, which achieves the optimal trade-off between intra-class aggregation and inter-class separation, verifying the effectiveness of the fine-tuning strategy in improving the discrimination power and compactness of defect features.
[0085] S35. Based on the defect feature vector set, aggregate the global defect representation to obtain the aggregated defect feature vector. In this step, the first step is to take the maximum value of all defect slice feature vectors belonging to the same CT scan volume in each dimension to obtain the max pooling vector, and take the average value in each dimension to obtain the average pooling vector. The second step is to concatenate the aggregated defect feature vector, which is the max pooling vector and the average pooling vector in each dimension to form a global defect feature representation with fixed dimensions.
[0086] Max pooling captures the strongest feature signals within the defect region, highlighting local morphologies such as the sharpness of pore edges or crack tips; average pooling preserves the overall distribution trend of features within the defect region, reflecting the average grayscale contrast and global shape attributes of the defect; the concatenated dimension is 4096, meaning that the 2048-dimensional feature vector output by S33 produces a 2048-dimensional concatenation result under each of the two pooling methods.
[0087] S36. Perform dimensionality compression and encapsulation on the aggregated defect feature vector to obtain the defect feature vector. In this step, the first step is: L2 normalization = aggregated defect feature vector / L2 norm of the vector, where L2 norm = square root of the sum of the squares of each element of the vector; the second step is: if the current dimension is still higher than the target dimension, perform principal component analysis to reduce the dimension, take the first few principal components with a cumulative variance contribution rate greater than 0.95, and project the normalized vector onto the principal component space to obtain the dimension-reduced defect feature vector.
[0088] L2 normalization maps feature vectors to a unit hypersphere, eliminating the difference in feature magnitude between different samples, so that the node similarity calculation in the subsequent graph neural network depends only on the direction rather than the magnitude; principal component analysis dimensionality reduction automatically determines the number of principal components to be retained with 95% energy as the threshold, which can usually compress 4096 dimensions to about 1024 dimensions.
[0089] This invention addresses the problem that existing technologies have limited ability to distinguish complex welding defects due to their small size and varied shapes. In practice, in a certain weld CT image, both pores and tungsten inclusions appear as low-grayscale circular areas. Manually designed roundness features cannot effectively distinguish between the two, resulting in a misclassification rate of approximately 18% between these two types of defects. This invention employs a 50-layer residual network that supports deep gradient propagation through residual connections, automatically extracting hierarchical features from edge texture to semantic shape layer by layer. Combined with weight transfer pre-trained on a large natural image dataset, the first three stages freeze and preserve general low-level features, while the fourth stage fine-tunes and adapts to the welding defect morphology. This not only extracts highly discriminative features under small sample conditions but also causes features of the same type of defect to cluster towards the category center, significantly enhancing intra-class compactness, thereby ensuring the discriminative power of subsequent graph neural network node attributes.
[0090] This invention can screen low grayscale regions by using local contrast indexes and enhance them with contrast-limited adaptive histogram equalization by using candidate slices along the mask boundary of the welding area. This not only amplifies the local feature response of low-contrast defects by 2 to 3 times, but also preserves the strongest feature response in each defect region in the global representation. This ensures that the features of small and low-contrast defects are not submerged by the global average, thus improving the detection coverage of all types of defects. Existing technologies are not sensitive to the local contrast difference of candidate regions during the extraction time. Low-contrast defects have weak feature responses in the global image and are easily missed. In practice, the grayscale difference between the non-fusion defect and the surrounding metal in a thick-walled weld is only about 5%. During global feature extraction, the response of this region is submerged in the weld background, resulting in a false negative rate of about 12%.
[0091] In practice, this method addresses the issue of redundant and inconsistent dimensional representations of defects within a single CT scan volume, where multiple defects of different categories are present. This is because the feature vectors of each defect slice are extracted independently, but an effective global aggregation mechanism is lacking. For example, a weldment containing three pores and one crack generates 47 candidate slices. Storing the features of each slice independently requires subsequent classifiers to handle variable-length inputs. Traditional methods simply concatenate the slices, causing the feature vector dimension to vary with the number of slices, making it impossible to input into a graph network with a fixed structure. In the special case where the number of crack defect slices is more than five times that of pores in the same weldment, directly summing and aggregating crack features will dominate the global representation, while pore features will be overwhelmed. This invention uses max pooling and average pooling to concatenate slices dimensionally, mapping any number of slices to a fixed 4096-dimensional vector. Max pooling preserves local salient morphology, average pooling reflects the overall trend, and L2 normalization eliminates modulus differences, compressing principal component analysis to 1024 dimensions. This not only solves the variable-length input problem but also ensures uniform and stable attribute dimensions for each defect node, thereby guaranteeing fair aggregation of different defect features during graph convolution propagation.
[0092] S4. Based on the defect feature vector, the nodes are divided by feature similarity threshold to obtain the set of nodes that need correction and the set of nodes that can be directly passed. Based on the set of nodes that need correction and the set of nodes that can be directly passed, the defuzzification verification label is performed to obtain the verification defect type identification result. Existing technology cannot quantify the judgment confidence. The data-driven classifier has a high misjudgment rate for morphological overlapping defects and lacks an expert knowledge integration mechanism. The correction information generated during the classification process cannot be fed back to optimize the feature space or graph structure. Low confidence misjudgment directly enters the final report, and the model lacks the ability to self-identify knowledge blind spots for unknown defects.
[0093] To solve the above problems, the specific steps are as follows:
[0094] S41. Based on the defect feature vector and the welding area mask, a defect relationship graph is constructed using feature similarity. The first step in this process is to extract the three-dimensional centroid coordinates of each defect from the welding area mask. Each defect is used as a graph node, and the node feature is taken as the corresponding sub-vector in the defect feature vector.
[0095] Step 2: Edge weight = e^-(squared Euclidean distance between the centroids of the two nodes) / (squared spatial standard deviation) × cosine similarity of the feature vectors of the two nodes; Step 3: If the edge weight is greater than the edge construction threshold, then an edge is established between the two nodes, and all nodes and edges constitute the defect relationship graph.
[0096] The spatial standard deviation is set to 5 to 20 mm to control the influence of spatial proximity on edge weights. The larger the value, the slower the edge weight decay between distant defects. The edge establishment threshold is set to 0.3 to 0.5 to ensure that graph connections are established only when two defects are spatially close and have high similarity in feature shape, thus avoiding the introduction of redundant noise edges into the fully connected graph.
[0097] S42. Perform graph convolution processing based on the defect relationship graph to obtain node-level classification probabilities and classification clarity. In this step: First, add an identity matrix to the adjacency matrix of the defect relationship graph, then perform symmetric normalization using the degree matrix^-1 / 2 to obtain the normalized propagation matrix; Second, the first-layer graph convolution output = normalized propagation matrix × node feature matrix × first-layer weight matrix, activated by a non-linear activation function; Third, the second-layer graph convolution output = normalized propagation matrix × first-layer output × second-layer weight matrix, outputting the prediction probability vector of each node for each defect category through a flexible maximum function; Fourth, classification clarity = the maximum and second-highest probability values in the prediction probability vectors of each node. All node prediction probabilities constitute the node-level classification probability, and all node clarity constitutes the classification clarity. The second-highest probability value is the probability of the second-highest exponential value.
[0098] Two-layer graph convolution enables each node to aggregate feature information of defects within its two-hop neighborhood, covering a group of spatially adjacent and morphologically similar defects in the same weld. The adjacency matrix plus identity matrix introduces self-loops, allowing nodes to retain their own features while aggregating neighbor features. The classification clarity value ranges from 0 to 1, with values closer to 1 indicating a higher level of confidence in classifying the node. The node-level classification probability is not directly used for the final classification, but rather the difference between the highest and second-highest probabilities is extracted to construct the innovative index of classification clarity. This index plays two roles: first, as an evaluator of classification quality, it quantifies the model's confidence in classifying each defect; lower classification clarity indicates that the defect is closer to the classification boundary, and the model itself has uncertainty. Second, as a trigger for diversion decisions, in S43, through threshold determination, defects are automatically diverted to a high-confidence direct path or a low-confidence correction path.
[0099] S43. Adaptive threshold splitting is performed on the node-level classification probability and classification clarity to obtain the set of nodes that need correction and the set of nodes that can pass directly. In this step, for each defective node, its classification clarity is compared with the preset clarity threshold. If the classification clarity is less than the clarity threshold, the node is assigned to the set of nodes that need correction; otherwise, it is assigned to the set of nodes that can pass directly.
[0100] The clarity threshold is set between 0.2 and 0.4. This threshold determines the splitting ratio. The lower the threshold, the fewer nodes need to be corrected, but the risk of missing corrections increases. The higher the threshold, the more nodes are triggered by fuzzy inference, but the computational cost increases. The splitting mechanism allows the high-confidence defects of the graph convolutional network to be directly adopted to ensure efficiency. Low-confidence defects are sent to the fuzzy inference of S44 for knowledge-driven secondary correction, avoiding the propagation of misjudgments between pores and tungsten inclusions, cracks and lack of fusion caused by fuzzy classification boundaries to the final output.
[0101] S44. Defuzzify the set of nodes to be corrected and the defect feature vector to obtain the fuzzy inference result. In this step, the first step is to extract shape features such as roundness, aspect ratio, and edge roughness from the defect feature vector as fuzzy input variables. Define a Gaussian membership function for each type of defect. Membership = e^-(shape feature value - center value)^2 / (2 × squared standard deviation). The second step is to calculate the applicability of all fuzzy rules for each defect in the set of nodes to be corrected. Applicability = minimum value of membership of each input variable. Defuzzify using the centroid method to obtain the fuzzy correction probability. Centroid method output = sum of applicability of each rule × sum of rule output centers / sum of applicability of each rule. The fuzzy category probability vectors of all nodes to be corrected constitute the fuzzy inference result.
[0102] The center value of the Gaussian membership function is taken as the statistical mean of the typical shape parameters of various defects, and the standard deviation is taken as 0.05 to 0.2 to make the membership degree smoothly transition near the typical value. High roundness corresponds to pore-like circular defects, large aspect ratio corresponds to slender crack shape, and high edge roughness corresponds to irregular unfused boundaries. The centroid method defuzzification weights and synthesizes the discrete outputs of each rule into a continuous probability value. This fuzzy correction probability and the output probability of the subsequent graph convolutional network are fused at S45 to achieve complementary judgment of data-driven classification and knowledge-driven reasoning.
[0103] S45. Based on the fuzzy inference results, node-level classification probabilities, and defect relationship graph, gradient feedback processing is performed to obtain the defect type identification results. The first step in this process is: for each node J_d in the node set to be corrected, calculate the normalization constant CS_g = summing the (graph convolutional network basic probability assignment TJ_fz × fuzzy inference basic probability assignment MH_fz) for all combinations satisfying the two hypotheses that the intersection is not empty, and fuse the confidence score RH_zx = (the (graph convolutional network basic probability assignment TJ_fz × fuzzy inference basic probability assignment MH_fz) for all combinations satisfying the two hypotheses that the intersection equals the target category). z) Summation) / normalization constant CS_g, take the category with the largest fusion confidence RH_zx as the final type ZZ_lx; Second step: Calculate the gradient vector TD_xl of membership degree with respect to shape features such as roundness and aspect ratio during fuzzy inference, update edge weight B_qzg = original edge weight B_qz + update step size GB_c × (inner product of gradient vector TD_xli of node i and gradient vector TD_xlj of node j), for directly taking the highest probability category of graph convolutional network through node set, the type label and confidence of all nodes constitute the defect type identification result QX_LX;
[0104] Evidence fusion utilizes synthesis rules to orthogonally combine the data-driven classification probability of the graph convolutional network with the knowledge-driven correction probability of fuzzy reasoning in the hypothesis space. The normalization constant reflects the degree of conflict between the two evidence sources. The greater the conflict, the smaller the normalization constant, indicating that there is a discrepancy in the two judgments on the same defect. The update step size is set to 0.01 to 0.1 to control the magnitude of the edge weight update. The gradient vector reflects the direction and intensity of the influence of each shape feature on the current membership degree. When the membership degree gradient directions of two defects are consistent, the inner product is positive edge weight enhancement, which drives them to aggregate more tightly in subsequent graph convolutions. This feedback enables the defect relationship graph to automatically strengthen the spatial connection of similar defects after each inference, and at the same time provides the final confidence basis for the knowledge blind spot labeling of S46.
[0105] Experimental data description: A weld CT dataset was used as the test object. This dataset contains 200 labeled samples of four types of defects: porosity, cracks, lack of fusion, and tungsten inclusion. Among them, there are 68 fuzzy nodes with a resolution lower than 0.3. Twenty comparative experiments were conducted using pure GNN classification, GNN plus fuzzy inference without feedback fusion, and the proposed method. Pure GNN had the lowest classification accuracy for the 68 fuzzy nodes. The accuracy of GNN plus fuzzy inference with evidence fusion was in the middle. After adding membership gradient feedback, the proposed method achieved the highest classification accuracy for fuzzy nodes after three iterations of edge weight updates. At the same time, the average edge weight between nodes of the same type of defect was enhanced after feedback iteration, and the modularity index of the same type of defect in the defect relationship graph increased from 0.31 to 0.54. This made the aggregation of similar features more compact during subsequent GNN inference, thereby continuously improving the classification accuracy.
[0106] The fuzzy inference results are not only used to fuse evidence with node-level classification probabilities to obtain the final defect type identification result, but the gradient of membership degree with respect to defect shape features generated during the calculation process is also extracted as the driving signal for updating the edge weights of the defect relationship graph. This design extends the utility of fuzzy inference from result correction to feature space optimization. The same calculation process serves two goals: improving classification accuracy and improving graph structure quality. It demonstrates the creative effect of both correcting the current result and optimizing future inference.
[0107] S46. Verify and mark blind spots in the defect type identification results to obtain verified defect type identification results. In this step, each defect node in the defect type identification results is traversed to check whether its fused confidence is lower than the preset confidence threshold. If the fused confidence of the defect is lower than the confidence threshold, it is marked as a knowledge blind spot in the label field of the defect, and its defect feature vector and fuzzy feature value are recorded as traceability information. The remaining defects retain their original type labels and confidence, and the defect type identification results verified by integrity are output.
[0108] The confidence threshold is set between 0.5 and 0.7. This threshold determines the minimum credible threshold for the final judgment result. Defects with a confidence level below this threshold indicate that neither the data-driven classification nor the knowledge-driven reasoning evidence sources can provide a clear and consistent judgment. Such defects are explicitly labeled as knowledge blind spots rather than being forcibly classified into a known category. Defects marked as knowledge blind spots, along with their feature vectors and fuzzy feature values, are recorded and passed to S6 as key samples for model iteration and optimization. This allows subsequent models to perform targeted enhancement training for these defects with ambiguous or unknown boundaries, thereby improving the system's continuous adaptability to rare or atypical defects.
[0109] This invention addresses the problem that traditional defect classifiers only output a deterministic category label, failing to assess the reliability of that label. This leads to low-confidence misjudgments being directly adopted and propagated to subsequent stages. In practice, for example, a weld CT image might show pores and tungsten inclusions that resemble each other. The classifier might classify it as pores with a slight probability difference of 51% to 49%, but this low-confidence label directly enters the defect report. Quality inspectors cannot distinguish whether this judgment is a reliable conclusion or a vague guess. This invention, after outputting the category probability in the graph convolutional network, simultaneously calculates the difference between the highest and second-highest probabilities as a classification clarity index. The value range of 0 to 1 quantifies the confidence level of each defect judgment. This not only enables the model to have self-evaluation capabilities but also automatically diverts ambiguous samples with clarity below the threshold to fuzzy inference for secondary correction, thereby ensuring that low-confidence judgments are not directly mixed into the final report, enhancing the reliability and traceability of defect type identification results.
[0110] By constructing fuzzy inference, shape features such as roundness, aspect ratio, and edge roughness are extracted from the defect feature vector as fuzzy inputs. Knowledge-driven inference is performed using Gaussian membership functions and expert rule bases. This not only formalizes the welding process expert experience into computable rules, but also orthogonally combines the fuzzy correction probability with the output probability of the graph convolutional network in the hypothesis space, achieving complementary judgment between data-driven and knowledge-driven approaches. This significantly reduces the misclassification rate of morphologically similar defects. It can solve the problem of the fuzzy boundary of the defect category distinction when the morphological features overlap in pure data-driven deep learning classifiers, and the lack of a mechanism to integrate expert experience knowledge into the judgment process. In practice, cracks and lack of fusion both appear as linear low-density areas in CT images. When the defect size is small and the edges are irregular, it is difficult to accurately distinguish them based on convolutional features alone. The mutual misclassification rate of the two types of defects in actual production lines is about 12%.
[0111] Specifically, the above-mentioned scheme can solve the problem in practice that the graph structure remains unchanged after inference, making it impossible to optimize graph connections using feedback information generated during classification, thus preventing the continuous improvement of the spatial aggregation degree of similar defects. For example, in a weld, three pores of the same type are far apart in space and have large differences in initial features, resulting in low edge weights during graph construction. When the graph convolutional network classifies them independently, one of them is misclassified as tungsten inclusion. In the special case of a series of pores distributed along the welding direction in the same weld, due to the consistent feature gradient direction, the initial graph connections are sparse. During the first classification, the clarity of some nodes is low, triggering fuzzy correction. After correction, the graph structure is not updated, and the same problem recurs in the next inference. After evidence fusion and judgment, this invention calculates the gradient vector of membership degree with respect to shape features during fuzzy inference, and updates the edge weights by weighting the gradient inner product between nodes, making similar defects more aggregated in the graph structure. This not only feeds the classification correction information back to the graph structure, but also links the subsequent graph convolutional network inference, so that the updated graph structure provides stronger feature aggregation support for similar defects, thereby continuously improving the collaborative inference quality of the model.
[0112] S5. Based on the verification of defect type identification results, perform morphological defect assessment processing and generate a defect assessment report; existing technologies have large three-dimensional size errors, severity classification relies on human experience with subjective bias and inconsistent judgments, assessment reports lack intuitive display of defect spatial distribution due to separation of text and images, and lack standardized data interfaces between quantitative assessment and subsequent model iterations.
[0113] To solve the above problems, the specific implementation steps are as follows:
[0114] S51. Based on the defect type identification results, morphological measurement processing is used to obtain defect quantification data. In this step, the first step is to mark the three-dimensional connected components of each classified defect in the welding area mask and count the number of voxels occupied by the defect. The second step is to calculate the defect volume as the number of voxels × the physical volume of a single voxel. The third step is to calculate the maximum diameter as the maximum Euclidean distance between any two points inside the defect. The fourth step is to calculate the roundness as (4 × pi × defect surface area) / (defect perimeter × defect perimeter). All the quantification indicators of the defects constitute the defect quantification data.
[0115] The physical volume of a single voxel is determined by the pixel pitch and interlayer pitch of the CT scan, typically ranging from 0.01 to 0.1 cubic millimeters. The maximum diameter reflects the maximum extension scale of the defect in three-dimensional space and is a direct basis for assessing whether the defect exceeds the percentage of the wall thickness. The roundness value is between 0 and 1, with a perfect sphere being 1 and elongated cracks approaching 0. This provides a measured reference value for shape features for S4 fuzzy inference and provides quantitative input of size and shape for the severity level assessment of S52.
[0116] S52. Based on the defect quantification data, the severity level is processed to obtain the defect severity level. The first step in this process is to refer to the welding defect quality standard and set a grading threshold based on wall thickness for each defect type, such as porosity, cracks, lack of fusion, and tungsten inclusions. The second step is to compare the maximum diameter of each defect with the grading threshold. For example, if the maximum diameter is less than 0.3 times the wall thickness, it is rated as Grade I (qualified); if the maximum diameter is between 0.3 and 0.5 times the wall thickness, it is rated as Grade II (rework); if the maximum diameter is greater than 0.5 times the wall thickness, it is rated as Grade III (scrap). The third step is to classify all defects individually and summarize them into a defect severity level.
[0117] The grading thresholds are formulated with reference to the ISO 5817 standard for welding defects, and the wall thickness value is obtained from the design drawings of the weldment. Grade I indicates that the defect size is within the allowable range and does not require treatment. Grade II indicates that the defect exceeds the allowable limit but can be repaired by means of welding. Grade III indicates that the defect has seriously weakened the structural strength and must be scrapped.
[0118] S53. Perform defect severity assessment and generate a defect assessment report. The first step in this step is: Overall judgment of the weldment = If the severity level of all defects does not exceed Level II, it is qualified and will be reworked; otherwise, it is unqualified. The second step is to mark the location and type of each defect on the original CT scan image with different colors and generate a cross-sectional annotation image. The third step is: Defect assessment report = Text assessment conclusion + Defect quantitative data table + Annotated image.
[0119] The overall acceptance criteria are based on the welding defect quality standard, where Class I is acceptable and Class II requires rework, while Class III is unacceptable and requires scrapping. Color markings are used to visually represent the spatial distribution and categories of defects: red for cracks, blue for porosity, yellow for lack of fusion, and green for tungsten inclusions. The defect assessment report includes weldment identification, overall judgment results, a statistical table of the quantity and size of various defects, and cross-sectional images.
[0120] This invention achieves accurate three-dimensional measurement of defect size, standardized automatic judgment of severity level, and complete archiving of evaluation report information through a progressive design that includes three-dimensional connected domain voxel counting size measurement, automatic classification of welding defect quality standard thresholds, structured reports, and color-annotated illustrations. This ensures that the quantified measurement objects are all classified defects, providing standardized defect size true values and classification conclusions for model performance evaluation. It improves the measurement accuracy, judgment consistency, and report practicality of the fully automatic welding defect identification system from the defect quantification and evaluation stages.
[0121] S6. Evaluate and process the defect assessment report to obtain the model feedback report. Existing technologies only focus on the overall accuracy, while ignoring the fine-grained indicators of each category and the feature analysis of error cases. The grid search for hyperparameter adjustment is inefficient and cannot achieve global optimization. Model updates lack version management and knowledge blind spot feedback mechanisms. Model performance gradually degrades with batch drift but cannot be traced or rolled back.
[0122] To solve the above problems, the specific implementation steps are as follows:
[0123] S61. Based on the defect assessment report, conduct model evaluation and analysis to obtain model performance indicators. The first step in this process is to collect manually reviewed real defect category labels and compare them item by item with the defect type identification results, counting the number of correctly identified positive categories, the number of misidentified positive categories, and the number of missed positive categories. The second step is to calculate precision = (number of correctly identified positive categories + number of misidentified positive categories). The third step is to calculate recall = (number of correctly identified positive categories + number of missed positive categories). The fourth step is to calculate F1 score = 2 × precision × recall / (precision + recall). The fifth step is to analyze the distribution of false positives and false negatives in terms of morphological features such as roundness and aspect ratio, focusing on recording samples marked as knowledge blind spots in the defect type identification results. All indicators constitute the model performance indicators.
[0124] Precision and recall are both between 0 and 1, and the F1 score is the harmonic mean of the two. All three reflect the model's accuracy and recall in classifying different defect categories. The statistical proportion of knowledge blind spots directly reflects the current model's ability to handle unknown or ambiguous defects. This proportion provides the objective function value for hyperparameter tuning of S62.
[0125] S62. Based on the model performance index, Bayesian hyperparameter processing is performed to obtain the optimal parameter set. In this step, the objective function is the F1 score function with hyperparameters as independent variables. The posterior distribution of the objective function is obtained by fitting the known hyperparameter points and their F1 scores through Gaussian process regression. The acquisition function is the posterior mean plus the exploration weight × posterior standard deviation. The hyperparameters that make the acquisition function take the maximum value are selected as the next set of points to be evaluated. After iterative convergence, the optimal parameter set is obtained.
[0126] Bayesian optimization utilizes a Gaussian process to probabilistically model the mapping relationship between the F1 score and each hyperparameter, exploring the strength of the search tendency towards high uncertainty regions by taking weights between 0.01 and 0.1. Among the hyperparameters to be optimized, the search range for the sharpness threshold is 0.1 to 0.5, the search range for the confidence threshold is 0.4 to 0.8, the search range for the membership center value is within ±0.1 of the statistical mean of various defect shape features, and the search range for the standard deviation is 0.03 to 0.3. This set of optimized parameters provides a globally optimized combination of hyperparameters for the S63 model update, making the model's defect identification performance optimal for the new batch of weldments after the update.
[0127] S63. Generate a feedback report for the optimized parameter set to obtain the model feedback report. In this step, the first step is to write the sharpness threshold, confidence threshold, and membership parameters in the optimized parameter set into the corresponding model weights in S2, S3, and S4, and the model version number = original version number + 1. The second step is to feed back the model update feedback report = comparison of F1 scores before and after the update + relabeling results of knowledge blind zone samples + hash value of new model weights + suggestions for the next training, and feed it back to S1 for use in the next round of CT image processing.
[0128] The parameter warm start directly loads the optimal hyperparameters found by Bayesian optimization into each parent step model, avoiding retraining from random initial values; the version number increments to record the historical state of each update, and can roll back to the previous version when the performance of the new version degrades; knowledge blind zone samples are manually reviewed, re-labeled and added to the training set, and their number usually accounts for 2% to 5% of the total number of defects. The model's ability to identify these ambiguous boundary samples is enhanced in the next training; the model weight hash value is calculated using the secure hash algorithm 256, which serves as a tamper-proof verification code for the model version.
[0129] This invention achieves fine-grained diagnosis of model performance, global optimal search of hyperparameters, and continuous evolution and safety traceability of the model through progressive design including confusion matrix-based class-by-class F1 score evaluation and error case feature distribution analysis, Bayesian optimization of hyperparameter automatic search, parameter hot-loading version management, and knowledge blind spot closed-loop feedback. It can provide true values for performance calculation and enable feedback samples to be directionally supplemented to the training set, thereby improving the performance self-optimization and long-term reliability of the automatic welding defect identification system from the model iteration stage.
[0130] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code, including but not limited to disk storage, CD-ROM, optical storage, etc.
[0131] The above embodiments provide a detailed description of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for identifying welding defects based on CT scan images, characterized in that, The steps of this method are as follows: acquire the original CT scan image of the target welding point, and generate a preprocessed image based on the noise contrast preprocessing of the original CT scan image; Multi-scale decoding and stitching are performed on the preprocessed image to generate a coarse segmentation probability map. The coarse segmentation probability map is then encapsulated with a random field mask to obtain the welding area mask. Residual features are extracted from the mask of the welding area to obtain a depth feature map. Based on the depth feature map, the defect feature vector is obtained by compression and encapsulation through transfer classification. Based on the defect feature vector, the nodes are divided by feature similarity threshold to obtain the set of nodes that need to be corrected and the set of nodes that can be directly passed. Based on the set of nodes that need to be corrected and the set of nodes that can be directly passed, the defuzzification verification label is performed to obtain the verification defect type identification result. Based on the results of the defect type identification, morphological defect assessment is performed to generate a defect assessment report. The defect assessment report is evaluated and feedback is processed to obtain the model feedback report; Among them, the defuzzification verification mark based on the node set to be corrected and directly through the node set includes: defuzzification based on the node set to be corrected and the defect feature vector to obtain the fuzzy inference result; Gradient feedback processing is performed based on fuzzy inference results, node-level classification probabilities, and defect relationship graphs to obtain defect type identification results. The defect type identification results are verified and blind spots are marked.
2. The welding defect image recognition method based on CT scan images according to claim 1, characterized in that, The noise contrast preprocessing based on the original CT scan image includes: noise suppression processing based on the original CT scan image to obtain a noise-reduced CT image; Enhanced CT images are generated by performing contrast enhancement processing on denoised CT images. The enhanced CT images are standardized to obtain preprocessed images.
3. The welding defect image recognition method based on CT scan images according to claim 1, characterized in that, Multi-scale decoding and stitching based on preprocessed images includes: generating multi-scale encoded feature maps by multi-scale feature processing of the preprocessed images; Attention-enhanced skip features are obtained by performing attention gating processing on multi-scale encoded feature maps. The attention-enhanced jump features are decoded and concatenated to generate a coarse segmentation probability map.
4. The welding defect image recognition method based on CT scan images according to claim 1, characterized in that, The coarse segmentation probability map is encapsulated using a random field mask, including generating a refined segmentation probability map based on the coarse segmentation probability map and the preprocessed image through iterative inference using a random field. Morphological optimization is performed based on the segmentation and refinement probability map to obtain a binary mask for the welding area; The welding area binary mask is encapsulated to obtain the welding area mask.
5. The method for identifying welding defects based on CT scan images according to claim 1, characterized in that, Residual feature extraction is performed on the welding area mask, including: fine-tuning the initial feature extraction network based on the welding area mask through the residual network; Region slicing enhancement is performed based on the welding area mask and preprocessed image to obtain a defect candidate slice set; Deep feature extraction is performed on the defect candidate slice set and the initial feature extraction network to obtain a deep feature map set.
6. The welding defect image recognition method based on CT scan images according to claim 1, characterized in that, The process involves compression and encapsulation of the deep feature map set through transfer classification, including: supervised fine-tuning of the deep feature map set through transfer classification to generate a defect feature vector set. The global defect representation is aggregated based on the defect feature vector set to obtain the aggregated defect feature vector; The aggregated defect feature vector is compressed and encapsulated to obtain the defect feature vector.
7. The method for identifying welding defects based on CT scan images according to claim 1, characterized in that, The process involves dividing the defect based on its feature vector using a feature similarity threshold, including: constructing a defect relationship graph based on the feature vector and the welding area mask using feature similarity. Graph convolution processing is performed based on the defect relationship graph to obtain node-level classification probability and classification clarity. An adaptive threshold split is applied to the node-level classification probability and classification clarity to obtain the set of nodes that need correction and the set of nodes that can be directly passed.
8. The method for identifying welding defects based on CT scan images according to claim 1, characterized in that, Based on the results of the verification defect type identification, morphological defect assessment processing is performed, including: Based on the defect type identification results, morphological measurement processing is used to obtain defect quantification data; The severity level is obtained by processing the defect quantification data to obtain the defect severity level; Defect severity levels are assessed to generate defect assessment reports.
9. The method for identifying welding defects based on CT scan images according to claim 1, characterized in that, The defect assessment report will be evaluated and feedback will be processed, including: Based on the defect assessment report, model performance indicators are obtained through model evaluation and analysis. Bayesian hyperparameter processing is performed based on model performance metrics to obtain a set of tuning parameters. A feedback report is generated from the optimized parameter set to obtain the model feedback report.
10. The method for identifying welding defects based on CT scan images according to claim 1, characterized in that, The raw CT scan image includes one or more of the following: three-dimensional volume data, slice sequences, and scan metadata.