Method, product and equipment for detecting phased array welding defects based on improved Resnet

The defect recognition model constructed through the improved ResNet network solves the problems of accuracy and speed in phased array welding defect detection and achieves efficient recognition and classification of tiny defects.

CN120765599APending Publication Date: 2025-10-10TAIYUAN UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510893184.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

The existing technology in phased array welding defect detection has the problems of low detection accuracy and slow detection speed for small defects. Especially in multi-layer welded structures, the detection accuracy and speed are difficult to meet actual production needs.

Method used

An improved ResNet network is used to build a defect recognition model, including a backbone network, a neck network, and a head network. The feature extraction and classification capabilities are enhanced through the multi-expanded channel refined parallel patch-aware attention module (ECCR), the lightweight cross-attention residual module (LCRB), and the translation-variable convolution multi-frequency channel attention module (TVconv-CA).

Benefits of technology

It improves the ability to identify tiny defects and complex-shaped defects, enhances the model's adaptability to defects of different scales and types, improves detection accuracy and speed, and meets the needs of efficient detection in actual production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120765599A_ABST
    Figure CN120765599A_ABST
Patent Text Reader

Abstract

The invention relates to the field of welding quality detection, in particular to a phased array welding defect detection method based on improved Resnet, a product and equipment. The method comprises the following steps: firstly, acquiring an ultrasonic detection image of phased array welding quality, and adding label information representing defect types, so as to obtain a sample data set; then, constructing a defect identification model based on improved rednet; the defect identification model sequentially comprises a backbone network, a neck network and a head network; the backbone network comprises an Rsenet50 network and an ECCR module; the neck network comprises an LCRB module and a GAP module; and the head network sequentially comprises a TVconv-CA module and a classification head. And finally, training the defect identification model by using the sample data, retaining model parameters of the trained defect identification model, and performing defect identification on a new ultrasonic detection image by using the model parameters. According to the invention, the problems of low detection precision and low detection speed of small defects in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of welding quality detection, and in particular to a phased array welding defect detection method based on an improved Resnet, a corresponding computer program product, and a phased array ultrasonic detection device for welding quality. Background Art

[0002] As a core component of modern electronic equipment, the RF performance and structural reliability of the antenna arrays in phased array systems directly determine the performance and service life of the entire equipment. As phased array technology evolves toward higher frequencies (30GHz-300GHz) and higher densities, the integration level of single TR modules has surpassed 200 channels per square centimeter, and the array density of welded structures has been reduced from the traditional millimeter-level spacing to micrometers. This technological leap has expanded the types of weld defects from conventional macrocracks and weld offset to microscopic defects such as micropores, intergranular microcracks, and abnormal growth of intermetallic compounds (IMCs) at the interface. These defects generally have geometric dimensions less than 50 microns and exhibit three-dimensional distribution characteristics. For example, in millimeter-wave phased array systems, the spacing between microstrip line welds has been compressed to less than 0.1mm. Tiny bubbles (<10μm) left during the welding process can cause electromagnetic wave transmission phase distortion exceeding 3°, significantly affecting beamforming accuracy.

[0003] Phased Array Ultrasonic Testing (PAUT), a leading non-destructive flaw detection technology, electronically controls the excitation timing and phase differences of 32-128 ultrasonic elements, achieving dynamic focusing and beam deflection based on the principle of delayed superposition of acoustic waves. Compared to traditional single-element ultrasonic testing, this technology can improve the signal-to-noise ratio by over 15dB, making it particularly suitable for multi-angle scanning of irregularly shaped surfaces and composite materials. However, in practical engineering applications, the generated C-scan images still require manual grayscale contrast analysis and defect feature identification. Operators must be proficient in acoustic propagation theory (including acoustic impedance matching and attenuation coefficient calculation), electronic control system parameter optimization (such as aperture size and focal law setting), and time-domain and frequency-domain signal processing techniques (such as Hilbert transform and wavelet noise reduction). For example, when inspecting aluminum-steel dissimilar metal welds, operators must accurately distinguish between acoustic wave scattering in coarse-grained austenitic steel and true lack of fusion defects, which places a high demand on the experience of the inspector.

[0004] The limitations of manual interpretation further exacerbate the detection challenge. The C-scan image output by the PAUT system is essentially a projection mapping of acoustic energy in three-dimensional space, and its gray value has a complex nonlinear relationship with material acoustic impedance and defect geometry. Taking the detection of aluminum-titanium dissimilar metal diffusion welding as an example, the TiAl3 intermetallic compound formed at the welding interface can cause the acoustic reflection coefficient to rise by 1.5 times, resulting in a curve that is superimposed and coincides with the unmelted defect in the image. Due to the lack of understanding of the microstructure evolution law, the misjudgment rate of primary detection personnel is generally more than 35%. Even experienced engineers, when faced with dendritic segregation in high-frequency brazing of copper-ceramic substrates, still need to rely on time-consuming manual image filtering (such as adaptive median filtering) and feature separation algorithms, and the detection of a single component takes up to 2-3 hours. To address this issue, technicians introduced machine vision technology to assist in defect recognition. Although the introduction of machine vision technology partially alleviates the reliance on manual labor, it still faces principle bottlenecks in practical applications. The current mainstream target detection algorithms such as Faster R-CNN and Mask R-CNN lose sub-pixel level detail information during feature extraction using activation functions such as ReLU, which is particularly fatal when dealing with micron-level defects. Taking gold wire bonding detection as an example, when the wire diameter is reduced to 25 μm (corresponding to 5 pixels in a 200x optical image), the edge positioning error of existing algorithms is as high as ±3 pixels, which cannot meet the process requirement of "defect size < 10% of pad diameter" in IPC-6012 standard. More complex is that the mirror reflection characteristics of the metal surface will cause a number of differences in pixel gray value fluctuations due to small changes in lighting conditions (such as a 2° angle deviation), and this nonlinear noise makes the stable detection rate of traditional image segmentation algorithms (such as Otsu thresholding) on 304 stainless steel substrates less than 70%. In a certain repeatability test, the defect recognition consistency of the same welded sample under different lighting conditions was only 58.3%.

