A stainless steel pipe defect identification method and system based on multi-parameter signal fusion

By using a multi-parameter signal fusion method and an industrial linear array camera and a dual-stream feature extraction network, the coordinates of the weld reference centerline and weighted suppression mask data are generated, which solves the problem of identifying minute defects and large-area defects in the precision machining of stainless steel pipes, and realizes high-precision defect detection and report generation.

CN122175923APending Publication Date: 2026-06-09ZHEJIANG TSINGSHAN STEEL PIPE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG TSINGSHAN STEEL PIPE CO LTD
Filing Date
2026-03-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately identify minute defects and large-area flaws in complex optical environments during the precision machining of stainless steel pipes, and also suffer from false alarms of weld defects and missing topological information.

Method used

The grayscale scanning data stream is acquired by an industrial linear scan camera to generate the coordinates of the weld reference centerline, establish a sliding cut-out window, construct a distance field distribution matrix and generate weighted suppression mask data, extract pipe wall feature maps using a dual-stream feature extraction network, and perform defect detection and report generation by combining global time-series index data.

Benefits of technology

It achieves accurate identification of minute defects and complete reconstruction of large-area defects in complex optical scenarios, avoids false alarms of weld defects, and ensures the specificity and completeness of the identification report.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122175923A_ABST
    Figure CN122175923A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image detection, in particular to a stainless steel pipe defect identification method and system based on multi-parameter signal fusion. The method comprises the following steps: collecting the gray scale scanning data stream of the surface of the stainless steel pipe, performing longitudinal pixel value projection accumulation operation, generating the weld reference center line coordinates, performing anchor segmentation operation, outputting the standard alignment detection image matrix, calculating the transverse Euclidean distance, constructing the distance field distribution matrix, and converting it into weighted inhibition mask data through a nonlinear inverse mapping function; performing element-by-element point multiplication attenuation operation through a double-flow feature extraction network, outputting the pipe wall feature spectrum; in the parallel decoding topological structure, outputting the local defect detection result, and outputting the stainless steel pipe defect identification report through cross-window coordinate remapping and overlapping area merging operation. The present application takes the weld reference center line coordinate data as the core physical anchor point of the whole-process data coupling architecture, ensuring the integrity of the final defect identification report.
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, specifically to a method and system for identifying defects in stainless steel pipes based on multi-parameter signal fusion. Background Technology

[0002] Real-time monitoring and classification of minute surface defects in specific industrial manufacturing environments (such as precision machining of stainless steel pipes) is an important technological application direction in the current high-end equipment manufacturing field. Existing technologies generally adopt a detection method that combines traditional machine vision with general convolutional neural networks. This involves capturing images of the product surface using an industrial camera, monitoring changes in pixel grayscale or texture features, and automatically identifying and determining the location of the defect target within a pre-defined detection window when a specific threshold is reached or a general feature template is met. This is currently the mainstream technology for achieving automated appearance quality inspection.

[0003] However, existing technologies suffer from significant shortcomings in detection accuracy and environmental adaptability. Their feature extraction models for defect identification are static and lack robust anti-interference capabilities. Existing detection algorithms are largely based on the assumption of an ideal diffuse reflective surface or a fixed texture feature library. Their feature extraction logic cannot adaptively adjust to the high reflectivity and mirror-like physical characteristics of stainless steel pipe surfaces, making it difficult to accurately match complex optical scenarios requiring the measurement of minute defects (such as glare and reflection interference areas). The system performs "snapshot-style" feature convolution only at a fixed resolution or a single receptive field, failing to achieve continuous capture and consideration of multi-dimensional signals. It cannot effectively extract extremely fine hairline scratch features, nor can it accurately define the edges of large, gradually changing pits. Furthermore, the detection process suffers from the problem of maintaining global geometric integrity, failing to accurately restore the true morphology of long-sized defects spanning the window while effectively suppressing false weld defect alarms, resulting in a lack of topological information in the final identification data.

[0004] To address this, a method and system for identifying defects in stainless steel pipes based on multi-parameter signal fusion is proposed. Summary of the Invention

[0005] The purpose of this invention is to provide a method and system for identifying defects in stainless steel pipes based on multi-parameter signal fusion, so as to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for identifying defects in stainless steel pipes based on multi-parameter signal fusion, comprising: The grayscale scanning data stream of the stainless steel pipe surface is acquired by an industrial line scan camera. The vertical pixel value projection accumulation operation is performed on the grayscale scanning data stream to generate the weld reference center line coordinates. Based on the weld reference center line coordinates, a sliding clipping window is established to perform anchoring segmentation operation on the grayscale scanning data stream, and output standard aligned detection image matrix and global temporal index data. The lateral Euclidean distance of pixels in the standard aligned detection image matrix relative to the vertical central axis is calculated to construct the distance field distribution matrix, and then transformed into weighted suppression mask data through a nonlinear inversion mapping function. The standard aligned detection image matrix and the weighted suppression mask data are input into the dual-stream feature extraction network. The weighted suppression mask data is used to perform an element-wise dot product decay operation on the feature mapping tensor generated based on the standard aligned detection image matrix, and the pipe wall feature map is output. The pipe wall feature map is input into the parallel decoding topology to predict the bounding box position and category probability, and output the local defect detection results. The global temporal index data is used to perform cross-window coordinate remapping and overlapping region merging operations on the local defect detection results, and output the stainless steel pipe defect identification report.

[0007] Preferably, the specific process for generating the weld reference centerline coordinates includes: receiving a grayscale scan data stream quantized and output by an industrial line scan camera through a photoelectric conversion element and an analog-to-digital conversion module; performing a longitudinal pixel value projection accumulation operation on the grayscale scan data stream to construct a transverse projection distribution vector; calculating the difference amplitude of adjacent elements of the transverse projection distribution vector to generate a texture change rate statistical curve; locking the local response region in the texture change rate statistical curve where peaks are clustered and connected, and outputting the weld reference centerline coordinate data.

[0008] Preferably, the specific generation process of the standard alignment detection image matrix and global temporal index data includes: using the weld reference centerline coordinate data as geometric anchor points, combined with the preset pipe wall unfolding perimeter parameters, calculating the lateral truncation boundary range corresponding to each frame scan line; performing a sliding window scanning operation along the longitudinal transmission dimension of the grayscale scan data stream according to a fixed pixel step size parameter, establishing a sliding clipping window, and locking the local pixel array to be processed; extracting the grayscale values ​​within the lateral truncation boundary range, and recombining the grayscale values ​​into a standard alignment detection image matrix; synchronously reading the start scan line number marker and end scan line number marker corresponding to the current sliding window scanning operation, and outputting the global temporal index data.

[0009] Preferably, the specific generation process of the weighted suppression mask data includes: parsing the column pixel count attribute of the standard aligned detection image matrix as a horizontal resolution dimension parameter, and establishing the vertical central axis of the image plane as a zero-distance reference; traversing the pixel array in the standard aligned detection image matrix, calculating the horizontal absolute difference between the column coordinate index of the pixel unit and the zero-distance reference, and generating a horizontal Euclidean distance distribution matrix; inputting the horizontal Euclidean distance distribution matrix into a nonlinear inversion mapping model containing inverse proportional decay logic, performing amplitude compression operation on the weld neighborhood elements in the horizontal Euclidean distance distribution matrix that approach zero, and performing numerical preservation operation on the pipe wall region elements far from the zero-distance reference, and outputting the weighted suppression mask data.

[0010] Preferably, the specific generation process of the pipe wall feature map includes: injecting the standard aligned detection image matrix into the texture encoding path of the dual-stream feature extraction network, extracting geometric morphological information using hierarchical convolution operations, and generating a feature mapping tensor; simultaneously injecting the weighted suppression mask data into the topology gating path of the dual-stream feature extraction network, performing spatial dimension alignment operations, and generating a spatial gating gain tensor; using the spatial gating gain tensor as a modulation coefficient, performing element-wise Hadamard product operations on the feature mapping tensor, and performing element-wise dot product attenuation operations on the activation values ​​of neurons corresponding to the weld topology positions in the feature mapping tensor, and outputting the pipe wall feature map.

[0011] Preferably, the specific construction of the dual-stream feature extraction network includes: constructing a parallel texture encoding path and a topology-gated path, and establishing a feature modulation convergence node at the end; the texture encoding path is configured with cascaded convolutional filtering units, batch normalization units, and nonlinear activation units, used to receive the standard aligned detection image matrix, extract geometric texture information through hierarchical feature abstraction operations, and output a feature mapping tensor; the topology-gated path is configured with an adaptive average pooling unit and a dimension alignment unit, used to receive the weighted suppression mask data, perform spatial resolution compression and channel dimension expansion operations, so that the geometric scale of the weighted suppression mask data is consistent with the feature mapping tensor, and output a spatial gating gain tensor; the feature modulation convergence node connects the texture encoding path and the topology-gated path through a broadcast mechanism, uses the spatial gating gain tensor to perform amplitude normalization operations on the feature mapping tensor, and outputs a pipe wall feature map.

