Image defect segmentation method and system based on frequency domain feature enhancement and multi-scale perception

By constructing a defect segmentation network based on an encoding and decoding architecture, and combining global spatial perception and wavelet domain feature aggregation, the problem of difficult segmentation of weak defects and multi-scale boundaries in industrial X-ray images was solved, achieving high-precision defect segmentation results.

CN123032986APending Publication Date: 2026-11-03NANCHANG HANGKONG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611517929.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately distinguish weak defects and fine-grained information in complex backgrounds during defect segmentation of industrial X-ray images, leading to missed segmentation of small defects, boundary offsets, and local missegmentation, and failing to provide stable boundary criteria.

Method used

An image defect segmentation method based on frequency domain feature enhancement and multi-scale perception is adopted. By constructing a defect segmentation network based on an encoding and decoding architecture, and combining a global spatial perception module, a multi-scale perception decoding module, and a wavelet domain feature aggregation module, multi-level features are extracted and adaptively enhanced and interacted to achieve global context capture and local boundary detail extraction.

Benefits of technology

It improves the ability to represent weak defects and fuzzy boundaries, solves the problem of inaccurate feature representation in complex backgrounds by traditional methods, and improves the stability and accuracy of defect segmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123032986A_ABST
    Figure CN123032986A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image detection, and specifically discloses a kind of image defect segmentation method and system of frequency domain feature enhancement and multiscale perception, method includes the following steps: acquisition digital ray original image and carries out pixel level annotation, constructs X ray image defect segmentation dataset;Defect segmentation network based on coding and decoding architecture is constructed;Multiple cascaded convolution modules are set in the encoding end;Global spatial perception module is integrated in the network neck portion, and global spatial perception module is connected with the highest level convolution module;Wavelet domain feature aggregation module is introduced in the jump connection path;Multiple cascaded multiscale perception decoding modules are embedded in the decoding end;X ray image defect segmentation dataset is used to train defect segmentation network;Based on the trained defect segmentation network, the input digital ray image is segmented, and the defect segmentation mask is output.The present application can improve weak defect characterization ability, and accurately depict multiscale defect boundary.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image detection technology, and more specifically to an image defect segmentation method and system that combines frequency domain feature enhancement and multi-scale perception. Background Technology

[0002] Digital radiography (DR) technology, as one of the core methods of industrial nondestructive testing, is widely used in key fields such as welding, aerospace, nuclear industry, and special equipment. Its core value lies in intuitively presenting the morphology, size, and distribution of internal defects in structural components, providing important technical support for structural safety assurance and quality traceability. However, due to the combined effects of varying workpiece thickness, scattered radiation interference, and detector performance, the acquired radiographic images generally suffer from low contrast, large differences in defect scale, and blurred boundaries. This makes traditional manual defect assessment heavily reliant on human experience, susceptible to subjective judgment and fatigue, resulting in low assessment efficiency, poor stability, and a tendency to miss small-scale defects and deviate from boundary segmentation. Therefore, for practical industrial radiographic testing scenarios, developing efficient intelligent defect segmentation technology to achieve automatic defect extraction and category discrimination, while considering both global context modeling and fine local boundary extraction in complex backgrounds, has become a core element in promoting intelligent assessment of radiographic images.

[0003] Currently, X-ray image defect segmentation mainly follows two technical paths: one is the traditional segmentation method based on image processing and mathematical models, and the other is the deep learning method that relies on big data to learn feature representations. Traditional methods focus on explicit grayscale feature analysis and region evolution, leading to various strategies based on thresholding, edge detection, region growing, graph theory algorithms, energy functional optimization, and machine learning. While effective in simple scenarios, these methods heavily rely on human experience and prior assumptions, requiring manual adjustment of numerous parameters. When faced with low contrast, strong noise, strong pseudo-defect interference, or complex defects such as large-scale differences and irregular boundaries in real industrial scenarios, their performance significantly degrades. They fail to accurately represent subtle differences between defects and the background, easily resulting in over-segmentation, boundary shifts, or missed segmentation of small targets, limiting their stable application.

[0004] With the accumulation of defect datasets and the improvement of computing hardware performance, semantic segmentation technology based on deep learning has experienced rapid development and has become a hot research direction in intelligent assessment of X-ray images. Existing research has proposed a variety of defect segmentation schemes based on architectures such as CNN (Convolutional Neural Network) and Transformer. By introducing techniques such as multi-scale feature fusion, dilated convolution, attention mechanisms, and adaptive feature learning, significant progress has been made in improving segmentation accuracy and suppressing background redundancy, fully demonstrating the huge application potential of pixel-level classification. However, these methods still fail to completely solve the core pain points of insufficient representation of low-contrast weak defects and difficulty in restoring multi-scale boundaries under complex imaging conditions.

[0005] Although deep learning segmentation algorithms have overcome some limitations of traditional methods, they still have significant shortcomings in industrial X-ray image defect segmentation scenarios: existing models are prone to fine-grained feature loss during continuous downsampling and feature transfer, and have limited ability to preserve fine-grained defect information in complex backgrounds. This makes it difficult for networks to accurately distinguish between strong pseudo-defect interference and minute defect details when processing images with weak defect responses, large scale differences, and irregular boundaries, easily leading to missed segmentation of small defects, boundary offsets, and local missegmentation. Ultimately, this results in insufficient key indicators such as average intersection-over-union ratio and average pixel accuracy, failing to provide rigorous and stable boundary criteria for subsequent accurate defect identification, size measurement, and quantitative evaluation.

[0006] Therefore, how to improve the ability to characterize weak defects and accurately depict the boundaries of multi-scale defects is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0007] In view of the above problems, the present invention proposes an image defect segmentation method and system with frequency domain feature enhancement and multi-scale perception, so as to overcome the above problems or at least partially solve the above problems.

[0008] To achieve the above objectives, the present invention adopts the following technical solution:

[0009] In a first aspect, the present invention provides an image defect segmentation method with frequency domain feature enhancement and multi-scale perception, comprising the following steps: S1. Acquire raw digital X-ray images and perform pixel-level annotations to construct an X-ray image defect segmentation dataset; S2. Construct a defect segmentation network based on an encoding / decoding architecture; set up multiple cascaded convolutional modules at the encoding end; integrate a global spatial awareness module at the network neck, and connect the global spatial awareness module to the highest-level convolutional module; introduce a wavelet domain feature aggregation module in the skip connection path; embed multiple cascaded multi-scale sensing decoding modules at the decoding end; S3. Train the defect segmentation network using the X-ray image defect segmentation dataset; S4. Segment the input digital ray image based on the trained defect segmentation network and output a defect segmentation mask; wherein, the process of segmenting the input digital ray image includes: Multi-level features from shallow to deep are extracted from digital ray images using multiple cascaded convolutional modules; The global spatial awareness module models long-range dependencies of the highest-level features and outputs the highest-level global spatial awareness features. The wavelet domain feature aggregation module performs sub-band information interaction and feature adaptive enhancement of the highest-level global spatial perception features and other level features in the wavelet domain, and inputs the enhanced features of each level in parallel to the corresponding multi-scale perception decoding module at the decoding end. The multi-scale perceptual decoding module performs global context capture and local boundary detail extraction on the input features, and outputs the final defect segmentation mask.

[0010] Furthermore, in S1, the image categories of the digital radiography raw images include weld DR images, equipment microfocus high-resolution DR weld images, and film digitized weld images, and the defect categories include porosity, inclusions, cracks, incomplete penetration, and lack of fusion.

[0011] Furthermore, five cascaded convolutional modules are set up at the encoding end; the processing flow of each convolutional module for the input features includes: Channel expansion of the original input features is performed using 1×1 up-dimensional convolution; Depth-separable convolution is used to extract local contextual features from channel-expanded features in the spatial dimension; The local context features extracted from each channel are adaptively recalibrated using a channel attention mechanism to obtain attention output features; The attention output features are compressed by 1×1 dimensionality reduction convolution, and residual connections are used to add the compressed features to the original input features element by element to output the corresponding hierarchical features.