[0005] The feature shadowing effect raises new problems in the detection of multi-layer stacked structures, further highlighting the technical difficulties. When detecting a six-layer metallized via high-density interconnect substrate, the acoustic shadow of the upper layer of solder joints can reduce the signal-to-noise ratio of the lower layer defects by 12-15 dB. Although existing deep learning-based multi-scale fusion networks such as Feature Pyramid Network can improve the correlation of features across different levels, their ability to analyze longitudinal overlapping areas is still limited to the plane projection dimension. A comparative test showed that when detecting a 3-layer FR4 substrate embedded solder joint, the defect positioning accuracy of the U-Net network dropped from 92% for a single layer to 68%, and the number of artifacts increased by more than 3 times. This performance degradation directly affects the reliability of equipment packaging - the in-orbit failure analysis of a satellite phased array antenna showed that 36% of the failures were caused by hidden microcracks in multi-layer solder structures.

[0006] Furthermore, to ensure classification accuracy when using machine vision for defect detection, it is often necessary to build a micro-defect feature database containing millions of samples. Specifically, this must cover the defect morphology variation characteristics under different material combinations (such as copper-aluminum, steel-ceramic) and process parameters (laser power 0.8-4kW, welding speed 2-20mm / s). This is also difficult to implement in engineering. Summary of the Invention

[0007] In order to solve the problems of low detection accuracy and slow detection speed of tiny defects in the existing technology, the present invention provides a phased array welding defect detection method based on improved Resnet, and its corresponding computer program product and phased array ultrasonic detection equipment for welding quality.

[0008] The technical solutions provided by the present invention are as follows:

[0009] A phased array welding defect detection method based on an improved ResNet comprises:

[0010] Acquire phased array ultrasonic inspection images of welding quality, add label information representing the defect type to each image based on the inspection results to form sample images, and then obtain a sample dataset containing a large number of sample images.

[0011] A defect recognition model based on an improved ResNet was constructed. The defect recognition model consists of a backbone network, a neck network, and a head network. The backbone network consists of a Rsenet50 network for feature extraction from the input image and a multi-expansion channel refinement parallel patch-aware attention module (ECCR). The ECCR module is used to compress the spatial information of the feature map output by Rsenet50 through adaptive average pooling, dynamically generate channel attention weights in combination with learnable convolution kernels, and perform multi-scale feature fusion. The neck network consists of a cross-attention mechanism (LCRB) consisting of a RAB module and an LCA module, and a GAP module. LRCB implements basic denoising through the RAB module and enhances specified attributes in the feature information through the LCA module. The head network consists of a shifted variable convolution multi-frequency channel attention module (TVconv-CA) and a classification head consisting of a connection layer and a softmax activation function. TVconv-CA is used to perceive multiple frequency components and perform frequency-domain-spatial feature fusion. The classification head is used to generate classification results based on the output fused feature map.

[0012] The defect recognition model is trained using sample data, the model parameters of the trained defect recognition model are retained, and the model parameters are used to perform defect recognition on new ultrasonic detection images.

[0013] As a further improvement of the present invention, in the backbone network, the input image is first feature extracted using the Rsenet50 network. The ECCR module then splits the extracted feature map into four feature maps of equal size by channel, and performs dilated depthwise convolution on each of the four feature maps. After normalization and activation, point-by-point convolution is performed. The four feature maps are then concatenated in the channel dimension and again subjected to point-by-point convolution. Finally, after processing using the channel-space hybrid attention mechanism (CBAM), the resulting feature map is output to the neck network.

[0014] As a further improvement of the present invention, in the neck network, the cross-attention mechanism LCRB first captures the local details of the input features, suppresses noise and extracts the attention map through the RAB module, and then fuses the denoised features with the prior attributes through the LCA module to obtain the corresponding enhanced features. Among them, the LCA module is used to input the original input of the neck network and the attention map extracted by the RAB module into the FFN network. The output of the FFN network is residually connected with the output of the neck network and used as the input of the feedforward neural network GDFN. The input and output of GDFN are residually connected and then processed by the GAP module using average pooling to serve as the final output of the neck network.

[0015] As a further improvement of the present invention, in the RAB module, the input features are first processed in sequence by four convolutional layers; in each convolutional layer, the feature map is processed in sequence by the front convolution module, the ReLU activation function and the back convolution module. The input and output of each convolutional layer are residually connected, and the output of the first convolutional layer is residually connected with the output of the third convolutional layer. The output of the fourth convolutional layer is respectively passed through the global maximum pooling layer and the global average pooling layer before feature splicing. The spliced ​​feature map is processed by the convolution module, the ReLU activation function and the Sigmoid function to obtain an attention map. The attention map is multiplied pixel by pixel with the output of the fourth convolutional layer as the output of the RAB module.