[0012] Preferably, the specific generation process of the local defect detection result includes: constructing a parallel decoding topology structure containing a category prediction channel and a location regression channel; controlling the category prediction channel to perform global semantic parsing operation on the pipe wall feature map, calculating the confidence distribution vector of the feature response value belonging to a preset defect type, and outputting defect category probability data; controlling the location regression channel to perform boundary sensitivity analysis operation on the pipe wall feature map, deriving the geometric offset of the center coordinates and size parameters of the target to be tested relative to a preset geometric anchor frame, and outputting the bounding box position parameters; performing channel-level splicing and encapsulation operation on the defect category probability data and the bounding box position parameters, and outputting the local defect detection result.

[0013] Preferably, the specific generation process of the stainless steel pipe defect identification report includes: reading the starting scan row number marker of the global time-series index data and establishing it as the global vertical offset reference; parsing the bounding box position parameters contained in the local defect detection results and separating the vertical local coordinate values ​​relative to the geometric origin of the standard aligned detection image matrix; performing a linear superposition operation on the vertical local coordinate values ​​and the global vertical offset reference to generate global vertical absolute coordinates mapped to the grayscale scan data stream and constructing a panoramic defect distribution set; traversing the panoramic defect distribution set and performing geometric intersection-union analysis on defect targets located at the edges of different slice windows and spatially adjacent to each other to lock the same defect entity that is broken due to slice segmentation; performing a maximum envelope fusion operation on the bounding box coordinates of the same defect entity and performing a weighted average calculation on the confidence parameters to output the stainless steel pipe defect identification report.

[0014] A stainless steel pipe defect identification system based on multi-parameter signal fusion includes: Weld topology anchoring module: It acquires grayscale scan data streams of stainless steel pipe surface through industrial line scan cameras, performs vertical pixel value projection accumulation operation on grayscale scan data streams to generate weld reference centerline coordinates; based on weld reference centerline coordinates, it establishes a sliding clipping window to perform anchoring segmentation operation on grayscale scan data streams, and outputs standard alignment detection image matrix and global temporal index data. Distance field construction module: Calculates the lateral Euclidean distance of pixels in the standard aligned detection image matrix relative to the vertical central axis, constructs the distance field distribution matrix, and transforms it into weighted suppression mask data through a nonlinear inversion mapping function; Dual-stream feature suppression module: Input the standard aligned detection image matrix and weighted suppression mask data into the dual-stream feature extraction network, and use the weighted suppression mask data to perform element-wise multiplication attenuation operation on the feature mapping tensor generated based on the standard aligned detection image matrix, and output the pipe wall feature map; Cross-domain spatiotemporal reconstruction module: Input the pipe wall feature map into the parallel decoding topology, predict the location and category probability of the defect bounding box, and output the local defect detection results; use global temporal index data to perform cross-window coordinate remapping and overlapping area merging operations on the local defect detection results, and output a stainless steel pipe defect identification report.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. By performing longitudinal pixel value projection and accumulation operations on the original continuous grayscale scan data stream, the coordinate data of the weld reference centerline is identified, and a sliding clipping window is established to perform anchoring segmentation operations. The randomly drifting pipe wall image is transformed into a standard aligned detection image matrix with a unified geometric reference system, ensuring the spatial consistency of the input data in the physical topology. This avoids feature misalignment caused by pipe transmission jitter and provides a stable geometric reference for subsequent feature processing.

[0016] 2. A nonlinear inversion mapping function is used to transform the distance field distribution matrix calculated based on the geometric centerline into weighted suppression mask data, which is then synchronously injected into the topology-gated path of the dual-stream feature extraction network. By performing an element-wise multiplication attenuation operation on the shallow feature map generated by the standard aligned detection image matrix, the high-frequency texture response corresponding to the weld topology position is forcibly attenuated at the source of feature extraction, directly outputting the pipe wall feature map. This achieves highly deterministic physical suppression of weld pseudo-defects while preserving the features of minor defects in non-weld areas.

[0017] 3. Utilizing the global temporal index data generated synchronously during the slicing stage, cross-window coordinate remapping and overlapping region merging operations are performed on the local defect detection results. By restoring discrete vertical local coordinate values ​​to global vertical absolute coordinates and constructing a panoramic defect distribution set, geometric intersection-union analysis is performed on defect targets located at the edge of the slicing window. Targets that are broken due to physical segmentation are logically reconstructed into the same defect entity, ultimately outputting an identification report containing the complete defect morphology, realistically restoring the topological information of long-sized defects across the window.

[0018] 4. This invention constructs a full-process data coupling architecture with weld reference centerline coordinate data as the core physical anchor point. This architecture utilizes the weld reference centerline coordinate data as a spatial reference system, generating weighted suppression mask data through a nonlinear inversion mapping function to achieve precise suppression of weld texture within the standard aligned detection image matrix during the feature extraction stage. Simultaneously, it serves as a temporal reference system, driving the generation of global temporal index data to support the logical reconstruction of local defect detection results into a panoramic defect distribution set during the result output stage. This serially dependent data stream processing mode achieves closed-loop control from physical anchoring and feature decoupling to spatiotemporal reconstruction, thereby simultaneously resolving the contradiction between false weld defect reports and missing topological information within a single detection data stream, ensuring the specificity and completeness of the final identification report. Attached Figure Description

[0019] Figure 1 The flowchart illustrates a method for identifying defects in stainless steel pipes based on multi-parameter signal fusion, as proposed in an embodiment of this invention. Figure 2 This is a flowchart illustrating the geometric deformation and manifold space construction process proposed in an embodiment of this invention. Figure 3 This is a flowchart of the neural texture representation and image enhancement generation process proposed in an embodiment of this invention application; Figure 4 This is a structural diagram of a stainless steel pipe defect identification system based on multi-parameter signal fusion, as proposed in an embodiment of this invention. Detailed Implementation

[0020] 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.

[0021] Please see Figures 1-3 The present invention provides a method for identifying defects in stainless steel pipes based on multi-parameter signal fusion, the specific steps of which are as follows: The grayscale scanning data stream of the stainless steel pipe surface is acquired by an industrial line scan camera. The vertical pixel value projection accumulation operation is performed on the grayscale scanning data stream to generate the weld reference center line coordinates. A sliding clipping window is established to perform anchoring segmentation operation on the grayscale scanning data stream and output standard aligned detection image matrix and global temporal index data. The lateral Euclidean distance of each pixel in the standard aligned detection image matrix relative to the vertical central axis is calculated to construct the distance field distribution matrix, and then transformed into weighted suppression mask data through a nonlinear inversion mapping function. The standard aligned detection image matrix and the weighted suppression mask data are input into the dual-stream feature extraction network. The weighted suppression mask data is used to perform an element-wise dot product decay operation on the feature mapping tensor generated based on the standard aligned detection image matrix, and the pipe wall feature map is output. The pipe wall feature map is input into the parallel decoding topology to predict the bounding box position and category probability, and output the local defect detection results. The global temporal index data is used to perform cross-window coordinate remapping and overlapping region merging operations on the local defect detection results, and output the stainless steel pipe defect identification report.

[0022] The technical solution of the present invention will be further described in detail below with reference to specific embodiments.

[0023] Example 1 This application discloses a method for identifying defects in stainless steel pipes based on multi-parameter signal fusion. (See attached document.) Figure 1 The specific steps proposed in this invention include: S1. Acquiring grayscale scan data streams of the stainless steel pipe surface using an industrial linear scan camera, performing longitudinal pixel value projection accumulation operations on the grayscale scan data streams to generate weld reference centerline coordinates, establishing a sliding clipping window, performing anchoring segmentation operations on the grayscale scan data streams, and outputting a standard aligned detection image matrix and global temporal index data; S2. Calculating the lateral Euclidean distance of each pixel in the standard aligned detection image matrix relative to the vertical central axis, constructing a distance field distribution matrix, and converting it into weighted suppression mask data through a nonlinear inversion mapping function; S3. Inputting the standard aligned detection image matrix and weighted suppression mask data into a dual-stream feature extraction network, using the weighted suppression mask data to perform element-wise multiplication attenuation operations on the feature mapping tensor generated based on the standard aligned detection image matrix, and outputting a pipe wall feature map; S4. Inputting the pipe wall feature map into a parallel decoding topology structure, predicting the bounding box position and category probability, and outputting local defect detection results; S5. Using the global temporal index data to perform cross-window coordinate remapping and overlapping region merging operations on the local defect detection results, and outputting a stainless steel pipe defect identification report.

[0024] Further, grayscale scan data streams of the stainless steel pipe surface are acquired using an industrial linear scan camera. Vertical pixel value projection and accumulation operations are performed on the grayscale scan data streams to generate the weld reference centerline coordinates; this corresponds to step S1 above; see [link to relevant documentation]. Figure 2 The specific implementation process includes: The system receives a grayscale scan data stream quantized and output by an industrial linear scan camera through a photoelectric conversion element and an analog-to-digital conversion module; performs a longitudinal pixel value projection accumulation operation on the grayscale scan data stream to construct a transverse projection distribution vector; calculates the difference amplitude of adjacent elements of the transverse projection distribution vector to generate a texture change rate statistical curve; locks the local response region in the texture change rate statistical curve where the peaks are clustered and connected, and outputs the coordinate data of the weld reference centerline.