[0012] Furthermore, two wavelet domain feature aggregation modules are set in the skip connection path. The highest-level global spatial perception features output by the global spatial perception module are fused with the hierarchical features output by the fourth-level convolution module and input together into the first-level wavelet domain feature aggregation module. The output features of the first-layer wavelet domain feature aggregation module are upsampled and then fused with the hierarchical features output by the third-layer convolution module, and then input together into the second-layer wavelet domain feature aggregation module. The output features of the first-level wavelet domain feature aggregation module are also concatenated with the highest-level global spatial perception features output by the global spatial perception module, and then input to the highest-level multi-scale perception decoding module at the decoding end. The output features of the highest-level multi-scale sensing decoding module at the decoding end are upsampled and then concatenated with the output features of the second-level wavelet domain feature aggregation module. The concatenated features are then input into the next-lowest level multi-scale sensing decoding module at the decoding end. The layer features output by the convolutional modules of the remaining layers at the encoding end are input one-to-one to the multi-scale perceptual decoding module of the corresponding layer at the decoding end.

[0013] Furthermore, the wavelet domain feature aggregation module includes a learnable wavelet module, a squeezed channel attention module, and a gated depth convolution feedforward module; The learningable wavelet module's processing of input features includes: For input features After layer normalization, the input is fed into four sets of two-dimensional wavelet kernels constructed based on high-frequency and low-frequency filters for discrete wavelet transform convolution. The four sets of sub-band information—low frequency, horizontal high frequency, vertical high frequency, and diagonal high frequency—are then extracted and spliced ​​along the channel dimension. The concatenated features are sequentially processed through 1×1 convolution, 7×7 depthwise convolution, GELU activation function and 1×1 convolution to achieve feature interaction within the sub-band domain; In the channel dimension, the features after feature interaction within the sub-band domain are decomposed into four updated sub-band features. A learnable transpose convolution, dual to the discrete wavelet transform, is then applied to these four updated sub-band features to perform an inverse discrete wavelet transform, reconstructing the features. ; The squeezed channel attention module can learn the reconstructed features output by the wavelet module. As input, the reconstructed features Perform global average pooling and generate channel weights via 1×1 convolution, then combine them with the input reconstructed features. Channel-by-channel multiplication, followed by 1×1 convolution, and then combined with the input features of the learnable wavelet module. By summing the residuals, we obtain the characteristic. ; The gated depthwise convolutional feedforward module extracts the features from the squeezed channel attention module. After layer normalization, 1×1 convolution, and 3×3 depthwise convolution, the system is divided into two branches along the channel dimension. One branch is activated by the GELU function and then multiplied element-wise with the other branch to form a gating mechanism. This gating mechanism is then convolved with the features by a 1×1 convolution. The residuals are summed to obtain the final output of the wavelet domain feature aggregation module. .

[0014] Furthermore, the global spatial perception module's processing flow for the highest-level features includes a spatial blending stage and a channel blending stage. The spatial mixing phase includes: The output features of the highest-level convolutional module are used as the input features of the global spatial awareness module. Input features Expand into sequence features sequence features After layer normalization, the spatial feature map is restored. ; Spatial feature map Perform a four-way unit pixel displacement operation, and compare the displacement features with the spatial feature map. Adaptive fusion based on learnable coefficients; The fused features are passed through three independent linear mapping layers to generate a receiver vector, a key vector, and a value vector, respectively. The receiver vector is processed by the Sigmoid activation function to obtain spatial attention weights, and the key vector and value vector are subjected to bidirectional global context interaction. The output after bidirectional global context interaction is normalized by layers, then adaptively multiplied with the spatial attention weights channel by channel, and finally passed through a linear mapping layer to obtain the spatial mixing sequence. Spatial mixing sequence With sequence features Residual connections yield spatial blending enhancement sequences. ; The channel mixing stage includes: Spatial mixing enhances sequences Perform layer normalization; The features after layer normalization are subjected to a four-way unit pixel displacement operation, and the features after displacement are adaptively fused with the features before displacement. The fused features are passed through two independent linear mapping layers to generate a modulation receive vector and a transform key vector, respectively. The modulation receive vector is then processed by a Sigmoid activation function to generate channel gating weights. The key vector is then passed through a SquaredReLU activation function, layer normalization, and a linear mapping layer, and finally multiplied element-wise with the channel gating weights and passed through another linear mapping layer to obtain the channel mixing sequence. ; Channel mixing sequence Spatial mixing enhancement sequence with input Perform residual connections and restore the output to a two-dimensional spatial feature map.

[0015] Furthermore, the four-way unit pixel displacement operation includes: Spatial feature map The channel is divided into four sub-blocks, and each of these four sub-blocks is shifted by a unit pixel along the left, right, down, and up directions.

[0016] Furthermore, the multi-scale perception decoding module includes an input 1×1 convolutional layer, a dynamic multi-scale perception layer, a channel attention layer, and an output 1×1 convolutional layer; the dynamic multi-scale perception layer includes a large kernel perception unit and a small kernel aggregation unit; The multi-scale perceptual decoding module's processing flow for input features includes: Let the input features of the multi-scale sensing decoding module be... The input features are processed through a 1×1 convolutional layer. After channel expansion, the features are obtained. ; The dynamic multi-scale perception layer will feature Parallel splitting is performed to obtain two feature streams. and One of the characteristics Input to the large kernel perceptron, within the large kernel perceptron, features After sequentially applying 1×1 convolution and 7×7 depthwise separable convolution, local perceptual features are obtained. ; local perception features Input two 1×1 convolutional layers for feature mapping, and then pass the rearrangement operator. The feature dimension is reshaped by expanding the channel dimension into convolutional kernel parameters of corresponding spatial dimensions, generating context aggregation weights. ; Another feature As a baseline feature, it is aggregated with context weights. Common input is the small kernel aggregation unit; within the small kernel aggregation unit, weights are aggregated based on context. Features Small-scale convolutional aggregation interaction is performed in a 3×3 spatial neighborhood; the features after small-scale convolutional aggregation interaction are batch normalized and then compared with the features. The output features are obtained by summing the element-wise residuals. ; Output features are calculated through the channel attention layer. The channel attention weights are applied and the channel responses are adaptively recalibrated. Then, the output 1×1 convolutional layer compresses the channels to the target dimension before outputting.

[0017] Furthermore, in large-kernel sensing units, local sensing features The generation process includes: For any spatial location in the feature map The corresponding feature token is represented as ,set up For Within a 7×7 neighborhood centered on the token, spatial awareness and neighborhood context fusion are performed on each token. The features of each location are encoded as spatial structure information of the surrounding 7×7 range, serving as local perception features. ; In the small-core aggregation unit, aggregation weights are based on context. Features The process of small-scale convolutional aggregation interaction in a 3×3 spatial neighborhood includes: Input features Divided into G groups according to channels, for any spatial location The token is also divided into Group G. Take the first Group in position vector In vector 3×3 neighborhood Internal utilization weight Perform convolutional aggregation to obtain the aggregation result. Among them, the context aggregation weights are... Divide the data into G groups along the output channel dimension, and then divide the data into weight subsets from the g-th group. Extracting spatial location The 3×3 local weight matrix formed by the corresponding 9 weight coefficients serves as the weight. ; Input features After performing convolutional aggregation on all spatial locations, the g-th group of output features is obtained. ; The output features of each group are concatenated along the channel dimension to obtain the aggregated output.