[0016] As a further improvement of the present invention, the TVconv-CA module in the head network first extracts the frequency features of the feature map output by the neck network in the top, low, and bot frequency modes through 2D discrete cosine transform, and then generates the attention weight corresponding to each frequency feature through average pooling, maximum pooling, and minimum pooling respectively; then the attention weights of the average pooling, maximum pooling, and minimum pooling under the three frequencies are feature fused according to the pooling type; the three different types of pooled features after fusion are processed by two convolutional layers and then added pixel by pixel; the obtained feature map is processed by the sigmoid function and then multiplied pixel by pixel with the original input of the TVconv-CA module to obtain the fused feature.

[0017] The fusion features are unfolded by a TVConv module to obtain a spatial feature map by a convolution kernel sliding window, and the fusion features are position-mapped to obtain an affinity map; the affinity map is processed by a multi-layer convolution network to obtain corresponding attention weights, and the attention weights are pixel-by-pixel multiplied with the spatial feature map to obtain the final output of the TVconv-CA module.

[0018] As a further improvement of the application, the types of label information in the sample image include: pores, cracks, incomplete penetration, incomplete fusion, and non-hazardous defects.

[0019] As a further improvement of the application, in the training phase of the defect recognition model, the enhanced data set is divided into a training set, a test set and a validation set; the learning rate, the batch size and the training rounds are set, and the training set, the test set and the validation set are used to train, test and verify the defect recognition model; and the model parameters of the network model with the optimal performance after verification are retained.

[0020] As a further improvement of the application, a label smoothing loss Label Smoothing Loss is used as a loss function in the training phase.

[0021] As a further improvement of the application, one or more of top1 accuracy, top5 accuracy, Precision, Recall and F1 score are used as performance evaluation indexes in the verification phase.

[0022] As a further improvement of the application, the calculation formula of the label smoothing loss LS Loss is as follows:

[0023]

[0024] In the above formula, l i represents the label smoothing degree of the classification result of the i sample image, y i represents the classification result of the i sample image, target represents the true label; K represents the total number of categories; alpha is a preset hyperparameter, alpha <= 0.1.

[0025] The application also includes a computer program product comprising a computer program, which, when executed by a processor, implements the steps of the phased array welding defect detection method based on the improved Resnet as described above, and further outputs the types of welding defects contained in the input phased array welding quality ultrasonic detection image.

[0026] The present invention also includes a phased array ultrasonic welding quality inspection device, comprising a flaw detector and a data processing module; the flaw detector is used to perform ultrasonic flaw detection on the phased array weld and thereby obtain corresponding ultrasonic inspection images. The data processing module includes a memory, a processor, and a computer program stored in the memory and running on the processor. When executed by the processor, the computer program implements the steps of the aforementioned improved ResNet-based phased array welding defect detection method and outputs the type of welding defect contained in the ultrasonic inspection image of the phased array welding quality collected by the flaw detector.

[0027] The present invention has the following beneficial effects:

[0028] Based on ResNet50, the present invention introduces the multi-expansion channel refinement parallel patch perception attention module ECCR, the lightweight cross attention residual module LCRB and the translation variable convolution multi-frequency channel attention module TVconv-CA to construct a new defect recognition model. The modification of the present invention enhances the model's recognition ability for tiny defects and complex shape defects, and improves detection accuracy. This solution also enables the detection model to better utilize multi-scale features and background information, enhancing the model's adaptability to defects of different scales and types. In addition, the improved solution of the present invention can quickly process phased array welding defect images while ensuring detection accuracy, thereby improving detection speed and meeting the needs of efficient detection in actual production. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 This is a flowchart of the steps of the phased array welding defect detection method based on the improved Resnet provided in Example 1 of the present invention.

[0030] Figure 2 This is a network architecture diagram of the defect recognition model constructed in Example 1 of the present invention.

[0031] Figure 3 This is a schematic diagram of the ECCR module in the defect recognition model of Example 1 of the present invention.

[0032] Figure 4 This is a schematic diagram of the LCRB module in the defect recognition model of Example 1 of the present invention.

[0033] Figure 5 This is a schematic diagram of the TVconv-CA module in the defect recognition model of Example 1 of the present invention.

[0034] Figure 6 Typical cases of ultrasonic inspection images of five different types of welding defects in the verification experiment. DETAILED DESCRIPTION

[0035] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this invention pertains. The terms used herein in the specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "or / and" as used herein includes any and all combinations of one or more of the associated listed items.

[0037] Example 1

[0038] In the application of phased array ultrasonic detection of welding defects, accurate characterization of defect edges is an important basis for distinguishing defect morphology from normal tissue. The phased array system transmits and receives ultrasonic waves through multiple array elements in a coordinated manner. The phase difference and amplitude changes in its echo signal can reflect the subtle transition characteristics of the internal structure of the material. However, in complex weld environments, interference such as grain noise and structural clutter will cause the signal-to-noise ratio of the echo signal to decrease. Traditional denoising methods (such as filtering technology based on time domain thresholds) often rely too much on a single echo gradient parameter. In a strong noise background, random noise pulses are easily misjudged as valid edge signals, or the high-frequency components of the real defect edge are suppressed, resulting in the loss of detailed information of weld microcracks.