[0025] Specifically, the process for generating the coordinate data of the weld reference centerline is as follows: In this embodiment, a high-speed line scan camera paired with an 85mm industrial macro lens is used to acquire data on a production line where stainless steel pipes are transported at a speed of 45m / min. The industrial line scan camera and the photoelectric incremental encoder are connected via a high-speed image acquisition card with an FPGA chip. The pulse signal output by the encoder serves as the hard trigger signal for the camera, controlling the camera's line exposure. Simultaneously, upon receiving each line of image data, the acquisition card, through hardware logic, writes the current encoder count value into the frame header information of that line of image data. The photoelectric conversion element converts the optical signal into an analog electrical signal, which is then quantized into an 8-bit digital signal by an analog-to-digital converter driven by a 45kHz line frequency. This digital signal is then stacked in memory to form an 8192×1024 grayscale scan data stream matrix, where 8192 represents the number of pixels covering the horizontal perimeter and 1024 represents the number of cumulative lines in the vertical direction.

[0026] In this embodiment, a background illumination model is established, the row mean distribution curve of the grayscale scan data stream is calculated, the illumination reference surface is fitted by a sliding smoothing filter, background subtraction and adaptive gain compensation are performed, and the corrected grayscale data stream is output. Given the uneven reflection on the stainless steel pipe surface, an illumination correction mechanism is introduced before projection accumulation. The first 200 rows of the grayscale scan data stream are selected as initial samples, the pixel grayscale mean of each column is calculated, and an initial horizontal illumination distribution vector is constructed. This vector is smoothed using a moving average filter with a window size of 64 to fit the illumination reference surface curve. Real-time correction is then performed on the data stream: for any original pixel value at any coordinate, the corrected pixel value is calculated as the difference between the original pixel value and the illumination reference value of the corresponding column, multiplied by a contrast gain coefficient, and then added to a brightness compensation constant. The contrast gain coefficient is set to 1.2, and the brightness compensation constant is set to 128. If the corrected pixel value exceeds the range of 0 to 255, numerical truncation is performed. Every 2048 rows of data are processed, the illumination reference plane curve is resampled and updated to adapt to light source aging or changes in ambient light, eliminating the reference drift caused by highly reflective areas. This process eliminates uneven illumination caused by pipe wall curvature, improving the signal-to-noise ratio and stability of subsequent weld centerline positioning.

[0027] A vertical pixel value projection accumulation operation is performed on the grayscale scan data stream: the horizontal coordinate of the grayscale scan data stream matrix is ​​defined to range from 1 to 8192, and the vertical coordinate range is defined to range from 1 to 1024. A vertical accumulation operation is performed on the grayscale values ​​of each column of pixels, that is, the grayscale values ​​of all pixels corresponding to the same horizontal coordinate are summed, and a one-dimensional array of length 8192 is output, which is the horizontal projection distribution vector. During the accumulation process, 32-bit unsigned integers are used to store the accumulation results to avoid numerical overflow. In this process, the numerical differences caused by the welding heat effect and reflective characteristics in the weld area (e.g., the accumulated value of the weld exceeds 200,000, significantly higher than the 120,000 of the base material) are utilized to compress the two-dimensional image features into a one-dimensional space, constructing a horizontal projection distribution vector with a high signal-to-noise ratio.

[0028] A first-order difference operation is performed on the generated transverse projection distribution vector. The specific calculation formula is: the texture change rate value at the current index position is equal to the absolute value of the value at the current position in the transverse projection distribution vector minus the value at the previous position. By traversing the entire vector, a new sequence of length 8191 is generated, which is the texture change rate statistical curve. Due to the randomness and uniformity of the surface brushed texture in the base material area, its numerical change on the projection vector is relatively gentle, and the amplitude after difference usually fluctuates within a small range, such as below 500. However, at the weld edge, due to the drastic changes in morphology and gloss, the projection value will jump, causing the difference amplitude to rise sharply, possibly reaching 5,000 or even higher.

[0029] An adaptive segmentation threshold is set to the global mean plus three times the standard deviation. The texture change rate statistical curve is scanned, and all index points with values ​​greater than the adaptive segmentation threshold are selected. The connectivity of these index points is then checked. In this embodiment, the weld width typically corresponds to 200 to 300 pixels wide on the image. Therefore, a continuous region with a span between 200 and 400 pixels and the highest peak density is locked as the weld response area. If multiple response areas exist (such as water stain interference), prior positional constraints are introduced or the region with the largest energy integral is selected. After locking the region, the weighted geometric center of all index coordinates within that region is calculated. That is, the index coordinates are weighted using the texture change rate value as the weight, and the calculated result is the weld reference centerline coordinate. This coordinate data is accurate to the sub-pixel level; for example, the output coordinate is 4096.5.

[0030] By using vertical pixel value projection and accumulation operations, the signal amplitude in the weld region is enhanced through accumulation operations, while randomly distributed speckle noise is smoothed, achieving initial localization with a high signal-to-noise ratio. Furthermore, by calculating the differential amplitude of adjacent elements to generate a statistical curve of texture change rate, the abrupt changes in texture gradient are captured. This dual-confirmation mechanism can lock onto locally connected response regions with clustered peaks, ensuring stable output of weld centerline coordinates even under complex conditions such as uneven illumination or oil contamination on the pipe wall. This lays a geometric reference for subsequent establishment of a sliding clipping window and construction of a distance field mask, avoiding misalignment of the suppression range due to reference offset.

[0031] Furthermore, based on the weld reference centerline coordinates, a sliding clipping window is established to perform anchoring segmentation on the grayscale scan data stream, outputting a standard aligned detection image matrix and global temporal index data; corresponding to step S1 above; see [link to relevant documentation]. Figure 2 The specific implementation process includes: Using the weld reference centerline coordinate data as geometric anchor points and combined with the preset pipe wall unfolding perimeter parameters, the lateral cutting boundary range corresponding to each frame scan line is calculated; along the longitudinal transmission dimension of the grayscale scan data stream, a sliding window scan operation is performed according to a fixed pixel step size parameter to establish a sliding clipping window and lock the local pixel array to be processed; the grayscale values ​​within the lateral cutting boundary range are extracted and recombined into a standard aligned detection image matrix; the start scan line number marker and end scan line number marker corresponding to the current sliding window scan operation are read synchronously, and global temporal index data is output.

[0032] Specifically, the process of creating a sliding clipping window is as follows: In this embodiment, a weld reference centerline coordinate array of length 8192 is read, denoted as C. Based on the width of the heat-affected zone of the stainless steel pipe (typically 5mm to 8mm) and the required background context information, the pixel width parameter of the region of interest is preset to 512 pixels, corresponding to a physical width of approximately 12.8mm. For the i-th row in the grayscale scan data stream, the left boundary coordinate is calculated as the centerline coordinate of that row minus half of the width parameter, and the right boundary coordinate is calculated as the centerline coordinate plus half of the width parameter. This process is performed line by line for each scan frame to ensure that even if the weld moves left and right in the 8,000-pixel wide frame, the calculated lateral interception boundary range always has the weld as the absolute geometric center.

[0033] The height and width parameters of the sliding clipping window are set to be the same, both 512 pixels. In this embodiment, an overlap sampling strategy is set, with a fixed pixel step size of 256 pixels, meaning the step size is equal to half the window height. This means that each sliding window has a vertical overlap area of ​​256 rows of pixels with the previous window (i.e., a 50% overlap rate). As the scan index advances along the vertical axis, a window construction is triggered every 256 newly read rows of data, locking the local pixel array within the range from the vertical axis to the vertical axis plus the height parameter as the object to be processed.

[0034] Specifically, the generation process of the standard aligned detection image matrix and the global temporal index data is as follows: Based on the calculated dynamic horizontal boundary (from left boundary coordinates to right boundary coordinates) and vertical window range (from vertical axis to vertical axis plus height parameter), pixels are extracted from the original massive grayscale data stream. It's worth noting that direct cropping would distort the image due to the varying horizontal offset of each row; therefore, row alignment and reorganization are performed: the 512 pixels extracted from each row are shifted and written to a new memory block, ensuring that the weld centers of all scanned rows are strictly vertically aligned in the new matrix. The output standard alignment detection image matrix is ​​a 512×512 single-channel grayscale matrix, with pixel values ​​normalized to between 0 and 1.

[0035] While generating each image matrix, a structured meta-data packet, namely a global temporal index, is created. This index records the absolute start and end row numbers of the current matrix in the raw data stream, as well as the corresponding physical encoder meter value (e.g., at the 500m mark). If a subsequent model identifies a defect in an image matrix, it will use the global temporal index data, combined with the local coordinates of the defect in the standard aligned detection image matrix, and employ linear interpolation formulas to infer the macroscopic physical coordinates of the defect on the entire steel pipe.