[0018] Secondly, the present invention provides an image defect segmentation system with frequency domain feature enhancement and multi-scale perception, comprising: The image acquisition module is used to acquire the digital ray image to be segmented; The defect segmentation module is used to segment digital ray images using the pre-trained defect segmentation network described above, and outputs a defect segmentation mask.

[0019] As can be seen from the above technical solution, compared with the prior art, the present invention has the following beneficial effects: 1. This invention addresses the common technical challenges of weak defect response, such as low contrast, large scale differences, and blurred boundaries, in practical industrial X-ray inspection scenarios. It proposes a defect segmentation network capable of multi-scale feature encoding, wavelet domain feature aggregation, global context modeling, and multi-scale perceptual decoding of input X-ray images. The wavelet domain feature aggregation module comprehensively enhances the network's ability to represent weak defect structures and blurred boundaries. The global spatial perception module performs global context modeling, solving the problems of insufficient long-range correlation representation and complex background interference in traditional convolutional methods. This effectively overcomes the core technical bottlenecks of insufficient weak defect representation and inaccurate multi-scale defect boundary characterization.

[0020] 2. To address the problems of existing methods incompletely capturing multi-scale defect features and the difficulty in effectively combining deep semantics and shallow texture features, this invention extracts multi-scale features from shallow to deep using multiple cascaded convolutional modules, laying the foundation for high-precision defect segmentation feature representation. While effectively expanding the feature dimensions, the multiple cascaded convolutional modules can highlight effective defect features and suppress redundant background interference, outputting multi-scale feature representations from shallow texture to deep semantics, effectively solving the technical problem of inaccurate feature representation.

[0021] 3. To address the problem of extremely low response and blurred edges of weak defects in complex industrial environments, leading to difficulties in multi-scale boundary recovery, this invention introduces a wavelet domain feature aggregation module in the cross-layer jump path. This module maps input features to the wavelet domain and decomposes them into four sub-band information groups: low frequency, horizontal high frequency, vertical high frequency, and diagonal high frequency. It achieves strong feature interaction and adaptive recalibration within the sub-band domain at the channel dimension, and realizes high-precision sub-band information fusion and reconstruction based on inverse discrete wavelet transform. Utilizing the excellent frequency decomposition and direction representation capabilities of wavelet transform, it adaptively enhances the effective weak defect structural response and suppresses redundant noise, directly overcoming the pain point of insufficient blurred edge representation capability.

[0022] 4. To address the shortcomings of traditional convolutional neural networks in representing long-range dependencies due to limited local receptive fields, which makes it difficult to accurately distinguish between strong pseudo-defect interference and minute defect details in complex backgrounds, this invention integrates a global spatial awareness module at the network neck. This module, by performing spatial blending and channel blending stages, successfully overcomes the limitations of traditional convolution, efficiently achieving global spatial information interaction and significantly improving the network's ability to model long-range dependencies and perceive structures in complex backgrounds.

[0023] 5. To address the issues of network loss of minute defect details and difficulty in accurately characterizing irregularly shaped defects during continuous feature recovery and scale transformation, this invention embeds multi-scale perceptual decoding modules at each stage of the decoding process. This module integrates a large-kernel perceptual unit and a small-kernel aggregation unit in parallel within an inverted bottleneck framework. The large-kernel perceptual unit captures the macroscopic contextual structure information of the defect region and generates aggregation weights through 7×7 deep separable convolutions. The small-kernel aggregation unit performs small-scale convolutional aggregation interactions in a 3×3 spatial neighborhood based on these aggregation weights to refine local boundary details. Through this multi-scale perceptual mechanism of large-kernel capture and small-kernel refinement, both global context capture and local boundary detail characterization are considered, effectively solving the core problem of inaccurate multi-scale defect boundary characterization.

[0024] 6. This invention has multi-scenario adaptability and generalization ability. It is not only applicable to conventional flat plate weld DR images, but also has stable segmentation performance in cross-device micro-focus weld DR images and weld film digitization images containing pseudo-defect interference. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0026] Figure 1 This is a flowchart of the image defect segmentation method for frequency domain feature enhancement and multi-scale perception provided in the embodiments of the present invention; Figure 2 This is an overall architecture diagram of the defect segmentation network provided in this embodiment of the invention; Figure 3 This is a schematic diagram of the wavelet domain feature aggregation module provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the global spatial perception module provided in an embodiment of the present invention; Figure 5 A comparative schematic diagram showing the defect segmentation of different models on weld DR images; Figure 6 A comparative schematic diagram showing the defect segmentation of different models on high-resolution DR weld images with microfocus of the equipment; Figure 7 A comparative schematic diagram showing the defect segmentation of different models on digitized weld seam images from film. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] like Figure 1 As shown in the figure, this invention discloses an image defect segmentation method with frequency domain feature enhancement and multi-scale perception, including the following steps: S1. Acquire raw digital X-ray images and perform pixel-level annotations to construct an X-ray image defect segmentation dataset; S2. Construct a defect segmentation network based on an encoding / decoding architecture; set up multiple cascaded convolutional modules at the encoding end; integrate a global spatial awareness module at the network neck, and connect the global spatial awareness module to the highest-level convolutional module; introduce a wavelet domain feature aggregation module in the skip connection path; embed multiple cascaded multi-scale sensing decoding modules (Broad-to-fine feature aggregation, BFFA) at the decoding end. S3. Train the defect segmentation network using the X-ray image defect segmentation dataset; S4. Segment the input digital ray image based on the trained defect segmentation network and output a defect segmentation mask; wherein, the process of segmenting the input digital ray image includes: Multi-level features from shallow to deep are extracted from digital ray images using multiple cascaded convolutional modules; The global spatial awareness module models long-range dependencies of the highest-level features and outputs the highest-level global spatial awareness features. The wavelet domain feature aggregation module performs sub-band information interaction and feature adaptive enhancement of the highest-level global spatial perception features and other level features in the wavelet domain, and inputs the enhanced features of each level in parallel to the corresponding multi-scale perception decoding module at the decoding end. The multi-scale perceptual decoding module performs global context capture and local boundary detail extraction on the input features, and outputs the final defect segmentation mask.

[0029] The specific implementation methods of the above steps will be further explained below.

[0030] S1. Acquire raw digital X-ray images and perform pixel-level annotation to construct an X-ray image defect segmentation dataset: Select steel plate lap weld specimens, steel plate butt weld specimens, aluminum alloy plate lap weld specimens, and aluminum alloy plate butt weld specimens as inspection objects, and perform digital X-ray imaging using a single-wall, single-image vertical transmission method; obtain standard raw digital X-ray images that meet technical requirements by adjusting imaging parameters; perform pixel-level defect annotation on the standard raw digital X-ray images to generate corresponding defect segmentation masks; perform data augmentation operations simultaneously on the annotated raw images and the masks to complete the production of the defect segmentation dataset.

[0031] Specifically, it includes: S11. Build a DR (Digital Radiography) imaging experimental platform. The types of digital radiography images acquired include weld DR images, high-resolution DR weld images with microfocus of the equipment, and digital weld images of film. The sensitivity, resolution, grayscale range, and normalized signal-to-noise ratio all meet the detection requirements.

[0032] S12. Using image annotation tools, the defect regions in the acquired digital ray images are delineated and categorized at the pixel level, generating a corresponding binary defect segmentation mask; the defect categories include porosity, inclusions, cracks, incomplete penetration, and incomplete fusion.

[0033] S13. To enhance the robustness and adaptability of subsequent deep learning models to geometric deformation, image interference, and changes in imaging conditions, data augmentation operations are simultaneously performed on the digital X-ray images in the dataset and their corresponding defect segmentation masks. The data augmentation operations specifically include: mirror transformation, random angle rotation, random cropping, Gaussian noise perturbation, and adaptive brightness and contrast adjustment. Finally, the expanded dataset is strictly divided into training and validation sets and independent test sets in a 9:1 ratio, and the training and validation sets are further divided into training and validation sets in a 9:1 ratio within the dataset, thus completing the creation of the X-ray image defect segmentation dataset for network training and evaluation.