[0039] In order to solve the problems of the existing phased array welding defect recognition method based on machine vision technology, this embodiment provides a phased array welding defect detection method based on improved Resnet. This method builds a new classification network based on the Rsenet50 network, uses it as a defect recognition model, and uses this network model to identify the type of welding defects contained in the input ultrasonic inspection image. Specifically, Figure 1 As shown, the phased array welding defect recognition method based on machine vision technology provided in this embodiment includes the following steps:

[0040] 1. Dataset Preparation

[0041] To train the constructed defect recognition model, this example first acquires a large number of real phased array ultrasonic inspection images of weld quality. Based on the inspection results, each image is manually labeled with information representing the defect type to form sample images. This results in a sample dataset containing a large number of sample images. The label information in each sample image includes five types of defects: porosity, cracks, lack of penetration, lack of fusion, and non-hazardous defects.

[0042] 2. Building a Defect Recognition Model

[0043] Construct a defect recognition model based on an improved ResNet; the defect recognition model provided in this embodiment includes a backbone network, a neck network, and a head network. The backbone network is used to extract features from the input ultrasonic detection image to obtain multi-level feature information. The neck network is used to process the feature information extracted by the backbone network to achieve feature enhancement and feature fusion, allowing the network model to learn deep, multi-dimensional feature information. The head network is used to process the fused features output by the neck network to achieve defect type classification.

[0044] Specifically, if Figure 2 As shown, in the defect recognition model constructed in this embodiment, the backbone network includes, in sequence, a Rsenet50 network for feature extraction of the input image and a multi-expansion channel refinement parallel patch perception attention module ECCR. Among them, the ECCR module is used to compress the spatial information of the feature map output by Rsenet50 through adaptive average pooling, and then dynamically generate channel attention weights and perform multi-scale feature fusion in combination with the learnable convolution kernel. The neck network includes, in sequence, a cross attention mechanism LCRB composed of a RAB module and an LCA module, and a GAP module. Among them, the LRCB mechanism implements basic denoising through the RAB module and enhances the specified attributes in the feature information through the LCA module. The GAP model in this embodiment uses an average pooling operation to process the input features. The head network includes, in sequence, a translation variable convolution multi-frequency channel attention module TVconv-CA and a classification head composed of a connection layer and a softmax activation function. TVconv-CA is used to realize multi-frequency component perception and perform frequency domain-spatial feature fusion, and the classification head is used to generate classification results based on the output fusion feature map.

[0045] In order to make the principle and performance of the defect recognition model provided by this embodiment clearer, the ECCR module, LCRB mechanism and data processing process of the TVconv-CA module introduced in the backbone network, neck network and head network are respectively introduced in detail below.

[0046] 2.1. Multi-Extension Channel Refinement Parallel Patch-Aware Attention Module (ECCR)

[0047] In the backbone network provided in this embodiment, the Rsenet50 network is used to extract features from the input image to obtain the corresponding feature map. Figure 3As shown in the figure, the ECCR module is used to first split the feature map extracted by Rsenet50 into four feature maps of equal size by channel. Each of these feature maps is then subjected to dilated depthwise convolution. The features output by the dilated depthwise convolution are then normalized and activated before undergoing a first pointwise convolution. The four feature maps obtained from the pointwise convolution are then concatenated in the channel dimension and subjected to a second pointwise convolution. Finally, the resulting feature maps are processed by the channel-space hybrid attention mechanism (CBAM). The resulting backbone network extracts calibrated feature information and outputs it to the neck network.

[0048] During the aforementioned processing of the ECCR module provided in this embodiment, the backbone network compresses spatial information through adaptive average pooling, and combines learnable convolution kernels to dynamically generate channel attention weights for multi-scale feature fusion. This in turn strengthens important channels and suppresses redundant features, ultimately achieving channel-level feature calibration of the feature information extracted by the Rsenet50 network. This embodiment, through the synergistic effect of channel attention recalibration and multi-scale spatial feature extraction, effectively addresses the core difficulties of phased array welding defect detection, such as low signal-to-noise ratio and weak feature expression.

[0049] Specifically, in the backbone network, the original image is processed by ResNet-50 with random depth, and the extracted feature map is recorded as X, which is then split by channel to obtain the feature map X i , i = 1, 2, 3, 4. Then through the dilated depth convolution processing of the ECCR module, the expression of this process is:

[0050] X′ i =EDConv(X i )

[0051] In the above formula, EDConv() represents the dilated depth convolution operation; X′ i Indicates that the feature map on the first channel will be the result of the depthwise convolution process.

[0052] Next, each X′ i After performing point-by-point convolution within the group and then performing cross-group fusion point-by-point convolution, we get F P .

[0053]

[0054] In the above formula, PWConv() represents point-by-point convolution; represents batch normalization; δ represents activation function; Represents each feature X′ i Feature map after point-by-point convolution.

[0055] Then in the channel space mixed attention mechanism CBAM, FP The feature map F is obtained by the following processing E :

[0056]

[0057] In the above formula, Represents element-wise multiplication; M c represents the channel attention mechanism; M s represents the spatial attention mechanism; dropout represents the dropout layer, which is used to dynamically adjust the synergy between the scaling factor and multi-scale spatial feature extraction.

