Cascade segmentation method and system for pipe steel cylinder weld defects
By using a cascaded segmentation method, combined with a global spatial positioning network, morphological dilation, microscopic slicing, and Hanning window smoothing fusion, the problems of high-resolution processing and slender defect identification in the inspection of weld seams of large pipeline steel cylinders were solved, achieving high-precision, artifact-free automated inspection.
Patent Information
- Application Number
- CN202610429715.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-02
- Publication Date
- 2026-07-17
AI Technical Summary
Existing deep learning visual segmentation techniques face challenges in the inspection of weld seams in large pipeline steel cylinders, including insufficient ultra-high resolution image processing capabilities, dilution of slender defect features, and artifacts from slice stitching, resulting in low detection efficiency and insufficient accuracy.
A cascaded segmentation method is adopted, including macroscopic weld seam extraction, dynamic slicing and cleaning, microscopic fine defect segmentation and probabilistic smooth reconstruction. It utilizes a global spatial localization network, morphological dilation, microscopic slice dataset processing, strip spatial attention mechanism and Hanning window weighted smooth fusion to achieve high-precision artifact-free detection.
It achieves high-precision automated detection of weld defects in pipe steel cylinders in high-resolution images, avoids wasting computing power, enhances the ability to identify slender defects, eliminates slice stitching artifacts, and provides a detection solution with high engineering value.
Smart Images