[0034] S2. On the PyTorch platform, construct a defect segmentation network based on an encoding / decoding architecture. The defect segmentation network architecture is as follows: Figure 2 As shown.

[0035] like Figure 2As shown, the original digital ray image first enters the encoding end, and multi-scale features from shallow to deep are extracted by five cascaded convolutional modules set at the encoding end to obtain five levels of feature maps. The architecture of a single convolutional module includes: a 1×1 up-dimensional convolution, a depthwise separable convolution, a channel attention mechanism, and a 1×1 down-dimensional convolution connected in sequence. When the input and output feature map sizes and number of channels of the convolutional module are the same, it also includes a residual connection structure that adds the input features and output features element by element.

[0036] The processing flow of a single convolutional module for input features includes: expanding the channels of the original input features through 1×1 up-dimensional convolution; extracting local context features from the channel-expanded features in the spatial dimension using depthwise separable convolution; adaptively recalibrating the local context features extracted from each channel using a channel attention mechanism to obtain attention output features; compressing the channels of the attention output features through 1×1 down-dimensional convolution, and adding the channel-compressed features to the original input features element-wise using residual connections to output the corresponding hierarchical features.

[0037] The processing flow of the input image by the five cascaded convolutional modules includes: The first-level convolutional module extracts low-level features from the input digital ray original image, capturing the image's edges, grayscale gradients, and texture information, and outputs a high-resolution low-channel feature map to the second-level convolutional module. The second-level convolutional module performs 2x downsampling and channel upsampling on the input features, performs neighborhood aggregation on shallow features, extracts local texture blocks and primary structural contour features, and outputs them to the third-level convolutional module. The third-level convolutional module downsamples the input features by a factor of 2 to expand the receptive field of the features, encodes intermediate semantic features and target shape prototype information, and outputs them to the fourth-level convolutional module. The fourth-level convolutional module downsamples and upscales the input features, outputting high-level local semantic features that capture target category attributes and contrast information over a wide area. The fifth-level convolutional module is the deepest feature extraction layer, integrating information from the entire image and outputting a global high-level semantic feature map with the lowest resolution and the highest number of channels. The highest-level deep feature map extracted at the encoding end is fed into the Vision Receptance Weighted Key Value (VRWEV) module at the network's neck. The VRWEV module models global long-range dependencies with linear complexity, enhancing the network's ability to perceive global structural information and spatial correlation features related to defects.

[0038] To alleviate the problem of easily losing weak defect information and blurred edges during continuous downsampling and feature transfer, the defect segmentation network constructs a cross-layer jump path between the encoder and decoder and introduces a wavelet domain feature aggregation module (Wavelet Aggregation Block, or WAB for short).

[0039] Specifically, a two-layer wavelet domain feature aggregation module is set up in the skip connection path. The highest-level global spatial awareness feature output from the global spatial awareness module is fused with the hierarchical features output from the fourth-level convolutional module, and both are input into the first-layer wavelet domain feature aggregation module for initial wavelet subband information interaction and adaptive feature enhancement. Subsequently, the output features of the first-layer wavelet domain feature aggregation module are upsampled and fused with the hierarchical features output from the third-level convolutional module, and both are input into the second-layer wavelet domain feature aggregation module for further frequency domain representation refinement. Through this wavelet feature aggregation architecture guided by progressive upsampling from deep to shallow, adaptive enhancement of cross-layer multi-scale features in the wavelet domain is achieved, and the enhanced frequency domain features at each level are delivered in parallel to the decoding end.

[0040] During the decoding stage, the defect segmentation network employs progressive upsampling to restore resolution. In each decoding upsampling stage, a multi-scale perceptual decoding module (BFFA) is embedded. Through a large-kernel perception and small-kernel aggregation mechanism, the upsampled features are efficiently fused and refined with features from the cross-layer jump path of the WAB, thus balancing global context capture and local boundary detail depiction. Finally, the fused and refined features are mapped to the pixel-level prediction space through the upsampling convolutional layer at the output, outputting the final defect segmentation mask.

[0041] Specifically, the output features of the first-layer wavelet domain feature aggregation module are concatenated with the highest-level global spatial perception features output by the global spatial perception module and then input to the highest-level multi-scale perception decoding module at the decoding end. The output features of the highest-level multi-scale perception decoding module at the decoding end are upsampled and then concatenated with the output features of the second-layer wavelet domain feature aggregation module. The concatenated features are then input to the next-lowest-level multi-scale perception decoding module at the decoding end. The hierarchical features output by the convolutional modules at the encoding end are input one-to-one to the corresponding multi-scale perception decoding modules at the decoding end. That is, the first-level convolutional module is connected to the first-level multi-scale perception decoding module at the decoding end, and the second-level convolutional module is connected to the second-level multi-scale perception decoding module at the decoding end.

[0042] like Figure 3As shown, the wavelet domain feature aggregation module includes a Learnable Wavelet Module (LWM), a Squeeze Channel Attention (SCA) module, and a Gated Depth-wise Feedforward Network (GDFN). Input features are normalized by layers before entering the Learnable Wavelet Module to complete the learnable wavelet domain feature transformation and sub-band information interaction. Subsequently, by combining the attention and gating mechanisms, effective features are adaptively selected, and redundant responses are suppressed.

[0043] Specifically, the wavelet domain feature aggregation module processes the input features as follows: ①Assume the input is Input features After layer normalization (LayerNorm) processing, the input is fed into four sets of two-dimensional wavelet kernels constructed based on high-frequency and low-frequency filters. Discrete wavelet transform convolution is then performed, extracting four sets of sub-band information: low frequency, horizontal high frequency, vertical high frequency, and diagonal high frequency, which are then concatenated along the channel dimension. For each channel, a learnable low-frequency filter and a high-frequency filter are constructed. Based on these filters, four two-dimensional wavelet kernels are constructed: Four sets of two-dimensional wavelet kernels were obtained. , , , Among them, subscript l and h These represent low-pass filtering and high-pass filtering, respectively. ll , lh , hl , hh These correspond to the low-frequency, horizontal high-frequency, vertical high-frequency, and diagonal high-frequency areas of the image, respectively. A wavelet kernel is used as the convolution kernel, with a step size of 2, to perform a convolution operation, resulting in a feature tensor containing information from four sub-bands. Then, this feature tensor is first rearranged from a channel-mixed form into independent sub-band dimensions. Subsequently, a split operation is performed along the sub-band dimensions to obtain the information from the four sub-bands: low-frequency, horizontal high-frequency, vertical high-frequency, and diagonal high-frequency. Finally, the four sub-band features are concatenated sequentially along the channel dimension to obtain the wavelet domain fused features. .

[0044] splicing features The subband features are expanded sequentially using 1×1 convolution (Conv1×1), context aggregation is performed using 7×7 depthwise convolution (DWConv7×7), and channel compression is performed using GELU activation and 1×1 convolution (Conv1×1). This achieves feature interaction within the subband domain. The specific calculation process is as follows:

[0045] in, Represents a 1×1 convolution. This represents a 7×7 depthwise convolution. This represents the GELU activation function.

[0046] In terms of channel dimension, The features are decomposed into four updated sub-bands through a chunking operation. Based on the inverse discrete wavelet transform (IDWT), the four updated subbands were reconstructed as follows: IDWT can be implemented using a convolutional form that is the dual to DWT. That is, a wavelet kernel is constructed from a learnable filter, and upsampling and subband information fusion are completed through transposed convolution.