[0036] By using the weld seam reference centerline as a geometric anchor point and combining it with the pipe wall unfolding circumference parameter to calculate the lateral cutting boundary, it is ensured that the standard aligned detection image matrix of each frame is strictly symmetrical with the weld seam as the center. This allows the subsequent feature extraction network to focus on the mining of subtle defect features. Simultaneously, a rigorous global temporal index data is constructed during the sliding window scanning process. This preserves the continuity of the original data flow logic while performing data dimensionality reduction processing. It not only provides the sole mathematical basis for subsequently restoring local coordinates to global coordinates but also provides a data interface for handling ultra-long defects spanning multiple clipping windows, ensuring the continuity of the detection system's perception of long-sized defects.

[0037] Further, the lateral Euclidean distance of each pixel in the standard aligned detection image matrix relative to the vertical central axis is calculated to construct a distance field distribution matrix, which is then transformed into weighted suppression mask data through a nonlinear inversion mapping function; this corresponds to step S2 above; the specific implementation process includes: The number of column pixels in the standard alignment detection image matrix is ​​analyzed as the horizontal resolution dimension parameter, and the vertical central axis of the image plane is established as the zero-distance reference. The pixel array in the standard alignment detection image matrix is ​​traversed, and the horizontal absolute difference between the column coordinate index of each pixel unit and the zero-distance reference is calculated to generate a horizontal Euclidean distance distribution matrix. The horizontal Euclidean distance distribution matrix is ​​input into a nonlinear inversion mapping model containing inverse proportional decay logic. Amplitude compression is performed on the weld neighborhood elements in the horizontal Euclidean distance distribution matrix that approach zero, and numerical preservation is performed on the pipe wall region elements that are far from the zero-distance reference. Weighted suppression mask data is output.

[0038] Specifically, the process of outputting the weighted suppression mask data is as follows: The algorithm receives a single-channel grayscale tensor from the previous pipeline, its dimensions strictly normalized to 512 by 512 pixels, where 512 represents the physical width of the stainless steel pipe wall, approximately 12.8 mm laterally. The algorithm first extracts the width attribute value of 512 from the matrix and calculates the column index value of 256 through integer division, defining it as the vertical central axis of the image plane. Physically, this central axis precisely maps to the geometric center of the weld pool. This column index is marked as the "zero-distance reference," and a 32-bit floating-point buffer with dimensions identical to the original image is initialized in video memory. This step establishes an absolute spatial coordinate system, ensuring that all subsequent signal suppression operations radiate outwards from the weld center, thereby accurately distinguishing the high-noise weld area from the base material area to be detected and preventing erroneous suppression of microcracks due to reference system bias.

[0039] Leveraging the parallel computing capabilities of the GPU, 512 thread blocks are launched to process each row of the image simultaneously. For a pixel at any coordinate position in the matrix, the algorithm reads its column coordinate index and calculates the absolute difference between that index and the zero-distance reference value of 256. Since the input image has undergone geometric correction, the weld centers in each row are vertically aligned, so there is no need to calculate the vertical component. The calculation results are filled into a preset buffer to form a horizontal Euclidean distance distribution matrix. In the horizontal Euclidean distance distribution matrix, all elements in column 256 have a value of 0, representing the point closest to the weld center; as the column index extends to the left and right, the value increases linearly until it reaches 256 at the edge. This matrix quantifies the spatial deviation of each pixel relative to the interference source (weld). For example, the value at a distance of 80 pixels (approximately 2 mm) from the center is recorded as 80, providing accurate input variables for subsequent nonlinear mapping.

[0040] In this embodiment, a horizontal Sobel gradient operation is performed on the standard aligned detection image matrix to lock the high-frequency edge coordinates on both sides of the weld, calculate the actual physical width of the weld, and perform nonlinear scaling correction on the horizontal Euclidean distance distribution matrix based on the width change rate. Considering that the weld width is not constant due to welding process fluctuations, it is necessary to correct the simple geometric center distance. A 1x3 Sobel operator is used to convolve the image matrix row by row to extract the horizontal gradient map. To adapt to the edge blurring caused by welding process fluctuations, the gradient threshold is determined using an adaptive statistical method: that is, the gradient magnitude histogram of the current scan row is statistically analyzed, and the value at the high quantile (e.g., 95th percentile) is selected as the dynamic gradient threshold, which is 45 in this embodiment. The first extreme point with a gradient magnitude greater than the threshold is searched within 100 pixels to the left and right of the vertical center line (column index 256), and marked as the left edge and right edge, respectively. The actual half-width of the current row is calculated as the difference between the right edge coordinate and the left edge coordinate divided by 2. A width correction factor is introduced, the value of which is equal to the actual half-width divided by the preset standard weld half-width (set to 80 pixels). If oil stains or lighting interference prevent the detection of effective edges within the preset range, a timing rollback logic is triggered: the width correction factor from the previous row's successful scan is automatically invoked. The element values ​​in the distance field distribution matrix are updated: for any column index, the corrected distance value is equal to the original distance between that point and the vertical centerline divided by the width correction factor. This step ensures that the distance field value truly reflects the normalized distance of the pixel relative to the edge of the weld heat-affected zone, enabling the suppression mask to dynamically adapt to changes in weld width and preventing texture features from escaping suppression at wide weld edges.

[0041] The core of the nonlinear inversion mapping model is a custom differentiable computation layer inherited from the neural network base class (Layer in this embodiment). This layer internally maintains two trainable scalar parameters: edge kurtosis coefficient and half-saturation constant. Its mathematical logic is described as follows: the output mask weights are equal to the edge kurtosis coefficient of the input distance value raised to the power of the input distance value, divided by the sum of the edge kurtosis coefficient of the distance value raised to the power of the input distance value and the half-saturation constant. To ensure numerical stability, a smoothing non-negativity constraint function (Softplus function in this embodiment) is applied to these two parameters before forward propagation computation to ensure that their values ​​are always greater than zero, preventing numerical anomalies where the denominator is zero.

[0042] During the model training phase, the initial parameters were set with an edge kurtosis coefficient of 2.0 and a half-saturation constant of 80 (corresponding to a weld half-width of approximately 2 mm). Considering that the physical half-width of the heat-affected zone of stainless steel pipe welds typically fluctuates between 1.5 mm and 2.5 mm, and combined with the image resolution (0.025 mm / pixel), the adjustable range of the half-saturation constant was strictly limited to the range of [60, 100]. Simultaneously, to ensure that the suppressed edges have a moderately smooth transition characteristic to avoid high-frequency artifacts, the adjustable range of the edge kurtosis coefficient was limited to the range of [1.5, 3.0]. If it exceeds the aforementioned preset physical constraint boundary, it is forcibly truncated to the corresponding boundary value. The convergence condition for parameter optimization of the nonlinear inversion mapping model was set as follows: when the update variation of the edge kurtosis coefficient and the half-saturation constant in five consecutive training rounds is less than one ten-thousandth, and the values ​​of both parameters are stably within the preset physical constraint range, the model is considered to have reached convergence, and the values ​​of these two parameters are locked so that they are no longer updated with subsequent training of the backbone network.

[0043] The nonlinear inversion mapping model employs end-to-end backpropagation training. It utilizes the automatic differentiation mechanism of the deep learning framework to calculate the gradients for the edge kurtosis coefficient and half-saturation constant. Optimization is achieved using a weighted binary cross-entropy loss function combined with the Dice coefficient loss function. Specifically, the objective function is calculated as follows: the total loss equals the weighted binary cross-entropy loss multiplied by a first weight coefficient, plus the Dice coefficient loss multiplied by a second weight coefficient. In this embodiment, both the first and second weight coefficients are set to 0.5. This weighting is chosen because the weighted binary cross-entropy loss focuses on pixel-by-pixel classification accuracy, while the Dice coefficient loss focuses on the overall geometric overlap. Equal weighting of both balances the model's ability to classify micro-pixels at the weld edge and its ability to fit the macro-mask morphology, preventing the model from becoming trapped in local optima due to excessive focus on a single metric. To prevent gradient explosion during the calculation process, a gradient cutoff threshold is set on the backpropagation path of this layer. Specifically, the gradient cutoff threshold is set to 1, a value determined based on statistical analysis of the gradient norm of the edge kurtosis coefficient and half-saturation constant during the pre-training phase. Statistical results show that within a range of good numerical stability, the average gradient norm is approximately 0.1, while abnormal fluctuation peaks typically exceed 5. For weld center neighborhood pixels with distance values ​​close to 0, the numerator is extremely small, resulting in the output mask weights being compressed to the order of 0.001. Conversely, for pipe wall region pixels with distance values ​​greater than 150, the numerator is much larger than the constant term in the denominator, and the output value approaches 1.0. The output data is the high-precision weighted suppression mask data.