Figure CN122416008A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial defect detection technology, specifically relating to a cascaded segmentation method and system for defects in weld seams of pipeline steel cylinders. Background Technology
[0002] As core infrastructure for energy transmission, petrochemicals, and marine engineering, the absolute safety of large pipelines is directly related to economic lifelines and ecological environmental security. In the assembly and construction of large pipelines, the welding of the internal seepage-proof steel cylinder is an indispensable and critical connection process. However, due to the interference of dynamic parameters such as welding speed, shielding gas flow rate, and arc voltage, various welding defects, including porosity, slag inclusions, cracks, and undercut, inevitably occur on the weld surface and inside the weld. These defects are usually hidden in the form of tiny grooves at the interface between the weld toe and the base metal, severely reducing the load-bearing wall thickness of the pipeline and easily leading to catastrophic fractures and high-pressure leaks.
[0003] Traditional non-destructive testing (NDT) techniques for welds heavily rely on manual visual inspection or magnetic particle testing, often suffering from high subjectivity and low efficiency. In recent years, automated surface defect detection technologies based on deep learning and machine vision have gradually become mainstream. However, in actual large-scale pipeline steel cylinder weld quality inspection scenarios, existing deep learning visual segmentation technologies face severe challenges: First, digital images acquired by industrial array cameras have ultra-high resolutions of 4K or higher, far exceeding the limits of conventional graphics card memory. Forced global downsampling will cause irreversible smoothing and destruction of fine, subtle edge defects, eventually leading to their complete loss; using a traditional blind sliding window mechanism introduces redundant computation of massive amounts of pure pipe wall background. Second, weld defect morphologies are extreme. Defects often manifest as elongated topological structures extending along the weld edge, and their local features are easily confused with normal fish-scale patterns. Traditional classic semantic segmentation architectures (such as UNet and PSPNet) largely rely on isotropic standard square convolutional kernels. When using a square receptive field to process slender targets with strong directionality, a large amount of normal background texture is inevitably involved, resulting in severe dilution of defect features and causing prediction breaks and missed edge detections. Third, there is the artifact problem in local slice reconstruction. During the reconstruction and restoration stage of the detection results, due to the field-of-view truncation effect of neural networks at image edges, conventional direct matrix overlay or hard stitching strategies that take the maximum value are prone to producing severe probability abrupt changes and grid-like stitching artifacts at slice boundaries, seriously interfering with the final automated industrial judgment logic. Summary of the Invention
[0004] The purpose of this invention is to provide a cascaded segmentation method and system for defects in weld seams of pipeline steel cylinders, which realizes high-precision, artifact-free automated detection of minute defects in weld seams of large pipeline steel cylinders in high-resolution images.
[0005] To achieve the above objectives, the first aspect of the present invention provides a cascaded segmentation method for weld defects in pipeline steel cylinders, comprising the following steps: S1. Macroscopic weld seam extraction: The original panoramic image of the pipeline weld seam acquired by the industrial array camera is input into the trained global spatial localization network for segmentation, and the initial weld seam binary mask at the panoramic scale is output. Then, the initial weld seam binary mask is subjected to morphological dilation operation to obtain a secure extraction mask. S2. Dynamic Slicing and Cleaning: Based on the effective traversal boundary determined by the secure extraction mask, the original panoramic image is dynamically overlapped and slicing sampled according to the set cutting window size and spatial overlap rate. Pure background redundant slices are removed according to the set pixel ratio hard filtering rules to obtain a micro-slice dataset. S3. Microscopic Fine Defect Segmentation: The microscopic slices in the microscopic slice dataset are input into the trained microscopic fine segmentation network. Local photometric calibration and feature extraction are performed sequentially to obtain deep and shallow feature maps. Then, the deep and shallow feature maps are weighted and purified based on the strip spatial attention mechanism to obtain deep semantic feature maps and shallow texture feature maps. The deep semantic feature maps and shallow feature maps are then fused with receptive field multi-scale features to output a fine feature map. Finally, the pixel-level defect prediction probability map of the slice size is restored and output. S4. Probabilistic-level smoothing reconstruction and post-processing: A probabilistic-level Hanning window weighted smoothing fusion strategy is adopted to perform local spatial weighted accumulation and smooth attenuation reconstruction on the pixel-level defect prediction probability map of all slices in the global spatial coordinate system to obtain a global probability distribution map; finally, the security extraction mask generated in step S1 is called to perform secondary pixel-level logic AND filtering on the global probability distribution map to output the final panoramic defect distribution map of the pipeline weld.
[0006] Furthermore, in step S1, the global spatial localization network is the YOLO instance segmentation network; the security extraction mask generated after dilation... The formula for obtaining it is as follows:
[0007] in, This is the initial weld seam binary mask for the panoramic scale. A custom morphological uniform structural element.
[0008] Furthermore, in step S2, the effective traversal boundary is the minimum bounding rectangle of the secure extraction mask, and the dynamic overlapping sliding slice sampling is performed within the effective traversal boundary. The pixel ratio hard filtering rule includes: counting the area of weld mask pixels in the currently acquired slice field of view; if the total number of effective weld pixels is lower than a preset threshold of the total area of the cutting window, the slice is determined to be a low information entropy pure background redundant slice and is removed.
[0009] Furthermore, in step S3, the feature extraction adopts a truncated feature extraction backbone network; the truncated feature extraction backbone network is a ResNet network that removes the global average pooling layer and the fully connected layer, and actively discards the fourth deepest residual layer; the spatial resolution of the deepest semantic feature map output by the feature extraction backbone network is maintained at 1 / 16 of the original micro-slice size.
[0010] Furthermore, in step S3, the local photometric calibration specifically includes: For the input micro-slice tensor First, convolution and batch normalization are performed, and then a sigmoid non-linear activation function is applied to map the result to a spatial enhancement mask. :
[0011] The space enhancement mask With the original microscopic slice tensor Element-wise multiplication is performed, and a residual join mechanism is introduced to output an enhanced slice. :
[0012] in, This represents the element-wise Hadamard product of a matrix.
[0013] Furthermore, in step S3, the specific process of weighted purification is as follows: Input feature map Perform strip pooling along both the horizontal and vertical dimensions, for spatial coordinates... passage Its horizontal aggregation characteristics With vertical aggregation features They are respectively:
[0014]
[0015] Where H represents the number of pixels in the vertical direction of the image, and W represents the number of pixels in the horizontal direction of the image; Using interpolation functions The horizontal aggregation feature With vertical aggregation features Spatial dimension expansion to the original feature map Generate bar-shaped attention masks by adding elements of the same size one by one. :
[0016] Then, the bar attention mask is used. For the input feature map We perform spatial dimension weighted refinement to obtain directional and focused output features from deep semantic feature maps and shallow texture feature maps, respectively. .
[0017] Furthermore, in step S3, the specific process of multi-scale feature fusion of the receptive field is as follows: Let the deep semantic feature map after the weighted purification be... The shallow texture feature map is Using bilinear interpolation and Convolution performs spatial upsampling and channel dimensionality reduction on deep features:
[0018] In the channel dimension and splicing, through Convolution yields fused features :
[0019] Calculate the average pooling distribution for each channel dimension. With maximum pooling distribution :
[0020]
[0021] C represents the total number of channels; splicing the average pooling distribution With maximum pooling distribution and after Convolution and Sigmoid activation generate a two-dimensional feature filtering mask. :
[0022] Finally, the refined feature map is output. .
[0023] Furthermore, in step S4, the specific process of the probabilistic Hanning window weighted smoothing fusion strategy is as follows: Define the space dimensions as One-dimensional Hanning window smoothing function :
[0024] A two-dimensional spatial probability weighting matrix is generated by the outer product of two orthogonal one-dimensional Hanning window sequences. And introduce a minimal constant. Truncation:
[0025] Construct a global probabilistic canvas with the same spatial dimensions as the original panoramic image. With global weight canvas For the slice probability matrix When mapping back to the global coordinate system, a local space weighted accumulation is performed:
[0026]
[0027] After traversing all slices, obtain the global normalized probability distribution map. .
[0028] A second aspect of the present invention provides a cascaded segmentation system for weld defects in large pipeline steel cylinders, comprising: The macroscopic extraction module is used to input the original panoramic image of the pipeline weld seam captured by the industrial array camera into the trained global spatial localization network for segmentation, output the initial weld seam binary mask at the panoramic scale, and then perform a morphological dilation operation on the initial weld seam binary mask to obtain a secure extraction mask. The slice extraction module is used to perform dynamic overlapping sliding slice sampling on the original panoramic image based on the effective traversal boundary determined by the security extraction mask, according to the set cutting window size and spatial overlap rate, and remove pure background redundant slices according to the set pixel ratio hard filtering rules to obtain a micro slice dataset. The micro-segmentation module includes an adaptive region contrast enhancement unit, a feature extraction backbone unit, a strip spatial attention unit, and a multi-scale feature fusion unit. The adaptive region contrast enhancement unit performs local photometric calibration on the micro-slices. The feature extraction backbone unit extracts features to obtain deep and shallow texture feature maps. The strip spatial attention unit performs weighted purification on the deep and shallow texture feature maps to obtain deep semantic feature maps and shallow texture feature maps. The multi-scale feature fusion unit performs receptive field multi-scale feature fusion on the deep semantic feature map and shallow feature maps to output a refined feature map and restores it to a pixel-level defect prediction probability map of the slice size. The recombination post-processing module is used to employ a probabilistic Hanning window weighted smooth fusion strategy to perform local spatial weighted accumulation and smooth attenuation recombination on the pixel-level defect prediction probability map of all slices in the global spatial coordinate system to obtain a global probability distribution map; finally, the security extraction mask generated in step S1 is called to perform secondary logic AND filtering on the global probability distribution map to output the final panoramic defect distribution map of the pipeline weld.
[0029] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described cascaded segmentation method for defects in pipe cylinder welds.
[0030] In summary, compared with the prior art, the above-described technical solutions conceived by this invention mainly possess the following technical advantages: 1. Breaking the physical contradiction between computing power and resolution: This invention uses a dual-cascade detection framework of macroscopic positioning and microscopic dynamic slicing. It utilizes a lightweight model to quickly delineate effective weld seams and is supplemented by morphological expansion boundary constraints. Under the premise of perfectly preserving the high-definition resolution features of the original image and ensuring zero missed detection of edge defects, it completely eliminates the ineffective consumption of computing power for large areas of pure background.
[0031] 2. Overcoming the bottleneck of feature extraction for extremely thin and irregular defects: The micro-backbone network designed in this invention organically integrates adaptive region contrast enhancement and an innovative strip-shaped spatial attention mechanism. Through cross-shaped one-dimensional pooling, the background dilution effect caused by traditional isotropic square convolution kernels is completely eliminated, significantly enhancing the deep network's ability to discriminate irregular linear edge defects and reconstruct them at the high-fidelity pixel level.
[0032] 3. Completely eliminate artificial mutation artifacts in slice stitching: The innovative Hanning window probability matrix-based spatial attenuation suppression and macroscopic mask secondary filtering technology not only enhances weak defect pixels, but also achieves "seamless connection" between slice-level microscopic results and 4K macroscopic original images, completely eliminating grid artifacts at edge overlaps, and providing a high-resolution panoramic field-of-view defect diagnosis solution with extremely high engineering application value. Attached Figure Description
[0033] Figure 1 This is a flowchart of a cascaded segmentation method for weld defects in pipeline steel cylinders according to an embodiment of the present invention; Figure 2 The network structure diagram of M2M-WeldNet constructed according to an embodiment of the present invention; Figure 3 This is an example of a 4K panoramic image after detection in an embodiment of the present invention. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0035] like Figure 1 and 2 As shown, this embodiment of the invention provides a cascaded segmentation method for weld defects in pipeline steel cylinders based on an M2M-WeldNet network structure. This framework constructs an asymmetric dual-tower cascaded architecture from coarse to fine, including the following steps: S1. Macroscopic weld seam extraction: The original panoramic image of the pipeline weld seam acquired by the industrial array camera is input into the trained global spatial localization network for segmentation, and the initial weld seam binary mask at the panoramic scale is output. Then, the initial weld seam binary mask is subjected to morphological dilation operation to obtain a secure extraction mask. S2. Dynamic Slicing and Cleaning: Based on the effective traversal boundary determined by the secure extraction mask, the original panoramic image is dynamically overlapped and slicing sampled according to the set cutting window size and spatial overlap rate. Pure background redundant slices are removed according to the set pixel ratio hard filtering rules to obtain a micro-slice dataset. S3. Microscopic Fine Defect Segmentation: The microscopic slices in the microscopic slice dataset are input into the trained microscopic fine segmentation network. Local photometric calibration and feature extraction are performed sequentially to obtain deep and shallow feature maps. Then, the deep and shallow texture feature maps are weighted and purified based on the strip spatial attention mechanism to obtain deep semantic feature maps and shallow feature maps. The deep semantic feature maps and shallow feature maps are then fused with receptive field multi-scale features to output a fine feature map. Finally, the pixel-level defect prediction probability map of the slice size is restored and output. S4. Probabilistic-level smoothing reconstruction and post-processing: A probabilistic-level Hanning window weighted smoothing fusion strategy is adopted to perform local spatial weighted accumulation and smooth attenuation reconstruction on the pixel-level defect prediction probability map of all slices in the global spatial coordinate system to obtain a global probability distribution map; finally, the security extraction mask generated in step S1 is called to perform secondary logic and filtering on the global probability distribution map to output the final panoramic defect distribution map of the pipeline weld.
[0036] The specific execution flow of step S1 is as follows: The first stage involves macroscopic weld seam extraction. The internal and external environments of large pipelines are extremely complex. In raw, high-resolution 4K images (e.g., 4000×3000 pixels) captured by industrial cameras, the vast majority of pixels represent defect-free backgrounds. Directly performing global blind slicing easily leads to severe false positives in pure background areas. This stage uses raw 4K panoramic images without any physical cropping as input.
[0037] In the specific implementation, a lightweight YOLOv8 instance segmentation model is selected as the global spatial localization network to quickly extract high-value weld seam regions and output the initial weld seam binary mask. .
[0038] However, in real-world manufacturing processes, undercut defects typically grow close to the outer edge of the weld toe where it meets the base material. Directly using a rigid mask in YOLOv8 for extraction would easily truncate these edge defects at the physical level. Therefore, this embodiment innovatively introduces a morphological dilation operation to construct a secure extraction mask with pixel-tolerant redundancy. Let the morphological uniform structuring element be... (In actual engineering deployment, the preferred size is...) (pixel structure kernel), dilated secure extraction mask The calculation is as follows:
[0039] After this expansion process, the mask extends outwards appropriately, reserving sufficient real context pixels for minor edge defects. This not only completely blocks background interference from large areas of the pipe wall, but also provides extremely safe coordinate navigation for the second stage.
[0040] The specific execution process of step S2 is as follows: Directly feeding 4K large images into the micro-network leads to severe memory overflow and feature loss. Therefore, this invention employs a dynamic overlapping sliding window mechanism: First, extract the security extraction mask mentioned above. The smallest bounding rectangle of the polygonal region serves as the effective traversal boundary for the sliding window. Secondly, the size of the cutting window is set to... For each pixel, a 50% spatial overlap is introduced to preserve local continuity. The sliding step is the product of the window size and the complement of the overlap.
[0041] During dense sliding sampling, to ensure that the neural network learns sufficient physical texture, a hard filtering rule based on the proportion of weld pixels is introduced: the area of weld mask pixels in the current slice view is counted, and if it is lower than a preset threshold of the total window area, such as 10%, it is determined to be pure background redundant data and physically removed.
[0042] In step S3, the microscopic fine detection stage is the core of achieving high-precision pixel-level classification. To address the uneven illumination reflection and intricate topological characteristics, this invention designs a dedicated microscopic fine segmentation network, which comprises the following four core modules: (1) Adaptive Region Contrast Enhancement Module (ARCE): Industrial lighting often produces diffuse reflection, masking dark-area defects. The ARCE module utilizes lightweight convolution to autonomously learn and compensate for these weights. Let the input micro-slice tensor be... First, by using a step size of 1 Convolutional layers and BatchNorm layers (batch normalization layers) are mapped to a space-enhanced mask with values in the 0-1 range via Sigmoid activation. :
[0043] Will Compared with the original input micro-slice tensor Element-wise multiplication, with residual joins introduced, outputs an enhanced slice. :
[0044] in, This represents the Hadamard product. This step clears the photometric domain barrier for subsequent deep feature extraction.
[0045] (2) Feature extraction backbone network truncation optimization: The lightweight and efficient ResNet18 is selected as the backbone network, loaded with ImageNet pre-trained weights, and the original global average pooling and fully connected layers are removed. Specifically, because the pixel area of tiny defects is extremely low, their geometric topology will completely disappear after multiple downsampling. Therefore, this invention actively discards the fourth deepest residual layer of ResNet18, so that the spatial resolution of the deepest semantic feature map output by the network is maintained at 1 / 16 of the original slice. This preserves the spatial boundary information of tiny defects to the greatest extent. Shallow and deep features are extracted layer by layer using this backbone network.
[0046] (3) Striped Spatial Attention Mechanism (SSA): For the elongated and irregular strip-like structure of bite defects, using a conventional square receptive field would severely dilute the defect features. The SSA module utilizes mutually perpendicular one-dimensional pooling instead of two-dimensional pooling. Let the input feature map be... For spatial coordinates passage Its horizontal aggregation characteristics With vertical aggregation features Defined as:
[0047]
[0048] After generating a one-dimensional vector, use the interpolation function Expand it to the size of the original image and add them element-wise, then perform convolution activation to generate an attention mask that can accurately wrap around the slender defect. :
[0049] By using this mask to perform weighted feature extraction, the directional focusing outputs of deep and shallow layers can be obtained separately. :
[0050] This module significantly enhances the ability to detect continuous linear defects through its cross-shaped receptive fields.
[0051] (4) Receptive Field Multi-Scale Feature Fusion Module (RMFF): During the decoding phase, deep feature maps rich in global semantics are fused. Shallow feature maps that preserve high-frequency edge details (That is, the directional focusing output obtained from step 3). First, perform bilinear interpolation on the deep feature map and Convolutional upsampling followed by channel dimensionality reduction:
[0052] In the channel dimension and splicing, channel splicing after Convolutional mapping yields fused features :
[0053] To remove texture noise introduced by shallow layers, average pooling along the channel dimension is calculated. With max pooling distributed:
[0054]
[0055] C represents the total number of channels.
[0056] By splicing the two together, Large kernel convolution and activation to generate spatial feature filtering masks :
[0057] Output the final fine feature map :
[0058] Finally, the classification head is used to reconstruct a single-channel pixel-level probability map of the same size as the slice.
[0059] In step S4, to address the grid-like artifacts and confidence abrupt changes caused by direct hard-slicing of slices, this embodiment introduces a Hanning window weighted smoothing strategy.
[0060] Define the size as One-dimensional Hanning window function :
[0061] Calculate the outer product of two orthogonal one-dimensional sequences to generate a two-dimensional probability weighting matrix. Introducing a minimal constant Truncation to prevent division by zero:
[0062] Constructing a global probability canvas With weighted canvas For length and width of Slice probability matrix When mapping back to the global coordinate system, a local space weighted accumulation is performed:
[0063]
[0064] After traversing all slices, obtain the global normalized probability distribution map. :
[0065] While smoothing eliminates abrupt artifacts, it dilutes the peak probability of elongated defects. Therefore, a lower dynamic confidence threshold needs to be set for binarization. Finally, to completely eliminate isolated noise in the large-area pipe wall background, the secure extraction mask generated in the first step is used. It performs spatial domain logic and filtering operations on the global binary defect mask to filter out false detection noise and pseudo-defects in non-welded areas, and outputs a seamless and high-fidelity panoramic defect distribution map.
[0066] This invention also provides a cascaded segmentation system for weld defects in large pipeline steel cylinders, comprising: The macroscopic extraction module is used to input the original panoramic image of the pipeline weld seam captured by the industrial array camera into the trained global spatial localization network for segmentation, output the initial weld seam binary mask at the panoramic scale, and then perform a morphological dilation operation on the initial weld seam binary mask to obtain a secure extraction mask. The slice extraction module is used to perform dynamic overlapping sliding slice sampling on the original panoramic image based on the effective traversal boundary determined by the security extraction mask, according to the set cutting window size and spatial overlap rate, and remove pure background redundant slices according to the set pixel ratio hard filtering rules to obtain a micro slice dataset. The micro-segmentation module includes an adaptive region contrast enhancement unit, a feature extraction backbone unit, a strip spatial attention unit, and a multi-scale feature fusion unit. The adaptive region contrast enhancement unit performs local photometric calibration on the micro-slices. The feature extraction backbone unit extracts features to obtain deep and shallow texture feature maps. The strip spatial attention unit performs weighted purification on the deep and shallow texture feature maps to obtain deep semantic feature maps and shallow texture feature maps. The multi-scale feature fusion unit performs receptive field multi-scale feature fusion on the deep semantic feature map and shallow feature maps to output a refined feature map and restores it to a pixel-level defect prediction probability map of the slice size. The recombination post-processing module is used to employ a probabilistic Hanning window weighted smooth fusion strategy to perform local spatial weighted accumulation and smooth attenuation recombination on the pixel-level defect prediction probability map of all slices in the global spatial coordinate system to obtain a global probability distribution map; finally, the security extraction mask generated in step S1 is called to perform secondary logic AND filtering on the global probability distribution map to output the final panoramic defect distribution map of the pipeline weld.
[0067] The following are specific examples: 1. Experimental Environment and Dataset Construction To verify the practical effectiveness of the above technical solution, this invention conducted detailed tests on a self-built high-resolution pipeline steel cylinder weld dataset. In this embodiment, the macroscopic dataset contains 1800 images. High-resolution images were generated. After dynamic slicing and cleaning according to the preprocessing rules of this invention, a total of 126,390 microscopic slices were generated, with defects pre-labeled. To prevent spatial data leakage, the training, validation, and test sets were strictly physically isolated at the source image level in a 4:1:1 ratio. Experiments were uniformly performed on a deep learning server equipped with an NVIDIA RTX 5880 Ada GPU. The network used the Adam optimizer with an initial learning rate set to 0.001, coupled with a cosine annealing learning rate scheduling strategy.
[0068] 2. Comparative Experiments and Analysis To highlight the comprehensive performance advantages of the micro-fine segmentation network of this invention in handling complex industrial micro-defects, it was rigorously compared with five mainstream baseline models that are highly representative in the current vision field, including: the classic encoder-decoder architecture UNet, DeepLabv3 based on hollow spatial pyramid pooling, the classic scene parsing network PSPNet, and the single-stage instance segmentation models LF-YOLO and YOLOv8m-seg. The experimental results are summarized in Table 1.
[0069] Table 1 Comparison of quantitative performance of different detection models
[0070] The quantitative comparison results in Table 1 show that the M2M-WeldNet of this invention achieves comprehensive superiority in all core quantitative metrics. Detailed analysis follows: (1) Background noise suppression capability: The traditional UNet model introduces a large amount of high-frequency fish scale pattern background noise due to the use of dense shallow skip connections, and its average crossover union ratio (mIoU) is only 0.698; while the present invention successfully filters out shallow noise through the two-dimensional spatial feature filtering mask in the multi-scale feature fusion module (RMFF), and the mIoU reaches 0.844, which is significantly better than UNet.
[0071] (2) Geometric feature extraction capability for slender defects: The mIoU of DeepLabv3 and PSPNet are 0.751 and 0.794, respectively. The dilated convolution discrete sampling of DeepLabv3 causes topological breakage due to mesh effect in slender defects; the isotropic square receptive field of PSPNet severely dilutes the deep features of slender defects. This invention innovatively introduces a strip spatial attention mechanism (SSA), which uses cross-shaped one-dimensional pooling to perfectly fit the extremely slender topological structure of the bite defect. This not only solves the breakage problem, but also improves the precision and recall to 0.821 and 0.842, respectively, and the F1 score is as high as 0.831.
[0072] (3) High-fidelity reconstruction capability for micro-boundaries: Although YOLOv8m-seg (mIoU of 0.822) exhibits good performance, its feature pyramid downsampling mechanism lacks constraints on minute edge details. This invention actively truncates the fourth residual layer of ResNet18, maintaining the highest resolution at 1 / 16, which greatly protects the fine boundaries. As a result, the pixel-level AUROC of this invention reaches 0.920, and the image-level AUROC reaches 0.969, significantly outperforming the YOLO series in extreme anti-interference potential.
[0073] 3. Ablation Experiments and Analysis To deeply analyze the gain mechanism of each innovative component in this invention on the overall detection performance and to verify the theoretical self-consistency of the architecture design, this embodiment uses M2M-WeldNet, which includes all modules, as the default model, and conducts ablation experiments by sequentially stripping the self-developed core modules using the controlled variable method. The results are summarized in Table 2.
[0074] Table 2 Comparison of ablation experimental performance of M2M-WeldNet core modules
[0075] The quantitative comparison results in Table 2 show that all self-developed modules in the M2M-WeldNet of this invention effectively improve model performance. Detailed analysis follows: (1) Removal of the Adaptive Region Contrast Enhancement Module (ARCE): After removing this module, the model's mIoU slightly decreased from 0.844 to 0.832. This demonstrates that under the harsh conditions of alternating diffuse reflection and local shadows on a metal surface, the pixel-level adaptive photometric compensation achieved by the ARCE module successfully highlighted the hidden defects in dark areas and effectively improved the robustness of the network in complex photometric domains.
[0076] (2) Removal of the Striped Spatial Attention Mechanism (SSA): When the SSA module was removed, the network performance experienced a precipitous global decline, with the accuracy plummeting to 0.798 and the core metric mIoU dropping significantly to 0.794 (a decrease of 4.9%). This dramatic performance decline powerfully demonstrates from the opposite perspective that the SSA module is the most crucial physical barrier to overcome the background dilution effect of the conventional square receptive field and suppress large-area fish-scale pattern false positives, making a decisive contribution to the network's geometric perception capability.
[0077] (3) Removal of the receptive field multi-scale feature fusion module (RMFF): After removing this module, the model's mIoU decreased to 0.814 and the recall rate decreased to 0.806. This indicates that without the RMFF module to finely align deep semantics with shallow details and filter spatial saliency during the decoding stage, the network is prone to losing high-frequency edge information of micron-level defects, leading to missed detection of local micro-defects.
[0078] 4. Verification of panoramic high-resolution reconstruction effect After completing the micro-slicing verification, this embodiment verified the panoramic high-resolution image reconstruction effect. If a conventional hard stitching strategy is used, due to the truncation effect of the receptive field at the edge of the convolutional network, severe grid-like confidence abrupt change artifacts will occur at the slice overlap boundaries. For example... Figure 3The panoramic visualization results shown demonstrate that the probabilistic Hanning window weighted smooth stitching strategy introduced in this invention effectively eliminates numerical abrupt changes in the spatial domain by preserving high confidence at the center and achieving seamless transitions in microscopic slices. Simultaneously, based on smooth reconstruction, the system utilizes a first-stage generated dilatational security extraction mask to perform spatial dimension logic and secondary filtering, thoroughly eliminating isolated noise and false alarms in the pure pipe wall background area. The final output 4K panoramic defect distribution map maintains extremely high purity in the background area while achieving high-fidelity restoration in the weld area.
[0079] In summary, the superior performance of the cascaded segmentation method proposed in this invention does not stem from the stacking of single structures, but rather from the deep collaboration of ARCE photometric calibration, SSA geometric focusing, RMFF cross-scale alignment, and Hanning window smooth stitching. This comprehensively verifies the excellent overall performance and absolute engineering application value of this cascaded architecture in industrial-grade automated quality inspection of large components. It also addresses the technical shortcomings of existing technologies, such as the easy loss of microscopic defect features in welds of large pipe cylinders at ultra-high resolution, low accuracy in identifying slender defects, and severe mesh artifacts easily generated by local slice stitching. Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A cascaded segmentation method for weld defects in pipeline steel cylinders, characterized in that, Includes the following steps: S1. Macroscopic weld seam extraction: The original panoramic image of the pipeline weld seam acquired by the industrial array camera is input into the trained global spatial localization network for segmentation, and the initial weld seam binary mask at the panoramic scale is output. Then, the initial weld seam binary mask is subjected to morphological dilation operation to obtain a secure extraction mask. S2. Dynamic Slicing and Cleaning: Based on the effective traversal boundary determined by the secure extraction mask, the original panoramic image is dynamically overlapped and slicing sampled according to the set cutting window size and spatial overlap rate. Pure background redundant slices are removed according to the set pixel ratio hard filtering rules to obtain a micro-slice dataset. S3. Microscopic Fine Defect Segmentation: The microscopic slices in the microscopic slice dataset are input into the trained microscopic fine segmentation network. Local photometric calibration and feature extraction are performed sequentially to obtain deep and shallow feature maps. Then, the deep and shallow feature maps are weighted and purified based on the strip spatial attention mechanism to obtain deep semantic feature maps and shallow texture feature maps. The deep semantic feature maps and shallow feature maps are then fused with receptive field multi-scale features to output a fine feature map. Finally, the pixel-level defect prediction probability map of the slice size is restored and output. S4. Probabilistic-level smoothing reconstruction and post-processing: A probabilistic-level Hanning window weighted smoothing fusion strategy is adopted to perform local spatial weighted accumulation and smooth attenuation reconstruction on the pixel-level defect prediction probability map of all slices in the global spatial coordinate system to obtain a global probability distribution map; finally, the security extraction mask generated in step S1 is called to perform secondary pixel-level logic AND filtering on the global probability distribution map to output the final panoramic defect distribution map of the pipeline weld.
2. The cascaded segmentation method for weld defects in pipeline steel cylinders as described in claim 1, characterized in that, In step S1, the global spatial localization network is the YOLO instance segmentation network; the security extraction mask generated after dilation... The formula for obtaining it is as follows: in, This is the initial weld seam binary mask for the panoramic scale. A custom morphological uniform structural element.
3. The cascaded segmentation method for weld defects in pipeline steel cylinders as described in claim 1, characterized in that, In step S2, the effective traversal boundary is the minimum bounding rectangle of the secure extraction mask, and the dynamic overlapping sliding slice sampling is performed within the effective traversal boundary. The pixel ratio hard filtering rule includes: counting the area of weld mask pixels in the currently acquired slice field of view; if the total number of effective weld pixels is lower than a preset threshold of the total area of the cutting window, the slice is determined to be a low information entropy pure background redundant slice and is removed.
4. The cascaded segmentation method for weld defects in pipeline steel cylinders as described in claim 1, characterized in that, In step S3, the feature extraction adopts a truncated feature extraction backbone network; the truncated feature extraction backbone network is a ResNet network that removes the global average pooling layer and the fully connected layer and actively discards the fourth deepest residual layer; the spatial resolution of the deepest semantic feature map output by the feature extraction backbone network is maintained at 1 / 16 of the original micro-slice size.
5. The cascaded segmentation method for weld defects in pipeline steel cylinders as described in claim 1, characterized in that, In step S3, the local photometric calibration specifically includes: For the input micro-slice tensor First, convolution and batch normalization are performed, and then a sigmoid non-linear activation function is applied to map the result to a spatial enhancement mask. : The space enhancement mask With the original microscopic slice tensor Element-wise multiplication is performed, and a residual join mechanism is introduced to output an enhanced slice. : in, This represents the element-wise Hadamard product of a matrix.
6. The cascaded segmentation method for weld defects in pipeline steel cylinders as described in claim 1, characterized in that, In step S3, the specific process of weighted purification is as follows: Input feature map Perform strip pooling along both the horizontal and vertical dimensions, for spatial coordinates... passage Its horizontal aggregation characteristics With vertical aggregation features They are respectively: Where H represents the number of pixels in the vertical direction of the image, and W represents the number of pixels in the horizontal direction of the image; Using interpolation functions The horizontal aggregation feature With vertical aggregation features Spatial dimension expansion to the original feature map Generate bar-shaped attention masks by adding elements of the same size one by one. : Then, the bar attention mask is used. For the input feature map We perform spatial dimension weighted refinement to obtain directional and focused output features from deep semantic feature maps and shallow texture feature maps, respectively. .
7. The cascaded segmentation method for weld defects in pipeline steel cylinders as described in claim 1, characterized in that, In step S3, the specific process of multi-scale feature fusion of the receptive field is as follows: Let the deep semantic feature map after the weighted purification be... The shallow texture feature map is Using bilinear interpolation and Convolution performs spatial upsampling and channel dimensionality reduction on deep features: In the channel dimension and splicing, through Convolution yields fused features : Calculate the average pooling distribution for each channel dimension. With maximum pooling distribution : C represents the total number of channels; splicing the average pooling distribution With maximum pooling distribution and after Convolution and Sigmoid activation generate a two-dimensional feature filtering mask. : Finally, the refined feature map is output. .
8. The cascaded segmentation method for weld defects in pipeline steel cylinders as described in claim 1, characterized in that, In step S4, the specific process of the probabilistic Hanning window weighted smoothing fusion strategy is as follows: Define the space dimensions as One-dimensional Hanning window smoothing function : A two-dimensional spatial probability weighting matrix is generated by the outer product of two orthogonal one-dimensional Hanning window sequences. And introduce a minimal constant. Truncation: Construct a global probabilistic canvas with the same spatial dimensions as the original panoramic image. With global weight canvas For the slice probability matrix When mapping back to the global coordinate system, a local space weighted accumulation is performed: After traversing all slices, obtain the global normalized probability distribution map. 。 9. A cascaded segmentation system for weld defects in large pipeline steel cylinders, characterized in that, include: The macroscopic extraction module is used to input the original panoramic image of the pipeline weld seam captured by the industrial array camera into the trained global spatial localization network for segmentation, output the initial weld seam binary mask at the panoramic scale, and then perform a morphological dilation operation on the initial weld seam binary mask to obtain a secure extraction mask. The slice extraction module is used to perform dynamic overlapping sliding slice sampling on the original panoramic image based on the effective traversal boundary determined by the security extraction mask, according to the set cutting window size and spatial overlap rate, and remove pure background redundant slices according to the set pixel ratio hard filtering rules to obtain a micro slice dataset. The micro-segmentation module includes an adaptive region contrast enhancement unit, a feature extraction backbone unit, a strip spatial attention unit, and a multi-scale feature fusion unit. The adaptive region contrast enhancement unit is used to perform local photometric calibration on the micro-slices. The feature extraction backbone unit is used for feature extraction to obtain deep and shallow texture feature maps. The strip spatial attention unit is used to perform weighted purification on the deep and shallow texture feature maps to obtain deep semantic feature maps and shallow texture feature maps. The multi-scale feature fusion unit is used to perform receptive field multi-scale feature fusion on the deep semantic feature maps and shallow features to output a fine feature map. And it is restored to a pixel-level defect prediction probability map of slice size; The recombination post-processing module is used to employ a probabilistic Hanning window weighted smooth fusion strategy to perform local spatial weighted accumulation and smooth attenuation recombination on the pixel-level defect prediction probability map of all slices in the global spatial coordinate system to obtain a global probability distribution map; finally, the security extraction mask generated in step S1 is called to perform secondary logic AND filtering on the global probability distribution map to output the final panoramic defect distribution map of the pipeline weld.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the cascaded segmentation method for weld defects in pipe cylinders as described in any one of claims 1-8.