[0047] ② The squeezed channel attention module (SCA) uses the reconstructed features output by the learnable wavelet module. As input, the reconstructed features Perform global average pooling (Avgpool) and generate channel weights via 1×1 convolution (Conv1×1), which are then combined with the input reconstructed features. Channel-wise multiplication is used to achieve adaptive enhancement, followed by 1×1 convolutional linear projection and then combined with the input features of a learnable wavelet module. By summing the residuals, we obtain the characteristic. .

[0048] ③ The gated depthwise convolutional feedforward module converts the features output by the squeezed channel attention module into... After performing layer normalization (LayerNorm), 1×1 convolution (Conv1×1) channel expansion, and 3×3 depthwise convolution (DWConv3×3) to extract local context, the system is divided into two equal branches along the channel dimension. One branch is activated by the GELU function and then multiplied element-wise with the other branch to form a gating mechanism. This gating mechanism is then compressed using a 1×1 convolution (Conv1×1 channel) and then combined with the feature... The residuals are summed to obtain the final output of the wavelet domain feature aggregation module. .

[0049] like Figure 4 As shown, the processing flow of the global spatial awareness module at the network neck for the highest-level features includes a spatial blending stage and a channel blending stage.

[0050] The spatial mixing phase includes: ① Use the output features of the highest-level convolutional module as the input features of the global spatial awareness module. Input features Unfold along the spatial dimensions (i.e., the H and W directions) to form a one-dimensional token sequence feature. sequence features After layer normalization (LayerNorm) processing, the spatial feature map is restored. .

[0051] ② To enhance information exchange between adjacent spatial locations, spatial feature maps are... Perform a four-way unit pixel shift operation (QD-shift) to compare the shifted features with the spatial feature map. Adaptive fusion is performed based on learnable coefficients. Specifically, the four-way unit pixel displacement operation is as follows: Spatial feature map The channel is divided into four sub-blocks, and each of these four sub-blocks is shifted by a unit pixel along the left, right, down, and up directions. The shifting operation can be expressed mathematically as follows:

[0052] Where Concat means concatenating along the channel, and : means slicing operation; This represents the feature obtained after a four-way unit pixel displacement operation; Representation of spatial feature map The passage Representation of spatial feature map width, Representation of spatial feature map The height.

[0053] The shifted features and the original features are adaptively fused based on learnable coefficients and then unfolded back into a token sequence. These learnable coefficients are automatically optimized by the network during training using gradient descent. The adaptive fusion expression is as follows:

[0054] in, μ This represents the learnable coefficients; QD-shift() represents the adaptive fusion operation.

[0055] ③ The fused features are passed through three independent linear mapping layers to generate receiver vectors. Key vector Sum value vector ;wherein the receive vector After processing with the Sigmoid activation function, spatial attention weights and key vectors are obtained. Sum value vector Bidirectional global context interaction is achieved through a bidirectional weighted aggregation (Bi-WKV) mechanism; its calculation method is shown below.

[0056]

[0057] in, T The total length of the spatial sequence. t Index of the current target location, i For context location index, k i , v i The first i Key features and value features at each position, , These are the key features and value features of the current target position t, respectively. w The learnable distance attenuation coefficient is obtained through absolute distance. Simultaneously modeling the decay weights of preceding and succeeding positions enables bidirectional context coverage. u This is a learnable self-bias coefficient used to balance the contribution ratio of global context and its own features. This mechanism, through joint weighting of distance prior and content awareness, captures global bidirectional dependencies while maintaining the potential for linear computational complexity optimization.

[0058] ④ After the interactive output is processed by LayerNorm, it is adaptively multiplied with the spatial attention weights channel by channel, and then passed through a linear mapping layer to obtain the spatial mixture sequence. Spatial mixing sequence With sequence features Residual connections yield spatial blending enhancement sequences. .

[0059] The channel mixing stage includes: ① Spatial mixing enhancement sequences Perform layer normalization (LayerNorm) processing; ② Perform a four-way unit pixel shift operation (QD-shift) on the features after layer normalization, and then adaptively fuse the shifted features with the features before shifting.

[0060] ③ The fused features are passed through two independent linear mapping layers to generate modulation and reception vectors respectively. and transform key vector Modulated receive vector After processing with the Sigmoid activation function, channel feature transformation is completed, and channel gating weights are generated; key vectors After passing through the SquaredReLU activation function, layer normalization (LayerNorm), and a linear mapping layer, the mixture is element-wise multiplied with the channel gating weights and passed through another linear mapping layer to obtain the channel mixing sequence. .

[0061] ④ Mix the channel sequences Spatial mixing enhancement sequence with input Perform residual connections and recover the two-dimensional spatial feature map. The output greatly enhances the ability to perform global semantic aggregation and structure awareness in complex contexts.

[0062] The multi-scale perceptual decoding module (BFFA) includes an input 1×1 convolutional layer, a dynamic multi-scale perceptual layer, a channel attention layer (Squeeze-and-Excitation, SE), and an output 1×1 convolutional layer. The dynamic multi-scale perceptual layer includes large kernel perceptual units and small kernel aggregation units, with the aim of realizing dynamic multi-scale feature perception.

[0063] Specifically, the multi-scale perceptual decoding module's processing flow for input features includes: Let the input features of the multi-scale sensing decoding module be... The input features are processed through a 1×1 convolutional layer. After channel expansion, the features are obtained. , will feature The input is fed into the dynamic multi-scale perception layer for parallel offloading processing.

[0064] The dynamic multi-scale perception layer will feature Parallel splitting is performed to obtain two feature streams. and One of the characteristics Input to the large kernel perceptron, within the large kernel perceptron, features After sequentially applying 1×1 convolution and 7×7 depthwise separable convolution, local perceptual features are obtained. Specifically, the process of aggregating local contextual information includes: for any spatial location in the feature map... The corresponding feature token is represented as ,set up For Within a 7×7 neighborhood centered on the token, spatial awareness and neighborhood context fusion are performed on each token. The features of each location are encoded as spatial structure information of the surrounding 7×7 range, serving as local perception features. Next, local perceptual features will be... Input two 1×1 convolutional layers for feature mapping, and then pass the rearrangement operator. The feature dimension is reshaped by expanding the channel dimension into convolutional kernel parameters of corresponding spatial dimensions, generating context aggregation weights. This can be expressed by the formula:

[0065] in, This represents a 1×1 convolution.

[0066] Another feature As a baseline feature, it is aggregated with context weights. Common input is the small kernel aggregation unit; within the small kernel aggregation unit, weights are aggregated based on context. Features Small-scale convolutional aggregation interaction is performed in a 3×3 spatial neighborhood; specifically, the process of small-scale convolutional aggregation interaction includes: processing input features... Divided into G groups according to channels, for any spatial location The token is also divided into Group G. Take the first Group in position vector In its 3×3 neighborhood Internal utilization weight Perform convolutional aggregation to obtain the aggregation result. Among them, the context aggregation weights are... After dividing the output channel into G groups, the weight subset of the g-th group is... Extracting spatial location The corresponding 9 weight coefficients form a 3×3 local weight matrix that acts as a convolution kernel, i.e. The two represent the correspondence between the overall weights and the grouped position instances; for the input features After performing convolutional aggregation on all spatial locations, the g-th group of output features is obtained. The output features of each group are concatenated along the channel dimension to obtain the output after aggregation and interaction.

[0067] Subsequently, the output of the small-scale convolutional aggregation interaction is batch normalized and then added element-wise with the input features of the dynamic multi-scale perception layer to obtain the output features. .

[0068] Then, output features As input features to the channel attention layer, features are calculated through the channel attention layer. The channel attention layer assigns channel attention weights and adaptively recalibrates channel responses. Specifically, the channel attention layer assigns channel attention weights to input features and adaptively recalibrates channel responses. Global average pooling is performed to achieve global spatial context aggregation. Then, a channel dependency modeling branch is constructed using two cascaded 1×1 convolutions and a non-linear activation function. Channel attention weights are obtained via a sigmoid function, and these weights are then combined with the input features. By multiplying each channel correspondingly, adaptive recalibration of the characteristic responses of each channel is completed, thereby highlighting effective defect characteristics and suppressing redundant background interference.