[0044] For weld neighborhoods with values ​​approaching zero, high-intensity amplitude compression is applied, reducing the activation ability of pixels in that region for the neural network; while for pipe wall regions far from the reference, their numerical features are fully preserved. This soft suppression strategy effectively shields weld texture interference while avoiding the problem of missing micro-cracks at weld edges caused by hard clipping, thus improving detection sensitivity and discrimination in weld edge areas.

[0045] Furthermore, the standard aligned detection image matrix and the weighted suppression mask data are input into a two-stream feature extraction network. The weighted suppression mask data is used to perform an element-wise multiplication attenuation operation on the feature mapping tensor generated based on the standard aligned detection image matrix, outputting a pipe wall feature map; this corresponds to step S3 above. The specific implementation process includes: The standard aligned detection image matrix is ​​injected into the texture encoding path of the dual-stream feature extraction network, and geometric morphological information is extracted using hierarchical convolution operations to generate a feature mapping tensor. Simultaneously, the weighted suppression mask data is injected into the topology gating path of the dual-stream feature extraction network, and spatial dimension alignment operations are performed to generate a spatial gating gain tensor. Using the spatial gating gain tensor as modulation coefficients, element-wise Hadamard product operations are performed on the original feature mapping tensor. Element-wise dot product attenuation operations are performed on the activation values ​​of neurons corresponding to the weld topology positions in the feature mapping tensor to output the pipe wall feature map.

[0046] Specifically, the construction and calculation process of the texture coding path of the two-stream feature extraction network are as follows: The texture encoding pathway, as the backbone of the two-stream feature extraction network, is responsible for capturing the microscopic texture and macroscopic defect morphology of the stainless steel pipe surface. In this embodiment, the texture encoding pathway adopts a variant structure of a deep residual network, specifically a ResNet-34 architecture with the fully connected layers removed. First, a single-channel standard-aligned detection image matrix of dimension 512×512 is received. This matrix is ​​normalized, with pixel values ​​distributed between 0 and 1. The input layer uses a 7×7 convolutional kernel with a stride of 2 for primary feature extraction, followed by a max-pooling layer to downsample the feature map size to 128×128. Next, the data stream passes through four cascaded convolutional stages: the first stage contains three residual blocks with 64 output channels; the second stage contains four residual blocks with 128 output channels; the third stage contains six residual blocks with 256 output channels; and the fourth stage contains three residual blocks with 512 output channels. The internal structure of each residual block adopts a basic residual unit structure. Each basic residual unit contains two parallel paths: the main path sequentially connects the first convolutional layer, the first batch normalization layer, the modified linear unit activation layer, the second convolutional layer, and the second batch normalization layer; the bypass path is a shortcut connection. The outputs of the two paths are element-wise added at the end, and the final feature is output through the modified linear unit activation layer.

[0047] Regarding the hierarchical downsampling strategy, the spatial resolution downsampling operations of the feature maps are distributed at the entrances of the second, third, and fourth convolutional stages. Specifically, the first convolutional layer in the first residual block of these stages has its stride parameter set to 2, thereby downsampling the feature map size from 128×128 to 64×64, 32×32, and 16×16 respectively, achieving an 8-fold spatial downsampling. Correspondingly, within each convolutional stage, the shortcut connections of the residual blocks other than the first residual block use identity mapping; while at the first residual block of the second, third, and fourth convolutional stages, since the feature map size is halved and the number of channels is multiplied, the shortcut connections use projection mapping layers configured with 1×1 convolutional kernels to synchronously match the geometric size and channel dimension of the feature map. Finally, the deep network gradually abstracts geometric features with high semantic information (including complex feature responses that mix inherent weld texture noise and potential defect structures), outputting a feature map tensor with a dimension of 512×16×16. To prevent gradient vanishing during training, batch normalization is performed after each convolutional layer, and the mean and variance are updated using a moving average method with a momentum parameter of 0.1.

[0048] Specifically, the construction and calculation process of the topology-gated path of the two-stream feature extraction network are as follows: The input weighted suppression mask data for the topology-gated path is a 512×512 single-channel floating-point matrix of the same size as the original image, where the values ​​in the weld region are close to 0 (e.g., 0.001), while those in the pipe wall region are close to 1. To maintain spatial consistency with the feature tensor output by the texture encoding path, the topology-gated path first applies an adaptive average pooling layer to downsample the spatial resolution of the mask data from 512 to 16, resulting in an output size of 16×16. Subsequently, a dimension alignment unit operation is performed, specifically configured as a single-layer 1×1 pointwise convolutional layer without additional hidden layers. This layer directly expands the downsampled single-channel 2D mask into a 512-channel 3D tensor, ensuring that its channel dimensions perfectly match the texture feature tensor. During this process, the sigmoid function is used as the activation function to ensure that each element value in the output spatial gating gain tensor is strictly confined to a closed interval between 0 and 1. For example, for noise feature channels corresponding to inherent periodic textures of the weld (such as fish scale patterns), the gain coefficient on channel 512 is calculated to be a minimum (0.05 in this embodiment), thus forming a strong suppression field; while for defect feature channels corresponding to structural abrupt changes such as cracks or pores, even if located at the center of the weld, the corresponding gain coefficient remains at a high value (above 0.8 in this embodiment). This allows the subsequent element-wise multiplication attenuation operation to filter out background noise while retaining the true defect signal.

[0049] Specifically, the process of outputting the pipe wall feature map is as follows: The feature modulation convergence node receives a feature map tensor from the texture path and a spatial gating gain tensor from the topology path, both with dimensions of 512×16×16. A Hadamard product operation is performed, where each element in the pipe wall feature map is equal to the corresponding element in the feature map tensor multiplied by the corresponding element in the spatial gating gain tensor. For noisy feature channels that primarily respond to weld texture (e.g., channels capturing highly reflective fish-scale patterns), their activation values ​​are forcibly decayed to near zero because their corresponding gain coefficients are calculated to be minimal, thus being ignored by the network in subsequent defect classification. Conversely, for feature channels that primarily respond to real structural defects (e.g., channels capturing cracks or pores, regardless of whether the defect is located in the weld or pipe wall region), their feature values ​​are fully preserved because their corresponding gain coefficients are close to 1.

[0050] A parallel texture encoding path and a topology-gated path are constructed, with a feature modulation convergence node at the end. The texture encoding path is configured with cascaded convolutional filtering units, batch normalization units, and nonlinear activation units to receive the standard aligned detection image matrix, extract geometric texture information through hierarchical feature abstraction operations, and output a feature mapping tensor. The topology-gated path is configured with an adaptive average pooling unit and a dimension alignment unit to receive the weighted suppression mask data, perform spatial resolution compression and channel dimension expansion operations to ensure that the geometric scale of the weighted suppression mask data is consistent with the feature mapping tensor, and output a spatial gating gain tensor. The feature modulation convergence node connects the texture encoding path and the topology-gated path through a broadcast mechanism, performs amplitude normalization on the feature mapping tensor using the spatial gating gain tensor, and outputs a pipe wall feature map.

[0051] Specifically, the training process of the two-stream feature extraction network is as follows: An end-to-end supervised learning strategy was adopted, and the training dataset was constructed as follows: Production data was continuously collected for 30 days on a stainless steel pipe production line, covering 304L and 316L grade stainless steel pipes with diameters ranging from 108mm to 218mm and wall thicknesses from 2mm to 6mm, resulting in 50,000 original images. Annotators with industrial quality inspection experience labeled the defects in the images according to the GB / T12606-1999 standard. The annotations included defect categories (cracks, porosity, undercut, lack of fusion, scratches, water stains), bounding box coordinates, and confidence levels. After removing blurry and duplicate samples, 15,000 high-quality labeled samples were selected and divided into training, validation, and test sets in an 8:1:1 ratio. Before inputting the data into the network, online data augmentation operations were performed on the training set, including random horizontal and vertical flips with a probability of 0.5, and brightness jitter within a range of ±10%, to improve the model's generalization and anti-interference capabilities. The loss function employs a weighted combination, consisting of Focal Loss for the classification branch and CIoU Loss for the regression branch, with a 1:1 weight ratio. Focal Loss addresses the imbalance between positive and negative samples, with a balance factor of 0.25 and a focusing parameter of 2.0. CIoU Loss optimizes bounding box regression accuracy, incorporating overlap area, center distance, and aspect ratio consistency penalties in gradient calculation. The optimizer used is AdamW, with an initial learning rate of 0.001, and iterative training for 500 epochs using cosine annealing. Training is stopped early when the average accuracy on the validation set no longer improves for 20 consecutive epochs to minimize the difference between predicted and ground truth bounding boxes. After training, the model's final performance is unbiasedly evaluated using a test set that was never used in training, and the average accuracy is calculated to ensure the model meets the detection requirements of industrial environments.

[0052] The texture encoding pathway focuses on complex hierarchical feature abstraction, while the topology-gated pathway is designed as a lightweight auxiliary branch. This parallel arrangement and terminal convergence structure ensures both the depth of feature extraction and introduces explicit spatial constraints. In particular, the feature modulation convergence node uses a broadcast mechanism to connect the two data streams, achieving low-cost computational fusion. This design solidifies anti-interference logic at the bottom layer of the network structure, enabling stronger generalization and adaptability when dealing with stainless steel pipes of different diameters and weld widths.