[0058] 2.2 Lightweight Cross-Attention Residual Module (LCRB)

[0059] In the neck network, the lightweight cross-attention residual module LCRB consists of a residual attention module RAB and a lightweight cross-attention module LCA. LCA is called at the end of the RAB module, which can be used to fuse the denoised features with external information to further improve image quality. The design of LCRB adopted in this embodiment can combine the advantages of both: on the one hand, the module is responsible for basic denoising of the feature map extracted by the backbone network, and on the other hand, LCA is used to enhance the specific attributes that are most critical for welding quality classification, thereby realizing end-to-end enhancement-denoising operations in the neck network.

[0060] like Figure 4 As shown, in the LCRB module provided in this embodiment, the RAB module is first used to capture the local details of the input features, suppress noise and extract the attention map, and then the denoised features and prior attributes are fused through the LCA module to obtain the corresponding enhanced features. Among them, the LCA module is used to input the original input of the neck network and the attention map extracted by the RAB module into the FFN network. The output of the FFN network is residually connected with the output of the neck network and used as the input of the feedforward neural network GDFN. The input and output of the GDFN are residually connected and then processed by the GAP module using average pooling as the final output of the neck network.

[0061] The RAB module in the LCRB module is a plug-and-play module that extracts rich local features through multi-hop connections, focuses on key areas by combining a spatial attention mechanism, and captures context information using global pooling to improve denoising efficiency. Specifically, in the RAB module, the input features are first processed through four convolutional layers in turn; in each convolutional layer, the feature map is processed in turn through a pre-convolution module, a ReLU activation function, and a post-convolution module. The input and output of each convolutional layer are connected in residual connection, and the output of the first convolutional layer is connected in residual connection with the output of the third convolutional layer. The output of the fourth convolutional layer is processed through a global maximum pooling layer and a global average pooling layer, respectively, and then the features are spliced. The feature map after splicing is processed through a convolution module, a ReLU activation function, and a Sigmoid function to obtain an attention map. The attention map is multiplied with the output of the fourth convolutional layer pixel by pixel to obtain the output of the RAB module.

[0062] Specifically, in the LCRB module, F E is processed through four residual blocks (convolutional layers containing residual connections), each of which includes multiple standard convolutions (Conv) and rectified linear units (ReLU). Rich local features are extracted through multiple skip connections between convolutional layers to generate F T . Then GAP and GMP are used to focus on features with more useful information and filter out features with insufficient information, and then a residual block is used to generate feature F A : F T and F A are fused by the following formula to obtain F B ;

[0063]

[0064] Finally, F B is processed through two kinds of feedforward neural networks ffn and gdfn and output.

[0065] 2.3, translation variable convolution multi-frequency channel attention module (TVconv-CA)

[0066] In the head network of the defect recognition model constructed in this embodiment, as shown in Figure 5As shown in the figure, the TVconv-CA module first extracts the frequency features of the feature map output by the neck network in the top, low, and bottom frequency modes through 2D discrete cosine transform. It then generates attention weights corresponding to each frequency feature through average pooling, maximum pooling, and minimum pooling, respectively. The attention weights of average pooling, maximum pooling, and minimum pooling at the three frequencies are then fused according to the pooling type. The three different types of fused pooled features are processed through two convolutional layers and then added pixel by pixel. The resulting feature map is processed with a sigmoid function and then multiplied pixel by pixel with the original input of the TVconv-CA module to obtain the fused feature.

[0067] In the TVconv-CA module of this embodiment, multi-frequency statistical features are extracted through 2D discrete cosine transform, and a channel attention map is generated to select three frequency modes: top, low, and bot. Since it can use multi-band feature fusion to generate attention weights, it dynamically enhances the frequency band features sensitive to defects and suppresses interference frequency bands for noise and defect features of different frequencies in the ultrasonic image. For example, it strengthens the low-frequency morphological features of cracks and weakens the high-frequency scattering noise caused by material anisotropy. It adapts to the distribution of welding defects at any position in the ultrasonic image and dynamically adjusts the convolution kernel weights to adapt to the sound wave propagation characteristics of different regions.

[0068] Next, the TVConv module expands the fused features using a sliding window of the convolution kernel to obtain a spatial feature map, and performs position mapping on the fused features to obtain an affinity map. The affinity map is processed through a multi-layer convolutional network to obtain the corresponding attention weights, which are multiplied pixel by pixel with the spatial feature map to obtain the final output of the TVconv-CA module. Based on the above process, the TVconv-CA module can form a "frequency domain-space" dual adaptation. The frequency domain attention first performs feature purification, and TVConv performs spatial adaptive convolution on this basis. In complex noise scenarios (such as coarse-grained materials), this solution can first suppress high-frequency noise and then perform spatial convolution to improve the signal-to-noise ratio in the image, which significantly enhances the network model's recognition rate for small defects (such as pores below 0.5mm).

[0069] Specifically, in the head network, the TVconv-CA module extracts the multi-frequency statistical features f(t,ξ,L) through 2D discrete cosine transform. The expression is as follows:

[0070]

[0071] In the above formula, t represents time; L is the length of the spatial dimension, and ξ is the frequency index.

[0072] Based on the above formula, the filter for frequency domain feature extraction constructed in this embodiment is The expression is as follows:

[0073]

[0074] In the above formula, C is the channel index, is the coordinate of the kth frequency component, H d ,W d Indicates the height and width of the window size.

[0075] The input features (denoted as Fm) of the TVconv-CA module are spatially downsampled and then subjected to multi-frequency feature extraction as follows:

[0076] X pool =AdaptiveAvgPool2d((H d ,W d ))(Fm)

[0077]

[0078] In the above formula, AdaptiveAvgPool2d represents adaptive average pooling processing; X pool Represents the features after adaptive average pooling; W k Indicates the features extracted from the frequency; K indicates the number of windows; FC indicates 2-layer convolution processing; GlobalMaxPool, GlobalAvgPool, and GlobalMinPool indicate maximum pooling, average pooling, and minimum pooling, respectively.

[0079] The different features extracted above are combined to obtain F M , and then perform translation variable convolution through TVConv. M Map by position and pass through multi-layer convolutional network to obtain weights and F M Multiply the feature maps after the convolution kernel window is expanded, and finally output the fused feature F.

[0080] F=TVConv(F M )

[0081] Finally, F is processed by the classification head to obtain the final classification result.

[0082] 3. Training and Application of Defect Recognition Model

[0083] This embodiment uses the sample data collected in step one to train the defect recognition model constructed in step two, retains the model parameters of the trained defect recognition model, and uses it to perform defect recognition on new ultrasonic detection images.

[0084] In the training phase of the defect recognition model, the enhanced sample data set is divided into a training set, a test set and a validation set according to a ratio of 6:2:2. Then, a learning rate, a batch size, and a training round are set, and the training set, the test set and the validation set are used to train, test and validate the defect recognition model. Finally, the model parameters of the network model with the optimal performance after validation are reserved.

[0085] In this embodiment, the label smoothing loss is used as the loss function in the training phase. The calculation formula of the label smoothing loss is as follows:

[0086]

[0087] In the above formula, l i represents the label smoothing degree of the classification result of the i-th sample image, y i represents the classification result of the i-th sample image, target represents the true label; K represents the total number of categories; and a is a preset hyperparameter, a≤0.1.

[0088] In the validation phase, one or more of top1 accuracy, top5 accuracy, Precision, Recall and F1 score are used as performance evaluation indexes.

[0089] In the image classification task, top1 accuracy and top5 accuracy are two key indexes for evaluating the performance of the model, and are widely used in multi-class classification (such as 1000 categories of ImageNet). Top1 accuracy refers to the accuracy rate of the first ranked category being consistent with the actual result, and top5 accuracy refers to the accuracy rate of the top five categories containing the actual result. The calculation formulas of top1 accuracy and top5 accuracy are as follows:

[0090]

[0091]

[0092] Precision measures the proportion of samples that the model predicts to be a certain category actually belong to the category. The core idea of Precision is to evaluate the prediction accuracy of the model, that is, how confident the model is when it determines that a sample belongs to the positive class. Precision reflects the rigor of the model when predicting the positive class. High precision means that the prediction result of the model on the positive class is highly reliable and the misjudgment rate is low. The calculation formula of Precision is as follows:

[0093]

[0094] In the above formula, TP (True Positive) represents the number of samples correctly predicted as positive, and FP (False Positive) represents the number of samples incorrectly predicted as positive (actually negative, but mistakenly classified as positive)

[0095] Recall measures the proportion of samples that actually belong to a certain category that are correctly identified by the model. Its core purpose is to assess the model's "coverage"—that is, whether the model can find all true positive samples as much as possible. Recall focuses on the model's sensitivity to positive samples. A high recall rate means that the model can effectively capture positive samples and avoid missing them. Its calculation formula is as follows:

[0096]

[0097] In the above formula, FN (False Negative) represents the number of samples that actually belong to the positive class but are mistakenly classified into other categories by the model.

[0098] The F1 score is the harmonic mean of precision and recall, used to comprehensively assess the balance between the two. Its core concept is to avoid extremes in a single metric (such as precision or recall) and reflect the overall performance of the model. The F1 score seeks a balance between precision and recall. Because the harmonic mean is sensitive to extreme values, the F1 score is high only when both precision and recall are high. Its calculation formula is as follows:

[0099]

[0100] Example 2

[0101] In order to better apply the phased array welding defect detection method based on the improved Resnet provided in Example 1, this embodiment further provides a computer program product, a storage medium, and a corresponding computer device capable of implementing the above method.

[0102] Specifically, this embodiment provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the phased array welding defect detection method based on the improved Resnet as in Example 1, and then outputs the type of welding defects contained in the input phased array welding quality ultrasonic detection image.

[0103] This embodiment also provides a storage medium storing a computer program. When the computer program is executed by a processor, the steps of the phased array welding defect detection method based on the improved Resnet as described in Example 1 are implemented, and the type of welding defects contained in the input ultrasonic detection image of the phased array welding quality is output.

[0104] The embodiment also provides an ultrasonic detection device for phased array welding quality, which comprises a flaw detection instrument and a data processing module; the flaw detection instrument is used for ultrasonic detection of a weld of the phased array, so as to obtain a corresponding ultrasonic detection image. The data processing module comprises a memory, a processor, and a computer program stored in the memory and running on the processor, and when the computer program is executed by the processor, the steps of the phased array welding defect detection method based on the improved Resnet in the embodiment 1 are implemented, and then the type of the welding defect contained in the ultrasonic detection image of the phased array welding quality collected by the flaw detection instrument is output.