[0069] Finally, the output of the channel attention layer is compressed by the output 1×1 convolutional layer to match the target dimension, and then output to obtain the defect segmentation mask, thereby completing the accurate localization and boundary refinement of the defect region.

[0070] S3. Training the Defect Segmentation Network: The training set data is input into the defect segmentation network for training, and a validation set is used to validate the model. After each training epoch, the loss value is calculated and the model parameters are updated through backpropagation. Training stops when the preset number of training epochs is reached, and the best-performing defect segmentation network is saved. The specific training process is as follows: S31. Set the hyperparameters of the defect segmentation network as follows: batch size is set to 8; the optimizer is Adam, with momentum parameters set to β1=0.9, β2=0.999, and weight decay coefficient set to 0 to prevent deviation in Adam's internal gradient correction; the maximum learning rate is set to 1×10⁻⁶. 4 The minimum learning rate is set to 1×10. 6 The total training cycle was set to 100 training rounds, and the input image size was uniformly adjusted to 512×512 pixels.

[0071] S32. The training set is used for iterative training of the defect segmentation network. The loss function adopts the standard cross-entropy loss. During training, the optimal learning rate boundary is adaptively fitted according to the batch size.

[0072] S33. The validation set is used for network model performance evaluation and hyperparameter tuning during the training process. After every 10 training rounds, the defect segmentation network completes performance evaluation on the validation set. The network fitting status is monitored by calculating the average intersection-union ratio (mIoU) and average pixel accuracy (mPA) to screen and solidify the best performing model parameters.

[0073] S4. Segment the input digital ray image based on the trained defect segmentation network and output a defect segmentation mask. This step is the testing and inference process of the defect segmentation network. Inference refers to applying the trained and optimal defect segmentation network to weld digital ray image data in a real engineering scenario that has not participated in training and verification. The defect segmentation network reconstructs and slices the original input digital ray image, outputs the defect segmentation image result, and analyzes and evaluates its defect segmentation effect. This step is the key link in moving the trained defect segmentation network from the laboratory verification stage to practical engineering applications. The processing procedure for the input digital ray image is consistent during the training and inference stages of the defect segmentation network, as described in S2.

[0074] Next, the performance of the defect segmentation network (hereinafter referred to as FM-DIS) of this invention will be further verified.

[0075] (I) Generalization Performance Comparison with Mainstream Algorithms: The generalization performance of the saved defect segmentation network was evaluated using an independent test set. To verify the absolute advantage of the model of this invention in the defect segmentation task, comparative experiments were conducted with it and several mainstream deep learning segmentation methods using the same dataset and in the same rounds.

[0076] The mainstream deep learning segmentation methods used include: U-shaped convolutional neural network (U-Net), fully convolutional network (FCNet), pyramid scene parsing network (PSPNet), encoder-decoder semantic segmentation network based on dilated separable convolution (DeepLabV3+), context coding network (EncNet), unified perception parsing network (UPerNet), cross-shaped network (CCNet), dual attention network (DANet), deep dual resolution network (DDRNet-39), semantic segmentation network based on Transformer (SegFormer), image segmentation network based on MaskFormer (PEM), and Golden Cudgel Network (GCNet-M).

[0077] The average crossover ratio (mIoU) and average pixel accuracy (mPA) of each model were calculated and compared on the test set, and the results are shown in Table 1.

[0078] Table 1. Quantitative Comparison Analysis of Different Models on the Test Set

[0079] As shown in Table 1, the proposed defect segmentation network (FM-DIS) achieves mIoU and mPA of 76.2% and 84.8% respectively, which are significantly better than other comparative models, fully demonstrating its significant advantages in overall segmentation effect and pixel-level classification accuracy of defect regions.

[0080] (II) The core objective of model inference is to apply the defect segmentation network of this invention to practical engineering inspection scenarios. The inference verification scenarios cover weld DR images, high-resolution DR weld images with micro-focus on equipment, and digitized weld images from film. Through feature extraction and decoding, pixel-level defect masks are reconstructed to comprehensively verify the model's generalization performance and engineering adaptability under complex structures. Specific verification results are as follows: 1. Performance verification for defect segmentation in weld seam DR images: The weld seam DR image is input into each comparison model and the defect segmentation network of this invention, and the defect segmentation result is output as follows: Figure 5 As shown, the comparative analysis of typical defect segmentation results from different models is as follows: The U-Net model severely missed classifying dense pores in group #2 and low-contrast cracks in group #4. It also misclassified incomplete penetration defects and pore defects in group #1, and performed poorly in classifying high-density inclusion defects in group #4 and non-fusion defects in group #3.

[0081] The SegFormer model has insufficient boundary preservation capabilities, and it misses some inclusion defects in groups #1 and #4, porosity defects in group #2, and crack defects in group #4. Furthermore, it significantly misclassifies incomplete penetration defects in group #1 and incomplete fusion defects in group #3.

[0082] The PEM model performs well in large-scale defect segmentation, and can completely segment the inclusion defects in groups #1 and #4, as well as the non-fusion defects in group #3. However, it still misjudges the incomplete penetration defects in group #1, misses the dense pores in group #2, and does not fully depict the low-contrast cracks in group #4.

[0083] The FM-DIS of this invention effectively preserves the texture features and grayscale gradients of weak defects while suppressing interference from complex industrial backgrounds. The defect segmentation network of this invention can not only accurately segment incomplete penetration defects in group #1 and dense porosity defects in group #2, but also achieve highly complete extraction of inclusion defects in groups #1 and #4, and non-fusion defects in group #3; even with low-contrast crack defects in group #4, it maintains excellent defect region characterization capabilities, and the visual segmentation effect is closest to the real mask, achieving a good balance between contextual structure modeling and local boundary refinement.

[0084] In summary, the FM-DIS proposed in this invention performs better in the defect segmentation task of weld seam DR images in terms of fine-grained feature representation, multi-scale boundary sharpness and category discrimination accuracy. It can take into account both local boundary refinement and global structure perception, and is suitable for the intelligent segmentation and intelligent evaluation requirements of industrial radiographic inspection images.

[0085] 2. Comparative verification of the micro-focus high-resolution DR weld seam image segmentation performance of the equipment: The cross-device micro-focus high-resolution DR weld image is input into each comparison model and the defect segmentation network of this invention, and the defect segmentation result is output as follows: Figure 6 As shown, a comparative analysis of typical defect segmentation results from different models is presented below: The U-Net model can effectively separate incomplete penetration defects in group #2 and crack defects in group #3, but it misses small-scale inclusion defects in groups #1 and #2, low-contrast non-fusion defects in group #3, and crack defects in group #1. It also misclassifies porosity defects in group #2 as inclusion defects.

[0086] The SegFormer model can effectively segment crack defects in groups #2 and #3, but the segmentation continuity is poor, and it misses small-scale inclusion defects in groups #1 and #2, some incomplete penetration defects in group #2, low-contrast non-fusion in group #3, and crack defects in group #1.

[0087] The PEM model can effectively separate porosity defects in group #2 from crack defects in group #3, but it misses small-scale inclusion defects in groups #1 and #2 and low-contrast non-fusion defects in group #3. It misclassifies some incomplete penetration defects in group #2 as inclusion defects and misses crack defects in group #1.

[0088] The FM-DIS of this invention has better integrity and complexity adaptability, can effectively separate porosity defects and incomplete penetration defects, and can also accurately extract small-scale inclusion defects in groups #1 and #2, low-contrast non-fusion defects in group #3, and crack defects in group #1.