[0053] Furthermore, the pipe wall feature map is input into the parallel decoding topology to predict the bounding box location and category probability, and output the local defect detection results; see reference Figure 3 Corresponding to step S4 above; the specific implementation process includes: A parallel decoding topology containing a category prediction channel and a location regression channel is constructed. The category prediction channel is controlled to perform global semantic parsing operations on the pipe wall feature map, calculate the confidence distribution vector of the feature response value belonging to a preset defect type, and output defect category probability data. The location regression channel is controlled to perform boundary sensitivity analysis operations on the pipe wall feature map, derive the geometric offset of the center coordinates and size parameters of the target to be tested relative to a preset geometric anchor frame, and output the bounding box position parameters. The defect category probability data and the bounding box position parameters are combined and encapsulated at the channel level to output the local defect detection results.

[0054] Specifically, the process of constructing a parallel decoding topology that includes a category prediction channel and a location regression channel is as follows: Classification tasks require features to be translation-invariant, meaning that the semantic features should remain consistent regardless of the defect's location on the pipe wall. Localization tasks, on the other hand, require features to be translationally covariant, meaning the response position of the feature map must change precisely as the target moves. In this embodiment, a parallel decoding topology is designed for this purpose. The input pipe wall feature map first passes through a 1×1 convolutional layer with a stride of 1, compressing the number of channels from 512 to 256 to reduce computation. Subsequently, the data stream is distributed to two parallel branches with identical structures but independent parameters. Each branch contains two cascaded convolutional modules, each consisting of 384 3×3 convolutional kernels, a batch normalization layer, and a Swish activation function. This topology ensures that the two channels can extract semantic and geometric features separately without interference. For example, when processing minute scratches on the surface of a stainless steel pipe, the category prediction channel focuses on the texture frequency features of the scratch, while the location regression channel focuses on the abrupt changes in grayscale gradients at the scratch edges.

[0055] Specifically, the process for outputting local defect detection results is as follows: At the end of the category prediction channel, a convolutional layer with an output channel number equal to the preset number of defect categories (e.g., six categories: cracks, pores, edge bites, lack of fusion, scratches, and water stains) is configured. This layer performs point-to-point logistic regression on each spatial grid point of the feature map, using the Sigmoid activation function to map the output values ​​of neurons to a closed interval between 0 and 1, generating a confidence distribution vector. To address the problem of extreme imbalance between positive and negative samples in industrial scenarios (i.e., the vast majority of areas are defect-free backgrounds), the Focal Loss loss function is used during the training of the convolutional layer. By introducing a balance factor (set to 0.25 in this embodiment) and a focusing parameter (set to 2.0 in this embodiment), the weight of simple negative samples (such as clean pipe walls) is reduced, allowing the convolutional layer to focus on small, difficult-to-classify defect samples during backpropagation. For example, when a dark linear texture is detected, the calculated defect category probability data may be: crack 0.92, scratch 0.05, and other categories close to 0, thus classifying it as a crack.

[0056] The location regression channel outputs four feature maps, corresponding to the center horizontal coordinate offset, center vertical coordinate offset, width scaling factor, and height scaling factor of the predicted bounding box, respectively. In this embodiment, three geometric anchor boxes of different scales and aspect ratios are preset at each grid point of the feature map to cover defects of different shapes (such as thin cracks or circular holes). The three preset baseline anchor box sizes (width × height) in this embodiment are: 32×32 pixels (corresponding to small dot-like defects), 32×96 pixels (corresponding to short scratches or longitudinal cracks), and 64×192 pixels (corresponding to long cracks), with corresponding aspect ratios of 1:1, 1:3, and 1:3, respectively. These anchor box sizes are set based on the input image resolution of 512×512. The specific decoding formula is described as follows: Since the dual-stream feature extraction network downsamples the input image to the feature map, the downsampling factor is defined as 32. The predicted center x-coordinate is equal to the x-coordinate index of the top-left corner of the grid cell plus the sigmoid function value of the center x-coordinate offset, multiplied by the downsampling factor. The predicted center y-coordinate is equal to the y-coordinate index of the top-left corner of the grid cell plus the sigmoid function value of the center y-coordinate offset, multiplied by the downsampling factor. The sigmoid function limits the offset value output by the network to between 0 and 1, ensuring the center point is within the current grid cell. The predicted width is equal to the width of the preset anchor box multiplied by the width scaling factor of the natural constant e raised to the power of the width scaling factor. The predicted height is equal to the height of the preset anchor box multiplied by the height scaling factor of the natural constant e raised to the power of the height scaling factor. Both the width scaling factor and the height scaling factor are predicted values ​​output by the network. The CIoU loss function is used during training. This function considers not only the overlap area between the predicted and ground truth boxes but also introduces a consistency penalty term for the Euclidean distance of the center point and the aspect ratio. For example, for a narrow crack with an aspect ratio of 10:1, the CIoU loss function can effectively suppress the divergence of the prediction box, forcing the regression box to fit closely to the crack edge and keeping the positioning error within 0.05mm.

[0057] The confidence tensor output from the category prediction channel (dimensions of batch size multiplied by number of categories multiplied by grid height multiplied by grid width) and the coordinate tensor output from the location regression channel (dimensions of batch size multiplied by four multiplied by grid height multiplied by grid width) are concatenated along the channel dimensions to form a comprehensive detection tensor. Then, a non-maximum suppression algorithm is executed, setting the overlap threshold to 0.45. All high-confidence candidate boxes are traversed, and redundant boxes with an overlap area exceeding the threshold with the highest-scoring box are removed, retaining only the most representative detection results. The final output of the local defect detection results includes a unique identifier for each defect, a category label (e.g., "pore"), a confidence value (e.g., 0.98), and the bounding box coordinates in a 512×512 image coordinate system (top-left x-coordinate, top-left y-coordinate, bottom-right x-coordinate, bottom-right y-coordinate).

[0058] In this embodiment, the bounding box region in the local defect detection results is analyzed, the gray-level co-occurrence matrix features within the region are extracted, energy and contrast parameters are calculated, texture confidence verification logic is constructed, and false defect targets whose feature vectors do not meet the preset threshold are eliminated. For cases where the neural network might misjudge oil stains or watermarks as defects, a texture verification step is added. The local defect detection results are traversed, and the original gray-level patches corresponding to the bounding boxes are extracted. The gray levels are compressed to 16 levels, and a gray-level co-occurrence matrix with a step size of 1 and an orientation of 0 degrees is calculated. Based on this matrix, two second-order statistics are calculated: contrast and energy. A defect texture threshold is set: the mean and standard deviation of the gray-level co-occurrence matrix features of defect-free regions in the current detection batch are calculated. For the crack category, the contrast threshold is set as the background contrast mean plus the sensitivity coefficient (e.g., 3.0) multiplied by the standard deviation, and the energy threshold is set as the background energy mean minus the sensitivity coefficient multiplied by the standard deviation. In this embodiment, for the crack category, the contrast is required to be greater than 1.5 and the energy less than 0.1; for the scratch category, the contrast is required to be greater than 2.0. Contrast is calculated as the sum of the squares of the differences between the row and column numbers of all elements in the matrix; energy is calculated as the sum of the squares of the values ​​of all elements in the matrix. If a target is classified as a defect but its texture features do not meet the above conditions, it is determined to be unstructured noise, and the target's confidence score is multiplied by a forced attenuation coefficient of 0.1. If the confidence score after attenuation is lower than 0.5, the target is removed from the local defect detection results and will not enter the subsequent global remapping process. The above process uses statistical features to filter unstructured environmental noise and reduce the false alarm rate of water stains caused by oil.

[0059] By constructing independent category prediction channels, focusing on global semantic parsing, and analyzing the confidence distribution of feature response values ​​among preset defect types, different defect categories such as scratches, holes, or rust spots can be distinguished in complex industrial contexts. Simultaneously, an independent position regression channel focuses on boundary sensitivity analysis, correcting the position and size of the predicted bounding box by deriving the geometric offset relative to the anchor frame. These two types of independent yet closely related information are concatenated and encapsulated at the channel level to output local defect detection results. This parallel decoding mechanism effectively avoids feature conflicts when a single channel processes multiple tasks, ensuring that every minute defect can be captured and correctly classified from the perspective of a local window, providing high-quality foundational data for subsequent global reconstruction.

[0060] Furthermore, using global temporal index data, cross-window coordinate remapping and overlapping region merging operations are performed on the local defect detection results to output a stainless steel pipe defect identification report; corresponding to step S5 above; the specific implementation process includes: The starting scan row number marker of the global temporal index data is read and established as the global vertical offset reference value; the bounding box position parameters contained in the local defect detection results are parsed to separate the vertical local coordinate values ​​relative to the geometric origin of the standard aligned detection image matrix; the vertical local coordinate values ​​and the global vertical offset reference value are linearly superimposed to generate global vertical absolute coordinates mapped to the grayscale scan data stream, and a panoramic defect distribution set is constructed; the panoramic defect distribution set is traversed, and geometric intersection-union analysis is performed on defect targets located at the edges of different slice windows and spatially adjacent to each other to lock the same defect entity that is broken due to slice segmentation; the bounding box coordinates of the same defect entity are subjected to a maximum envelope fusion operation, and the confidence parameters are weighted averaged to calculate, and a stainless steel pipe defect identification report is output.