[0105] In the ultrasonic detection device, the data processing module is essentially a computer device, which can be an embedded device and deployed in the flaw detection instrument to support data processing and interaction. It can also be used as a stand-alone computer device to support data processing requirements in some scenarios. The non-embedded computer device can be a notebook computer, a tablet computer, a desktop computer, or a medium or large computer device such as a rack server, a blade server, a tower server, or a cabinet server (including a stand-alone server or a server cluster composed of multiple servers).

[0106] Specifically, the computer device of the embodiment at least includes but is not limited to a memory and a processor which can be connected to each other for communication through a system bus. In the embodiment, the memory (i.e. a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory can be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Of course, the memory can include both the internal storage unit and the external storage device of the computer device. In the embodiment, the memory is usually used to store the operating system and various application software installed on the computer device, etc. In addition, the memory can also be used to temporarily store various data that have been output or will be output.

[0107] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is generally used to control the overall operation of a computer device.

[0108] Performance Testing

[0109] In order to verify the performance of the phased array welding defect detection method based on the improved ResNet provided by the present invention, the contribution of the multi-expanded channel refinement parallel patch-aware attention module (ECCR), lightweight cross-attention residual module (LCRB) and translation-variable convolution multi-frequency channel attention module (TVconv-CA) used in the designed defect recognition model to the model performance was tested. A hierarchical ablation experiment was designed based on the ResNet50 benchmark architecture.

[0110] The experiment adopts the control variable method, constructs four sets of comparison models by combining the module enable states ("√" indicates activation of the module), and performs end-to-end training on the phased array welding defect dataset. The typical ultrasonic detection images of the five types of defects in the dataset are as follows: Figure 6 As shown, all experiments maintain the same hyperparameter settings (learning rate = 1e-4, batch_size = 64, and iteration number 600 epochs) to ensure comparability of results. The performance of the four solutions on the dataset is shown in the following table:

[0111] Table 1: Results of ablation experiments using the present invention

[0112]

[0113] Analysis of the data in the table above reveals that when the TVconv-CA module is introduced alone, the Top 1 accuracy improves by 0.2273 percentage points compared to the baseline, reaching 80.2273%. This demonstrates that the module effectively enhances the model's perception of local details through multi-frequency feature fusion and spatially adaptive convolution. Adding the ECCR module significantly increases the accuracy by 3.6363 percentage points to 83.8636%, thanks to the dynamic capture of global context by the parallel patch-aware mechanism and the optimization of feature resolution by the dilated channel refinement strategy. Finally, when all three modules are used together, the model achieves a Top 1 accuracy of 85.4546%, a 5.4546 percentage point improvement over the baseline. This demonstrates the synergistic effect of hierarchical feature enhancement between the modules: TVconv-CA focuses on high-frequency details, ECCR strengthens semantic associations, and LCRB achieves a balance between computational efficiency and representational depth through cross-modal attention residual connections.

[0114] Precision increased stepwise from a baseline of 82.8425% to 88.2731%, demonstrating that the model significantly reduced the false positive rate while maintaining a high recall rate. This is attributed to the ECCR module's channel-wise attention recalibration mechanism, which enables the model to accurately lock on discriminative features despite complex background interference.

[0115] The recall rate increased from 75.6083% to 79.4591%, indicating that the translation-invariant convolution kernel and multi-scale frequency domain decomposition strategy of the TVconv-CA module effectively alleviated the problem of feature loss caused by target deformation and local occlusion, and reduced false negative misjudgments.

[0116] The F1-score increased from 78.0388% to 82.7107%, a greater increase than that achieved by any single metric, demonstrating that the module combination achieves a Pareto improvement on the precision-recall trade-off curve. This increase indicates that the model achieves a better balance between precision and recall, resulting in better overall performance. This indicates that the model reduces false positives while minimizing missed positives, improving overall generalization capabilities.

[0117] In summary, the data from the ablation experiments verify the innovative advantages of the solution of the present invention in terms of lightweight, multi-granularity feature fusion, and computational efficiency, and provide a new technical path for the design of model architectures for complex visual tasks.

[0118] The above-described embodiment merely represents one embodiment of the present invention. While the description is relatively specific and detailed, it should not be construed as limiting the scope of the invention. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, and these modifications and improvements fall within the scope of the present invention. Therefore, the scope of the present invention shall be determined by the appended claims.

Claims

1. A phased array welding defect detection method based on improved Resnet, characterized in that: It includes: Acquire phased array ultrasonic inspection images of welding quality, add label information representing the defect type to each image based on the inspection results to form sample images, and then obtain a sample dataset containing a large number of sample images; Build a defect recognition model based on the improved ResNet. The defect recognition model consists of a backbone network, a neck network, and a head network. The backbone network consists of a Rsenet50 network for feature extraction of input images and a multi-expansion channel refinement parallel patch perception attention module (ECCR). ECCR is used to compress the spatial information of the feature map output by Rsenet50 through adaptive average pooling, and dynamically generates channel attention weights and performs multi-scale feature fusion in combination with learnable convolution kernels; the neck network sequentially includes a cross-attention mechanism LCRB consisting of a RAB module and an LCA module, and a GAP module; LRCB implements basic denoising through the RAB module and enhances specified attributes in the feature information through the LCA module; the head network sequentially includes a translation variable convolution multi-frequency channel attention module TVconv-CA and a classification head consisting of a connection layer and a softmax activation function; TVconv-CA is used to realize multi-frequency component perception and perform frequency-domain-spatial feature fusion. The classification head is used to generate classification results based on the output fusion feature map. The defect recognition model is trained using sample data, the model parameters of the trained defect recognition model are retained, and the model parameters are used to perform defect recognition on new ultrasonic detection images.

2. The improved Resnet-based phased array welding defect detection method according to claim 1, characterized in that: In the backbone network, the input image is first feature extracted through the Rsenet50 network. The ECCR module divides the extracted feature map into four feature maps of the same size by channel, and performs dilated depth convolution on the four feature maps respectively. After normalization and activation function, point-by-point convolution is performed. The four feature maps are spliced ​​in the channel dimension and then point-by-point convolution is performed again. Finally, after processing by the channel space hybrid attention mechanism CBAM, the obtained feature map is output to the neck network.

3. The improved Resnet-based phased array welding defect detection method according to claim 1, characterized in that: In the neck network, the cross-attention mechanism LCRB first captures the local details of the input features, suppresses noise and extracts the attention map through the RAB module, and then fuses the denoised features with the prior attributes through the LCA module to obtain the corresponding enhanced features; among them, the LCA module is used to input the original input of the neck network and the attention map extracted by the RAB module into the FFN network. The output of the FFN network is residually connected with the output of the neck network and used as the input of the feedforward neural network GDFN. The input and output of the GDFN are residually connected and then processed by the GAP module with average pooling as the final output of the neck network.

4. The improved Resnet-based phased array welding defect detection method according to claim 3, characterized in that: In the RAB module, the input features are first processed in sequence by four convolutional layers. In each convolutional layer, the feature map is processed in sequence by the front convolution module, ReLU activation function and post convolution module; the input and output of each convolution layer are residually connected, and the output of the first convolution layer is residually connected with the output of the third convolution layer; the output of the fourth convolution layer is respectively passed through the global maximum pooling layer and the global average pooling layer for feature splicing, and the spliced ​​feature map is processed by the convolution module, ReLU activation function and Sigmoid function to obtain an attention map, which is multiplied pixel by pixel with the output of the fourth convolution layer as the output of the RAB module.

5. The phased array welding defect detection method based on improved ResNet according to claim 1, characterized in that: The TVconv-CA module in the head network first extracts the frequency features of the feature map output by the neck network in the top, low, and bottom frequency modes through 2D discrete cosine transform. It then generates the attention weight corresponding to each frequency feature through average pooling, maximum pooling, and minimum pooling respectively. The attention weights of average pooling, maximum pooling, and minimum pooling at the three frequencies are fused according to the pooling type. The fused three different types of pooled features are processed through two convolutional layers and then added pixel by pixel. The obtained feature map is processed by the sigmoid function and then multiplied pixel by pixel with the original input of the TVconv-CA module to obtain the fused feature; The TVConv module expands the fused features according to the convolution kernel sliding window to obtain a spatial feature map, and performs position mapping on the fused features to obtain an affinity map. The affinity map is processed by a multi-layer convolutional network to obtain the corresponding attention weight, and the attention weight is multiplied pixel by pixel with the spatial feature map to obtain the final output of the TVconv-CA module.

6. The phased array welding defect detection method based on improved ResNet according to claim 1, characterized in that: The types of label information in the sample images include: pores, cracks, incomplete penetration, lack of fusion, and non-hazardous defects.

7. The phased array welding defect detection method based on improved Resnet according to claim 1, characterized in that: During the training phase of the defect recognition model, the sample data set is divided into a training set, a test set, and a validation set; Setting the learning rate, batch size, and training rounds, and using the training set, test set, and validation set to train, test, and validate the defect recognition model; and retaining the model parameters of the verified network model with the best performance; and / or During the training phase, label smoothing loss is used as the loss function; and / or In the verification phase, one or more of top1accuracy, top5 accuracy, Precision, Recall, and F1 score are used as performance evaluation indicators.

8. The phased array welding defect detection method based on improved Resnet according to claim 7, characterized in that: The calculation formula of the label smoothness loss LS Loss is as follows: In the above formula, l i Indicates the label smoothness of the classification results of i sample images, y i represents the classification result of the i-th sample image, and target represents the true label; K represents the total number of categories; α is a preset hyperparameter, α≤0.

1.

9. A computer program product comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps of the phased array welding defect detection method based on the improved Resnet as described in any one of claims 1 to 8 are implemented, and the type of welding defects contained in the input phased array welding quality ultrasonic detection image is output.

10. A phased array ultrasonic testing device for welding quality, comprising a flaw detector and a data processing module; characterized in that: The flaw detection instrument is used to perform ultrasonic flaw detection on phased array welds, thereby obtaining corresponding ultrasonic detection images; the data processing module includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the computer program is executed by the processor, the steps of the phased array welding defect detection method based on the improved Resnet as described in any one of claims 1 to 8 are implemented, and the type of welding defects contained in the ultrasonic detection image of the phased array welding quality collected by the flaw detection instrument is output.