[0089] In summary, the FM-DIS proposed in this invention can effectively suppress low-contrast interference, has better integrity and adaptability to complex structures in the segmentation of multiple types of defects in welds, and significantly improves the accuracy of defect extraction.

[0090] 3. Comparative verification of defect segmentation performance in digital weld seam images from film: The digitized weld seam image from the film is input into each comparison model and the defect segmentation network of this invention, and the defect segmentation result is output as follows: Figure 7 As shown. Comparative analysis of typical defect segmentation results from different models: The U-Net model has poor segmentation accuracy, misjudging inclusion defects in group #1, porosity defects in group #2, and non-fusion defects in group #4. It also misjudged incomplete penetration defects in group #3. Furthermore, there are varying degrees of omissions and boundary adhesions in the crack defects of groups #2 and #4.

[0091] The SegFormer model performs poorly in terms of segmentation continuity and region integrity. Although it is effective in segmenting porosity defects in group #2, incomplete penetration defects in group #3, and non-fusion defects in group #4, it has local misjudgments of inclusion defects in group #1, and serious omissions and boundary adhesions in crack defects in groups #2 and #4.

[0092] Although the PEM model can effectively separate the porosity defects in group #2 and the non-fusion defects in group #4, it misclassifies the inclusion defects in group #1 as porosity defects as a whole, makes local misclassifications of the non-penetration defects in group #3, and also has omissions and boundary adhesions in the crack defects in groups #2 and #4.

[0093] The FM-DIS of this invention exhibits superior regional integrity and adaptability to complex structures. It is not only effective in segmenting porosity defects in group #2, incomplete penetration defects in group #3, and lack of fusion defects in group #4, but also accurately characterizes inclusion defects in group #1, and completely extracts crack morphology in groups #2 and #4, maintaining good boundary continuity.

[0094] In summary, the FM-DIS proposed in this invention exhibits better robustness and accuracy in multi-category defect segmentation of film digitization images, effectively suppresses background interference, and significantly improves the accuracy of defect morphology extraction.

[0095] (III) Quantitative Defect Size Measurement and Evaluation: Based on the pixel-level defect prediction mask output by the defect segmentation network and the actual pixel size of the detector, quantitative defect size measurement is carried out. The length of linear defects such as cracks, lack of fusion, incomplete penetration, and strip inclusions, as well as the diameter of porosity defects, are automatically measured, and the relative error is calculated, providing accurate and stable boundary basis for intelligent evaluation and quantitative analysis of industrial X-ray images. Eight images containing defects were selected for measurement and analysis for five types of defects. For comparative verification, the FM-DIS and U-Net models, which rank first and second in the mIoU index in Table 1, were selected as test models, and the results are shown in Table 2.

[0096] Table 2. Defect size measurement results from DR images of flat welds

[0097] As shown in Table 2, the Defect Segmentation Network (FM-DIS) proposed in this invention achieves superior measurement accuracy across various defect types, with an overall lower average relative error compared to U-Net, indicating better boundary characterization and size prediction stability. For cracks and incomplete fusion defects, the average relative errors of FM-DIS are 5.3% and 2.1%, respectively, lower than U-Net's 7.3% and 4.3%, demonstrating its ability to better preserve the morphological characteristics of slender defects and weak boundary regions. For incomplete penetration defects, U-Net exhibits undersegmentation in some samples, with an average relative error of 11.9%, while FM-DIS is only 3.3%. For strip-shaped defects, U-Net suffers from undersegmentation or oversegmentation, with an average relative error reaching 12.2%, compared to FM-DIS's 2.8%. For circular defects, the errors of the two models are similar, at 13.9% and 13.8%, respectively, mainly because the size of this type of defect is small, and even a small pixel deviation can cause diameter measurement errors. In summary, the segmentation results of this invention can provide a more accurate and stable boundary basis for linear defect size measurement, thereby providing effective support for the quantitative evaluation of defects in weld DR images.

[0098] Based on the comprehensive quantitative evaluation and qualitative verification results, the defect segmentation network proposed in this invention demonstrates excellent performance in defect segmentation tasks for weld DR images, equipment micro-focus high-resolution DR weld images, and film digitization weld images. It excels in defect region extraction, pixel-level classification accuracy, local boundary detail refinement, and artifact interference suppression, exhibiting significant potential for engineering applications. Specifically, in weld DR image segmentation, it effectively addresses common challenges such as large defect scale differences and low contrast, fully extracting minute defect details and significantly improving the overlap consistency of segmented regions and the pixel recall rate of various defects. In the verification of equipment micro-focus high-resolution DR weld images, it exhibits strong generalization performance, accurately extracting multiple types of defects and micropores under complex structures, effectively suppressing background noise and interference, and improving region discrimination accuracy. This provides a high-precision and stable boundary basis for subsequent downstream tasks such as quantitative measurement and grading of defect sizes. Therefore, the defect segmentation network provided by this invention has a stable segmentation effect, can adapt to complex industrial imaging environments, has strong resistance to complex background interference, good detail boundary preservation effect, and significantly improved cross-over ratio. It has good prospects for industrial application and provides reliable technical support for intelligent assessment of X-ray image defects in aerospace, nuclear industry and special equipment fields, and powerfully promotes the engineering application of intelligent industrial image detection technology.

[0099] In other embodiments, the present invention also proposes an image defect segmentation system with frequency domain feature enhancement and multi-scale perception, comprising: The image acquisition module is used to acquire the digital ray image to be segmented; The defect segmentation module is used to segment digital ray images using the pre-trained defect segmentation network described above, and outputs a defect segmentation mask.

[0100] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A frequency domain feature enhancement and multi-scale perception image defect segmentation method, characterized in that, Includes the following steps: S1. Acquire raw digital X-ray images and perform pixel-level annotations to construct an X-ray image defect segmentation dataset; S2. Construct a defect segmentation network based on an encoding / decoding architecture; set up multiple cascaded convolutional modules at the encoding end; integrate a global spatial awareness module at the network neck, and connect the global spatial awareness module to the highest-level convolutional module; introduce a wavelet domain feature aggregation module in the skip connection path; Multiple cascaded multi-scale sensing decoding modules are embedded at the decoding end; S3. Train the defect segmentation network using the X-ray image defect segmentation dataset; S4. Segment the input digital ray image based on the trained defect segmentation network and output a defect segmentation mask; wherein, the process of segmenting the input digital ray image includes: Multi-level features from shallow to deep are extracted from digital ray images using multiple cascaded convolutional modules; The global spatial awareness module models long-range dependencies of the highest-level features and outputs the highest-level global spatial awareness features. The wavelet domain feature aggregation module performs sub-band information interaction and feature adaptive enhancement of the highest-level global spatial perception features and other level features in the wavelet domain, and inputs the enhanced features of each level in parallel to the corresponding multi-scale perception decoding module at the decoding end. The multi-scale perceptual decoding module performs global context capture and local boundary detail extraction on the input features, and outputs the final defect segmentation mask.

2. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 1, characterized in that, In S1, the image categories of the digital radiography raw images include weld DR images, equipment microfocus high-resolution DR weld images, and film digitized weld images. The defect categories include porosity, inclusions, cracks, incomplete penetration, and lack of fusion.

3. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 1, characterized in that, Five cascaded convolutional modules are set up at the encoding end; the processing flow of each convolutional module for the input features includes: Channel expansion of the original input features is performed using 1×1 up-dimensional convolution; Depth-separable convolution is used to extract local contextual features from channel-expanded features in the spatial dimension; The local context features extracted from each channel are adaptively recalibrated using a channel attention mechanism to obtain attention output features; The attention output features are compressed by 1×1 dimensionality reduction convolution, and residual connections are used to add the compressed features to the original input features element by element to output the corresponding hierarchical features.

4. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 3, characterized in that, Two wavelet domain feature aggregation modules are set in the skip connection path. The highest level global spatial perception feature output by the global spatial perception module is fused with the hierarchical feature output by the fourth level convolution module and input together into the first wavelet domain feature aggregation module. The output features of the first-layer wavelet domain feature aggregation module are upsampled and then fused with the hierarchical features output by the third-layer convolution module, and then input together into the second-layer wavelet domain feature aggregation module. The output features of the first-level wavelet domain feature aggregation module are also concatenated with the highest-level global spatial perception features output by the global spatial perception module, and then input to the highest-level multi-scale perception decoding module at the decoding end. The output features of the highest-level multi-scale sensing decoding module at the decoding end are upsampled and then concatenated with the output features of the second-level wavelet domain feature aggregation module. The concatenated features are then input into the next-lowest-level multi-scale sensing decoding module at the decoding end. The layer features output by the convolutional modules of the remaining layers at the encoding end are input one-to-one to the multi-scale perceptual decoding module of the corresponding layer at the decoding end.

5. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 1, characterized in that, The wavelet domain feature aggregation module includes a learnable wavelet module, a squeezed channel attention module, and a gated deep convolutional feedforward module. The learningable wavelet module's processing of input features includes: For input features After layer normalization, the input is fed into four sets of two-dimensional wavelet kernels constructed based on high-frequency and low-frequency filters for discrete wavelet transform convolution. The four sets of sub-band information—low frequency, horizontal high frequency, vertical high frequency, and diagonal high frequency—are then extracted and spliced ​​along the channel dimension. The concatenated features are sequentially processed through 1×1 convolution, 7×7 depthwise convolution, GELU activation function and 1×1 convolution to achieve feature interaction within the sub-band domain; In the channel dimension, the features after feature interaction within the sub-band domain are decomposed into four updated sub-band features. A learnable transpose convolution, dual to the discrete wavelet transform, is then applied to these four updated sub-band features to perform an inverse discrete wavelet transform, reconstructing the features. ; The squeezed channel attention module will learn the reconstructed features output by the wavelet module. As input, the reconstructed features Perform global average pooling and generate channel weights via 1×1 convolution, then combine them with the input reconstructed features. The features are multiplied channel by channel, then convolved by 1×1, and finally combined with the input features of the learnable wavelet module. By summing the residuals, we obtain the characteristic. ; The gated depthwise convolutional feedforward module extracts features from the squeezed channel attention module. After layer normalization, 1×1 convolution, and 3×3 depthwise convolution, the system is divided into two branches along the channel dimension. One branch is activated by the GELU function and then multiplied element-wise with the other branch to form a gating mechanism. This gating mechanism is then convolved with the features by a 1×1 convolution. The residuals are summed to obtain the final output of the wavelet domain feature aggregation module. .

6. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 1, characterized in that, The global spatial perception module's processing flow for the highest-level features includes a spatial blending stage and a channel blending stage. The spatial mixing phase includes: The output features of the highest-level convolutional module are used as the input features of the global spatial awareness module. Input features Expand into sequence features sequence features After layer normalization, the spatial feature map is restored. ; Spatial feature map Perform a four-way unit pixel displacement operation, and compare the displacement features with the spatial feature map. Adaptive fusion based on learnable coefficients; The fused features are passed through three independent linear mapping layers to generate a receiver vector, a key vector, and a value vector, respectively. The receiver vector is processed by the Sigmoid activation function to obtain spatial attention weights, and the key vector and value vector are subjected to bidirectional global context interaction. The output after bidirectional global context interaction is normalized by layers, then adaptively multiplied with the spatial attention weights channel by channel, and finally passed through a linear mapping layer to obtain the spatial mixing sequence. Spatial mixing sequence With sequence features Residual connections yield spatial blending enhancement sequences. ; The channel mixing stage includes: Spatial mixing enhances sequences Perform layer normalization; The features after layer normalization are subjected to a four-way unit pixel displacement operation, and the features after displacement are adaptively fused with the features before displacement. The fused features are passed through two independent linear mapping layers to generate a modulation receive vector and a transform key vector, respectively. The modulation receive vector is then processed by a Sigmoid activation function to generate channel gating weights. The key vector is then passed through a SquaredReLU activation function, layer normalization, and a linear mapping layer, and finally multiplied element-wise with the channel gating weights and passed through another linear mapping layer to obtain the channel mixing sequence. ; Channel mixing sequence Spatial mixing enhancement sequence with input Perform residual connections and restore the output to a two-dimensional spatial feature map.

7. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 6, characterized in that, Four-way unit pixel displacement operations include: Spatial feature map The channel is divided into four sub-blocks, and each of these four sub-blocks is shifted by a unit pixel along the left, right, down, and up directions.

8. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 1, characterized in that, The multi-scale sensing decoding module includes an input 1×1 convolutional layer, a dynamic multi-scale sensing layer, a channel attention layer, and an output 1×1 convolutional layer; the dynamic multi-scale sensing layer includes a large kernel sensing unit and a small kernel aggregation unit; The multi-scale perceptual decoding module's processing flow for input features includes: Let the input features of the multi-scale sensing decoding module be... The input features are processed through a 1×1 convolutional layer. After channel expansion, the features are obtained. ; The dynamic multi-scale perception layer will feature Parallel splitting is performed to obtain two feature streams. and One of the characteristics Input to the large kernel perceptron, within the large kernel perceptron, features After sequentially applying 1×1 convolution and 7×7 depthwise separable convolution, local perceptual features are obtained. ; local perception features Input two 1×1 convolutional layers for feature mapping, and then pass the rearrangement operator. The feature dimension is reshaped by expanding the channel dimension into convolutional kernel parameters of corresponding spatial dimensions, generating context aggregation weights. ; Another feature As a baseline feature, it is aggregated with context weights. Common input small core aggregation unit; In the small-core aggregation unit, aggregation weights are based on context. Features Small-scale convolutional aggregation interaction is performed in a 3×3 spatial neighborhood; the features after small-scale convolutional aggregation interaction are batch normalized and then compared with the features. The output features are obtained by summing the element-wise residuals. ; Output features are calculated through the channel attention layer. The channel attention weights are applied and the channel responses are adaptively recalibrated. Then, the output 1×1 convolutional layer compresses the channels to the target dimension before outputting.

9. The image defect segmentation method for frequency domain feature enhancement and multi-scale perception as described in claim 8, characterized in that, Local sensing features in large kernel sensing units The generation process includes: For any spatial location in the feature map The corresponding feature token is represented as ,set up For Within a 7×7 neighborhood centered on the token, spatial awareness and neighborhood context fusion are performed on each token. The features of each location are encoded as spatial structure information of the surrounding 7×7 range, serving as local perception features. ; In the small-core aggregation unit, aggregation weights are based on context. Features The process of small-scale convolutional aggregation interaction in a 3×3 spatial neighborhood includes: Input features Divided into G groups according to channels, for any spatial location The token is also divided into Group G. Take the first Group in position vector In vector 3×3 neighborhood Internal utilization weight Perform convolutional aggregation to obtain the aggregation result. Among them, the context aggregation weights are... Divide the data into G groups along the output channel dimension, and then divide the data into weight subsets from the g-th group. Extracting spatial location The 3×3 local weight matrix formed by the corresponding 9 weight coefficients serves as the weight. ; Input features After performing convolutional aggregation on all spatial locations, the g-th group of output features is obtained. ; The output features of each group are concatenated along the channel dimension to obtain the aggregated output.

10. An image defect segmentation system with frequency domain feature enhancement and multi-scale perception, characterized in that, include: The image acquisition module is used to acquire the digital ray image to be segmented; The defect segmentation module is used to segment a digital ray image using a trained defect segmentation network as described in any one of claims 1-9, and output a defect segmentation mask.