[0061] Specifically, the process of generating global vertical absolute coordinates is as follows: First, the global time-series index database stored in the cache is accessed. For any Nth processed detection window, its metadata tag is extracted, including the starting scan row number marker, such as the 1,002,400th row, and the corresponding hardware encoder pulse count. This starting row number marker is established as the global longitudinal offset reference, which physically locks the absolute starting position of the current microscopic analysis window along the entire macroscopic length of the steel pipe. Based on this, pre-calibrated longitudinal resolution parameters are introduced, such as each row corresponding to a physical length of 0.025 mm, to convert the dimensionless row number data into physical coordinates in meters.

[0062] The local defect detection result data is a high-dimensional tensor containing the geometric information of multiple candidate boxes. The bounding box position parameters of each valid detected target in the local defect detection result data are traversed, and their vertical local coordinate values ​​(e.g., 256.5 pixels) and bounding box height in a 512×512 pixel window coordinate system are extracted. Subsequently, a coordinate transformation operation is performed, calculated as follows: the global vertical absolute coordinate equals the global vertical offset baseline plus the vertical local coordinate value. If conversion to physical distance is required, the above sum needs to be multiplied by the vertical pixel equivalent coefficient. Through this linear superposition operation, defect features originally isolated in each slice image are assigned a globally unique spatial address. A panoramic defect distribution set is constructed based on the global vertical absolute coordinates. This set is a dynamically growing list structure that stores the category label, global coordinate range, confidence level, and geometric morphological parameters of all suspected defects.

[0063] Specifically, the process for generating a stainless steel pipe defect identification report is as follows: Because the sliding window employs a 50% (256 pixels) overlap sampling strategy, defects located at the window boundaries are often repeatedly detected or cut into two parts. First, the panoramic defect distribution set is sorted according to global vertical coordinates. Then, a sliding scan pointer is introduced to check the vertical distance between two adjacent defect targets. If the global bounding boxes of two similar defects (e.g., both being "longitudinal cracks") overlap spatially or the distance is less than a preset merging threshold (e.g., 5mm), geometric intersection-union (IoU) analysis is initiated: the calculation formula is the overlap area of ​​the two bounding boxes divided by the union area of ​​the two bounding boxes. In industrial inspection scenarios, due to the possibility of slight misalignment of bounding boxes caused by segmented detection, an IoU threshold of 0.2 is set. If the calculated IoU value is greater than this threshold, or if there is continuity in the vertical dimension (i.e., the difference between the bottom coordinate of the previous box and the top coordinate of the next box is within the tolerance range), it is determined that these two targets are projections of the same physical defect after being sliced, and they are marked as entities to be merged, preventing quality misjudgments caused by the same defect being repeatedly counted.

[0064] For multiple detection boxes identified as the same entity, a maximum envelope fusion operation is performed to reconstruct the complete defect morphology. Specifically, the left boundary coordinates of the fused defect are taken as the minimum of the left boundaries of all sub-boxes, the right boundary coordinates as the maximum of the right boundaries of all sub-boxes, the top boundary coordinates as the minimum of the global coordinates of the top boundaries of all sub-boxes, and the bottom boundary coordinates as the maximum of the global coordinates of the bottom boundaries of all sub-boxes, generating a minimum bounding rectangle that completely covers all fragments. Simultaneously, to more accurately assess the confidence level of the defect, a weighted average calculation is performed on the confidence level parameter, with the weighting coefficient set to the area of ​​each sub-box. That is, the fused confidence level equals the confidence level of each sub-box multiplied by the sum of its areas, then divided by the total area. The final output data is formatted as a stainless steel pipe defect identification report. The report details the unique ID of each confirmed defect, the defect type (e.g., porosity, crack), its physical location on the pipe (e.g., 58.43m from the pipe end), its physical dimensions (length, width, area), and overall confidence level, along with the original image index corresponding to the defect for quality inspectors to review.

[0065] By reading the starting scan row number marker from the global temporal index data and performing linear superposition operations on the relative coordinates in the local detection results, a panoramic defect distribution set is constructed. Geometric intersection-union (IUU) analysis and maximum envelope fusion operations are then performed on spatially adjacent defect targets located at the slice edge. This intelligently identifies and merges the same defect entities that were broken due to sliding window cutting. This process stitches together the originally fragmented detection frames into a complete defect object, not only restoring the true physical length and shape of long-sized defects but also improving the accuracy of the judgment through confidence-weighted averaging.

[0066] This invention provides a method for stainless steel pipe defect identification based on multi-parameter signal fusion. By introducing weld seam reference centerline coordinates and a sliding clipping window mechanism, standardized alignment of image data in physical space is achieved, establishing a unified reference system. Secondly, a distance field distribution matrix and weighted suppression mask data are introduced, and a nonlinear inversion mapping function is used to transform spatial geometric location information into control variables for signal intensity. This processing method can mathematically attenuate and suppress texture features in the weld seam area during the feature extraction stage, thereby preserving the normal texture of the pipe wall while eliminating the possibility of the weld seam's own texture being misjudged as a false defect. By outputting global temporal index data and performing cross-window coordinate remapping on local detection results, defect fragments scattered in different time slices can be spliced ​​and reconstructed in the global coordinate system, successfully restoring the true geometric shape of long-sized defects across the window. This avoids missed detections or duplicate counts caused by image segmentation, ensuring the completeness and high confidence of the final identification report.

[0067] Example 2 This embodiment applies a stainless steel pipe defect identification system based on multi-parameter signal fusion to the detection of large-diameter, thick-walled stainless steel industrial fluid transport pipes. (See reference...) Figure 4 The specific implementation process is as follows: In the actual production setting, the stainless steel pipe to be inspected had an outer diameter of 218mm, a wall thickness of 4.0mm, and was made of 304L grade austenitic stainless steel. Due to the thick pipe wall, the production line employed a combined plasma welding and argon arc welding process. To ensure the weld penetration depth, the production line's operating speed was set to 15m / min. For this condition, the line frequency parameter of the industrial linear array camera in the image acquisition system was adjusted to 12500Hz to ensure that the longitudinal scanning resolution remained at 0.02mm per pixel even at low speeds.

[0068] During the preprocessing stage of the grayscale scan data stream, the system performs a vertical pixel value projection accumulation operation. Since the physical width of the weld seam in thick-walled pipes reaches 8mm to 10mm, after generating the texture change rate statistical curve, the connected component threshold for locking the peak aggregation region is correspondingly increased, and the local response region span searched by the algorithm is set between 400 and 600 pixels. The calculated weld seam reference centerline coordinates are used as geometric anchor points to control the sliding clipping window for real-time segmentation of the original data stream. Considering that defects may have larger geometric scales, the sliding window size remains at 512×512 pixels, but to improve the coverage of elongated defects, the pixel step size parameter is adjusted to 128 pixels, achieving a 75% overlap sampling rate.

[0069] When calculating the lateral Euclidean distance of each pixel in the standard alignment detection image matrix relative to the vertical central axis, the zero-distance reference is locked in column 256. In the inverse proportional attenuation logic, the half-saturation constant is set to 120, which makes the effective bandwidth of the suppression area cover the entire heat-affected zone of the weld. This results in the mask values ​​within a 120-pixel range from the center being strongly compressed, preventing the coarse weld scale pattern from being misjudged as a crack, while preserving the small scratch features on both sides of the weld.

[0070] After the data enters the dual-stream feature extraction network, it captures a continuous undercut defect located at the left toe of the weld, with a depth of approximately 0.2 mm and a length of 60 mm. In the texture encoding path, due to the gradual grayscale change at the undercut and the influence of the illumination angle, its activation value in the feature mapping tensor is low, and the two-dimensional feature is not significant. However, in the topology-gated path, the input weighted suppression mask data marks the topological position of the weld toe where the defect is located. Since the lateral Euclidean distance at this position is greater than the preset half-saturation constant, it is in an effective detection zone transitioning from the weld center suppression zone to the pipe wall retention zone. Therefore, the generated spatial gating gain tensor at this location calculates a high retention coefficient close to 1. The feature modulation convergence node, through a broadcast mechanism, uses the spatial gating gain tensor as modulation weights to perform element-wise multiplication on the feature mapping tensor output by the texture encoding path. This ensures that the weak undercut signal at this specific topological position is not mistakenly filtered out as weld noise, thus effectively preserving and enhancing the undercut feature.

[0071] During the parallel decoding and output stage, the position regression channel predicted the bounding box of the bite defect. However, since the physical length of the defect was 60mm, more than ten consecutive local defect detection results reported a defect target named "severe bite." The system read the global temporal index data and mapped these scattered local coordinates to global longitudinal absolute coordinates relative to the pipe head. When traversing the panoramic defect distribution set, it detected that these defect targets were connected end-to-end in global space and had consistent lateral offsets. Geometric intersection-union analysis confirmed that they belonged to the segmented projection of the same physical entity. Through the maximum envelope fusion operation, all fragmented bounding boxes were merged into a complete rectangular box with a starting coordinate of 125.4 meters and an ending coordinate of 125.46 meters. The confidence score reached 0.96 after area-weighted averaging. The final defect identification report marked the location and size of the continuous bite.

[0072] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for identifying defects in stainless steel pipes based on multi-parameter signal fusion, characterized in that, include: The grayscale scanning data stream of the stainless steel pipe surface is acquired by an industrial line scan camera. The vertical pixel value projection accumulation operation is performed on the grayscale scanning data stream to generate the weld reference center line coordinates. Based on the weld reference center line coordinates, a sliding clipping window is established to perform anchoring segmentation operation on the grayscale scanning data stream, and output standard aligned detection image matrix and global temporal index data. The lateral Euclidean distance of pixels in the standard aligned detection image matrix relative to the vertical central axis is calculated to construct the distance field distribution matrix, and then transformed into weighted suppression mask data through a nonlinear inversion mapping function. The standard aligned detection image matrix and the weighted suppression mask data are input into the dual-stream feature extraction network. The weighted suppression mask data is used to perform an element-wise dot product decay operation on the feature mapping tensor generated based on the standard aligned detection image matrix, and the pipe wall feature map is output. The pipe wall feature map is input into the parallel decoding topology to predict the bounding box position and category probability, and output the local defect detection results. The global temporal index data is used to perform cross-window coordinate remapping and overlapping region merging operations on the local defect detection results, and output the stainless steel pipe defect identification report.

2. The method for identifying defects in stainless steel pipes based on multi-parameter signal fusion according to claim 1, characterized in that, The specific process for generating the weld reference centerline coordinates includes: receiving a grayscale scan data stream quantized and output by an industrial line scan camera through a photoelectric conversion element and an analog-to-digital conversion module; performing a longitudinal pixel value projection accumulation operation on the grayscale scan data stream to construct a transverse projection distribution vector; calculating the difference amplitude of adjacent elements of the transverse projection distribution vector to generate a texture change rate statistical curve; locking the local response region in the texture change rate statistical curve where peaks are clustered and connected, and outputting the weld reference centerline coordinate data.

3. The method for identifying defects in stainless steel pipes based on multi-parameter signal fusion according to claim 1, characterized in that, The specific generation process of the standard alignment detection image matrix and global temporal index data includes: using the weld reference centerline coordinate data as geometric anchor points, combined with the preset pipe wall unfolding perimeter parameters, calculating the horizontal truncation boundary range corresponding to each frame scan line; performing a sliding window scanning operation along the longitudinal transmission dimension of the grayscale scan data stream according to a fixed pixel step size parameter, establishing a sliding clipping window, and locking the local pixel array to be processed; extracting the grayscale values ​​within the horizontal truncation boundary range, and recombining the grayscale values ​​into a standard alignment detection image matrix; synchronously reading the start scan line number marker and end scan line number marker corresponding to the current sliding window scanning operation, and outputting the global temporal index data.

4. The method for identifying defects in stainless steel pipes based on multi-parameter signal fusion according to claim 1, characterized in that, The specific generation process of the weighted suppression mask data includes: parsing the column pixel count attribute of the standard aligned detection image matrix as a horizontal resolution dimension parameter, and establishing the vertical central axis of the image plane as a zero-distance reference; traversing the pixel array in the standard aligned detection image matrix, calculating the horizontal absolute difference between the column coordinate index of the pixel unit and the zero-distance reference, and generating a horizontal Euclidean distance distribution matrix; inputting the horizontal Euclidean distance distribution matrix into a nonlinear inverse mapping model containing inverse proportional attenuation logic, performing amplitude compression operation on the weld neighborhood elements in the horizontal Euclidean distance distribution matrix that approach zero, and performing numerical preservation operation on the pipe wall region elements far from the zero-distance reference, and outputting the weighted suppression mask data.

5. The method for identifying defects in stainless steel pipes based on multi-parameter signal fusion according to claim 1, characterized in that, The specific generation process of the pipe wall feature map includes: injecting the standard aligned detection image matrix into the texture encoding path of the dual-stream feature extraction network, extracting geometric morphological information using hierarchical convolution operations, and generating a feature mapping tensor; simultaneously injecting the weighted suppression mask data into the topology gating path of the dual-stream feature extraction network, performing spatial dimension alignment operations, and generating a spatial gating gain tensor; using the spatial gating gain tensor as a modulation coefficient, performing element-wise Hadamard product operations on the feature mapping tensor, and performing element-wise dot product attenuation operations on the activation values ​​of neurons corresponding to the weld topology positions in the feature mapping tensor, and outputting the pipe wall feature map.

6. The method for identifying defects in stainless steel pipes based on multi-parameter signal fusion according to claim 5, characterized in that, The specific construction of the dual-stream feature extraction network includes: constructing a parallel texture encoding path and a topology-gated path, and establishing a feature modulation convergence node at the end; the texture encoding path is configured with cascaded convolutional filtering units, batch normalization units, and nonlinear activation units, used to receive the standard aligned detection image matrix, extract geometric texture information through hierarchical feature abstraction operations, and output a feature mapping tensor; the topology-gated path is configured with an adaptive average pooling unit and a dimension alignment unit, used to receive the weighted suppression mask data, perform spatial resolution compression and channel dimension expansion operations to make the geometric scale of the weighted suppression mask data consistent with the feature mapping tensor, and output a spatial gating gain tensor; the feature modulation convergence node connects the texture encoding path and the topology-gated path through a broadcast mechanism, uses the spatial gating gain tensor to perform amplitude normalization operations on the feature mapping tensor, and outputs a pipe wall feature map.

7. The method for identifying defects in stainless steel pipes based on multi-parameter signal fusion according to claim 1, characterized in that, The specific process for generating the local defect detection result includes: constructing a parallel decoding topology structure containing a category prediction channel and a location regression channel; controlling the category prediction channel to perform global semantic parsing operations on the pipe wall feature map, calculating the confidence distribution vector of the feature response value belonging to a preset defect type, and outputting defect category probability data; controlling the location regression channel to perform boundary sensitivity analysis operations on the pipe wall feature map, deriving the geometric offset of the center coordinates and size parameters of the target to be tested relative to a preset geometric anchor frame, and outputting the bounding box position parameters; performing channel-level splicing and encapsulation operations on the defect category probability data and the bounding box position parameters, and outputting the local defect detection result.

8. The method for identifying defects in stainless steel pipes based on multi-parameter signal fusion according to claim 1, characterized in that, The specific generation process of the stainless steel pipe defect identification report includes: reading the starting scan row number marker of the global time-series index data and establishing it as the global vertical offset reference; parsing the bounding box position parameters contained in the local defect detection results and separating the vertical local coordinate values ​​relative to the geometric origin of the standard aligned detection image matrix; performing a linear superposition operation on the vertical local coordinate values ​​and the global vertical offset reference to generate global vertical absolute coordinates mapped to the grayscale scan data stream and constructing a panoramic defect distribution set; traversing the panoramic defect distribution set and performing geometric intersection-union analysis on defect targets located at the edges of different slice windows and spatially adjacent to each other to lock the same defect entity that is broken due to slice segmentation; performing a maximum envelope fusion operation on the bounding box coordinates of the same defect entity and performing a weighted average calculation on the confidence parameters to output the stainless steel pipe defect identification report.

9. A stainless steel pipe defect identification system based on multi-parameter signal fusion, characterized in that, include: Weld topology anchoring module: It acquires grayscale scan data streams of stainless steel pipe surface through industrial line scan cameras, performs vertical pixel value projection accumulation operation on grayscale scan data streams to generate weld reference centerline coordinates; based on weld reference centerline coordinates, it establishes a sliding clipping window to perform anchoring segmentation operation on grayscale scan data streams, and outputs standard alignment detection image matrix and global temporal index data. Distance field construction module: Calculates the lateral Euclidean distance of pixels in the standard aligned detection image matrix relative to the vertical central axis, constructs the distance field distribution matrix, and transforms it into weighted suppression mask data through a nonlinear inversion mapping function; Dual-stream feature suppression module: Input the standard aligned detection image matrix and weighted suppression mask data into the dual-stream feature extraction network, and use the weighted suppression mask data to perform element-wise multiplication attenuation operation on the feature mapping tensor generated based on the standard aligned detection image matrix, and output the pipe wall feature map; Cross-domain spatiotemporal reconstruction module: Input the pipe wall feature map into the parallel decoding topology, predict the location and category probability of the defect bounding box, and output the local defect detection results; use global temporal index data to perform cross-window coordinate remapping and overlapping area merging operations on the local defect detection results, and output a stainless steel pipe defect identification report.