Pipeline defect detection method and system based on multi-scale attention

By employing a multi-scale attention detection method and three-dimensional coordinate projection technology, the problems of perspective distortion and underwater interference in pipeline inspection were solved, enabling high-precision three-dimensional quantitative detection of pipeline defects.

CN122200136BActive Publication Date: 2026-11-24NINGBO WATER ENVIRONMENT ENGINEERING CONSTRUCTION CO LTD OPERATION & MAINTENANCE BRANCH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610345468.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-03-20
Publication Date
2026-11-24
Estimated Expiration
2046-03-20

AI Technical Summary

Technical Problem

Existing methods for detecting internal defects in pipelines mainly rely on single-view two-dimensional image analysis, which cannot effectively handle perspective distortion and underwater dynamic interference inside complex pipelines. This leads to the masking of minute crack features and makes it impossible to accurately quantify the severity of defects.

Method used

A pipeline defect detection method based on multi-scale attention is adopted. Rigid background and non-rigid interference pixels are separated by calculating the optical flow field displacement vector. The three-dimensional coordinate projection is combined with the inertial pose matrix to generate a panoramic feature map of the pipe wall. The set of structural pixels is located by using the pixel gradient structure tensor matrix, and the three-dimensional surface boundary coordinates of the defect activation region are extracted by a depth detection network.

Benefits of technology

It enables accurate detection of pipeline defects in complex environments, and can directly output the three-dimensional surface boundary coordinates and surface area values ​​of defects, providing accurate engineering quantitative indicators and reducing detection difficulty and false detection rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122200136B_ABST
    Figure CN122200136B_ABST
Patent Text Reader

Abstract

This invention discloses a pipeline defect detection method and system based on multi-scale attention, specifically relating to the field of non-destructive testing technology for water supply pipelines. It addresses the problems of missed detection of minute defects and inability to output true physical dimensions caused by underwater environmental interference and two-dimensional distortion. First, it calculates the optical flow field displacement of the image sequence to separate non-rigid interference and generate an environmental interference confidence mask. Then, it combines the pose matrix to project the image onto a three-dimensional cylindrical system for flattening, and applies the mask weights to fuse overlapping areas, reconstructing a distortion-free panoramic feature map of the pipe wall. Next, it locates coherent structural pixels based on pixel gradient structure tensor eigenvalue decomposition, performs directional gain modulation in multi-scale channels, and purifies the minute defect signal. Finally, it uses a network to extract two-dimensional contours and substitutes them into the inverse matrix for three-dimensional mapping inverse solution, calculating the true surface area value, thus constructing a precise closed loop from bottom-level anti-interference to three-dimensional physical quantity measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of non-destructive testing technology for water supply pipelines, specifically to a pipeline defect detection method and system based on multi-scale attention. Background Technology

[0002] Water supply pipelines, as a core component of urban infrastructure, bear the critical responsibility of supplying domestic and industrial water. Defects such as cracks, deposits, or corrosion on their inner walls can easily lead to leaks, water pollution, or even pipe rupture, resulting in significant economic losses and social risks. Therefore, regular defect inspection of the inner walls of water supply pipelines is essential.

[0003] Existing methods for detecting internal defects in pipelines primarily rely on single-view, two-dimensional image analysis, which faces significant interference in the complex internal environment of pipelines. Because pipelines have a three-dimensional cylindrical topology, severe perspective distortion exists at the edges of individual images, leading to image stitching misalignment and deformation of edge defects. Furthermore, water supply pipelines contain non-rigid dynamic interference such as water turbidity, surface reflection, and suspended matter. Conventional image denoising algorithms indiscriminately smooth images, masking minute crack features and causing false detections. In addition, existing detection models only output rectangular bounding boxes in a two-dimensional pixel coordinate system, failing to directly reflect the absolute surface area and three-dimensional spatial span of defects in the real physical world, making it difficult to accurately quantify the severity of defects during engineering maintenance. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a pipeline defect detection method and system based on multi-scale attention, which solves the problems mentioned in the background.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a pipeline defect detection method based on multi-scale attention, comprising the following steps: S1, acquiring a sequence of water supply pipeline images and calculating the optical flow field displacement vectors of adjacent frame pixels; dividing the pixels into rigid background and non-rigid interference pixels according to the displacement vector distribution, and generating an environmental interference confidence mask containing the two-dimensional coordinates of non-rigid interference pixels and associated interference weights; S2, constructing a coordinate projection matrix by combining the inertial pose matrix of the camera, mapping the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system and recording the inverse coordinate transformation matrix; expanding along the cylindrical generatrix to generate a two-dimensional planar canvas, extracting the interference weights of the environmental interference confidence mask corresponding to the overlapping areas of multiple frames, and fusing the gray values ​​of the overlapping area pixels according to the inverse weight mapping relationship to generate a full-scale pipeline defect detection method. S3. Construct a pixel gradient structure tensor matrix of the downsampling level of the panoramic feature map of the pipe wall, and locate the structural pixel set by obtaining the ratio of the principal and secondary eigenvalues ​​through eigenvalue decomposition; extract activation values ​​along the multi-resolution channel, superimpose a first gain factor on the activation values ​​within the structural pixel set, and superimpose a smaller second gain factor on the activation values ​​outside the structural pixel set to generate a multi-scale feature response matrix; S4. Extract the two-dimensional pixel contour coordinates and category labels of the defect activation region in the multi-scale feature response matrix through a depth detection network; substitute the two-dimensional pixel contour coordinates into the coordinate transformation inverse matrix to perform three-dimensional spatial mapping inverse solution, obtain the three-dimensional surface boundary coordinates, construct a spatial polygon to calculate the surface area value, and output the detection results containing the three-dimensional surface boundary coordinates, surface area value, and category label.

[0006] Furthermore, the specific process of acquiring the water supply pipeline image sequence and calculating the optical flow field displacement vector of adjacent frame pixels is as follows: extract the pixel spatial gray-level gradient matrix and temporal gradient matrix of adjacent frames in the water supply pipeline image sequence, and establish a constant pixel brightness constraint equation; construct a multi-scale image pyramid, solve the initial optical flow vector of the pixel at the top of the multi-scale image pyramid, project the initial optical flow vector down layer by layer along the multi-scale image pyramid and iteratively update the pixel spatial gray-level gradient matrix, and converge to obtain the optical flow field displacement vector of adjacent frame pixels.

[0007] Furthermore, based on the displacement vector distribution, pixels are divided into rigid background and non-rigid interference pixels. The specific process of generating an environmental interference confidence mask containing the two-dimensional coordinates of non-rigid interference pixels and associated interference weights is as follows: The amplitude and direction angle of the optical flow field displacement vectors of adjacent frame pixels are aggregated to construct a high-dimensional motion feature space. Density clustering is performed in the high-dimensional motion feature space to separate the principal component clusters that match the prior trajectory of the pipeline robot as rigid background pixels. Discrete motion feature points outside the principal component clusters are extracted as non-rigid interference pixels. The two-dimensional coordinates of the non-rigid interference pixels are extracted, and the Mahalanobis distance distribution features of the optical flow field displacement vector amplitudes of the non-rigid interference pixels deviating from the center of the principal component clusters are extracted to construct associated interference weights. The environmental interference confidence mask is then output.

[0008] Furthermore, the specific process of constructing a coordinate projection matrix by combining the camera intrinsic parameters with the inertial pose matrix, mapping the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system, and recording the inverse coordinate transformation matrix is ​​as follows: Extract the camera rotation and translation components relative to the tube axis from the inertial pose matrix, and construct a coordinate projection matrix by combining the camera intrinsic parameters focal length and optical center coordinates, the camera rotation components relative to the tube axis, and the translation components; apply the coordinate projection matrix to project the two-dimensional coordinates of the image sequence pixels onto the surface of a three-dimensional cylindrical coordinate system with the tube axis as the geometric center, obtain the three-dimensional spatial coordinates of the pixels, record the injective mapping topological relationship between the two-dimensional coordinate domain and the three-dimensional spatial coordinate domain of the image sequence pixels, and generate the inverse coordinate transformation matrix.

[0009] Further, a two-dimensional planar canvas is generated by unfolding along the cylindrical generatrix. Environmental interference confidence mask interference weights corresponding to the overlapping regions of multiple frames are extracted. The pixel grayscale values ​​of the overlapping regions are fused according to the inverse weight mapping relationship to generate the panoramic feature map of the pipe wall. The specific process is as follows: The cylindrical polar angle and axial height variables of the surface of the three-dimensional cylindrical coordinate system are extracted. These variables are mapped to the Cartesian plane coordinate system to establish a two-dimensional planar canvas. The overlapping regions of the image sequence pixels in the two-dimensional planar canvas are matched. The environmental interference confidence mask interference weights corresponding to the overlapping regions of multiple frames are extracted. An interference weight attenuation function is constructed. The interference weight attenuation function is applied to perform normalized weighted fusion of the pixel grayscale values ​​of the image sequence at the same coordinate position within the overlapping regions of multiple frames, outputting the panoramic feature map of the pipe wall.

[0010] Furthermore, the specific process of constructing the pixel gradient structure tensor matrix of the downsampling level of the panoramic feature map of the pipe wall, and locating the structural pixel set by obtaining the ratio of principal and secondary eigenvalues ​​through eigenvalue decomposition is as follows: Extract the horizontal and vertical pixel derivative matrices of the panoramic feature map of the pipe wall at the local spatial resolution, and fuse the horizontal and vertical pixel derivative matrices to construct the local neighborhood covariance matrix; define the local neighborhood covariance matrix as the pixel gradient structure tensor matrix, perform eigenvalue decomposition on the pixel gradient structure tensor matrix, and extract the first principal eigenvalue representing the gradient of the main direction of the local texture and the second eigenvalue representing the orthogonal gradient of the local texture; establish an anisotropic proportional response function for the first principal eigenvalue and the second eigenvalue to obtain the ratio of principal and secondary eigenvalues, and extract coordinate nodes that present a continuous spatial distribution based on the output distribution of the anisotropic proportional response function, thereby locating and generating the structural pixel set.

[0011] Furthermore, the specific process of extracting activation values ​​along the multi-resolution channels, superimposing a first gain factor on the activation values ​​within the structural pixel set, and superimposing a smaller second gain factor on the activation values ​​outside the structural pixel set to generate a multi-scale feature response matrix is ​​as follows: The panoramic feature map of the pipe wall is input into a feature pyramid architecture. Local receptive field feature maps of the multi-resolution channels are extracted along bottom-up and top-down paths. The channel-dimensional activation and spatial-dimensional activation of the local receptive field feature maps are extracted as the activation values ​​of the multi-resolution channels. The spatial mapping coordinates of the structural pixel set in the multi-resolution channels are matched. A first gain factor representing feature enhancement is configured in regions where the spatial mapping coordinates coincide, and a smaller second gain factor is configured in regions where the spatial mapping coordinates differ. The first and second gain factors are applied to perform nonlinear modulation on the channel-dimensional activation and spatial-dimensional activation. The nonlinearly modulated local receptive field feature maps are then aggregated to construct a multi-scale feature response matrix.

[0012] Furthermore, the specific process of extracting the two-dimensional pixel contour coordinates and category labels of the defect activation region in the multi-scale feature response matrix through the deep detection network is as follows: The multi-scale feature response matrix is ​​input into the multi-scale feature encoder of the deep detection network to extract the high-dimensional feature vector output by the multi-scale feature encoder. A spatial channel collaborative attention layer is applied to the high-dimensional feature vector to extract the local saliency heat map. The closed pixel set formed by the defect activation boundary within the local saliency heat map is extracted to generate the two-dimensional pixel contour coordinates. The semantic feature components within the region enclosed by the two-dimensional pixel contour coordinates are extracted, and the semantic feature components are input into the classification perceptron to parse and map the defect category label.

[0013] Furthermore, the specific process of substituting the two-dimensional pixel contour coordinates into the inverse coordinate transformation matrix to perform a three-dimensional spatial mapping inverse solution, obtaining the three-dimensional surface boundary coordinates, and constructing a spatial polygon to calculate the surface area value, outputting the detection results containing the three-dimensional surface boundary coordinates, surface area value, and category label is as follows: Extract the edge node sequence within the two-dimensional pixel contour coordinates, input the edge node sequence into the inverse coordinate transformation matrix to perform a nonlinear geometric back projection operation, extract the three-dimensional surface boundary coordinates of the edge node sequence on the three-dimensional cylindrical surface, construct a spatial polygon on the three-dimensional cylindrical surface according to the topological connection relationship of the edge node sequence; perform surface integration operation on the spatial polygon to calculate the surface area value, aggregate the three-dimensional surface boundary coordinates, surface area value, and defect category label to construct a multi-dimensional defect state description table, and output the detection results.

[0014] The pipeline defect detection system based on multi-scale attention, used to execute the aforementioned pipeline defect detection method based on multi-scale attention, includes the following modules: an interference separation module, used to acquire a sequence of water supply pipeline images, calculate the optical flow field displacement vectors of adjacent frame pixels; divide pixels into rigid background and non-rigid interference pixels according to the displacement vector distribution, and generate an environmental interference confidence mask containing the two-dimensional coordinates of non-rigid interference pixels and associated interference weights; a panoramic reconstruction module, used to construct a coordinate projection matrix by combining the in-camera participating inertial pose matrix, map the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system and record the inverse coordinate transformation matrix; unfold along the cylindrical generatrix to generate a two-dimensional planar canvas, extract the interference weights of the environmental interference confidence mask corresponding to the overlapping areas of multiple frames, fuse the gray values ​​of the overlapping area pixels according to the inverse weight mapping relationship, and generate the pipe wall. The system comprises a panoramic feature map and a feature response module. The former constructs a pixel gradient structure tensor matrix at the downsampling level of the panoramic feature map of the pipe wall, and uses eigenvalue decomposition to obtain the ratio of primary and secondary eigenvalues ​​to locate the structural pixel set. The latter extracts activation values ​​along multi-resolution channels, superimposes a first gain factor on activation values ​​within the structural pixel set, and superimposes a smaller second gain factor on activation values ​​outside the structural pixel set, generating a multi-scale feature response matrix. The latter is a 3D inverse solution module, which extracts the 2D pixel contour coordinates and category labels of the defect activation regions in the multi-scale feature response matrix using a depth detection network. It then substitutes the 2D pixel contour coordinates into the coordinate transformation inverse matrix to perform 3D spatial mapping and inverse solution, obtaining the 3D surface boundary coordinates and constructing a spatial polygon to calculate the surface area. The module outputs the detection results containing the 3D surface boundary coordinates, surface area values, and category labels.

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

[0016] (1) The pipeline defect detection method based on multi-scale attention extracts non-rigid interference pixels by extracting the optical flow field displacement vector of adjacent frames and constructs an environmental interference confidence mask, which accurately removes the interference of underwater reflection and suspended objects from the perspective of physical motion attributes; combined with the inertial pose matrix of the camera, a coordinate projection matrix is ​​constructed, the image sequence is inversely projected to the three-dimensional cylindrical coordinate system and flattened, and then the interference weight is used to perform inverse proportional weighted fusion of the overlapping area, which fundamentally eliminates the cylindrical perspective distortion of a single image and reconstructs a seamless panoramic feature map of the pipe wall that excludes dynamic environmental interference, which greatly reduces the fitting difficulty of subsequent detection in complex environments.

[0017] (2) The pipeline defect detection system based on multi-scale attention locates the set of structural pixels by eigenvalue decomposition of the pixel gradient structure tensor matrix. It can accurately purify the features of small cracks and suppress isolated noise based on the coherent properties of physical morphology. It assigns dynamic gain to different features in multi-resolution channels and generates a feature response matrix that is highly sensitive to minor defects. After the depth detection network extracts the two-dimensional pixel contour, it substitutes it into the pre-recorded coordinate transformation inverse matrix to perform three-dimensional spatial mapping and inverse solution. It upgrades the traditional two-dimensional pixel box detection to three-dimensional absolute physical quantity measurement and directly outputs the three-dimensional surface boundary coordinates of the defect and the true surface area value, providing accurate engineering quantitative indicators for pipeline maintenance and leakage risk assessment.

[0018] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0019] Figure 1 This is a flowchart of the pipeline defect detection method based on multi-scale attention according to the present invention.

[0020] Figure 2 Flowchart for interference separation and environmental confidence mask generation.

[0021] Figure 3 This is a flowchart of coordinate projection mapping and panoramic reconstruction of the pipe wall.

[0022] Figure 4 A flowchart for locating structural pixel sets based on structure tensors.

[0023] Figure 5 This is a flowchart of the three-dimensional spatial mapping inverse solution and surface area calculation.

[0024] Figure 6 This is a flowchart of the pipeline defect detection system based on multi-scale attention according to the present invention. Detailed Implementation

[0025] This application's embodiments address the problems of existing pipeline image detection methods and systems based on multi-scale attention, which are limited by two-dimensional perspective distortion, susceptible to interference from underwater dynamic environments, and unable to directly output the true three-dimensional physical dimensions of defects.

[0026] The overall approach of the scheme in this application is as follows: First, the characteristics of the temporal optical flow field are used to separate underwater dynamic environmental interference and generate an environmental interference confidence mask; second, the image sequence is mapped to a three-dimensional cylindrical space using inertial pose data for geometric distortion correction, and mask weights are applied for inverse proportional fusion to generate a panoramic feature map of the pipe wall; then, the gradient structure tensor of the panoramic feature map of the pipe wall is calculated, and structural cracks and isolated noise points are distinguished based on the eigenvalue decomposition results, and a multi-scale feature response matrix is ​​output through adaptive gain modulation of multi-resolution channels; finally, a depth detection network is used to extract the two-dimensional contour of the defect, and it is back-mapped to a three-dimensional in-situ space to solve for the true surface area and three-dimensional boundary coordinates of the defect, thus realizing a complete closed loop from image acquisition to three-dimensional physical engineering quantity detection.

[0027] Please see Figure 1 This invention provides a technical solution: a pipeline defect detection method based on multi-scale attention, comprising the following steps: S1, acquiring a sequence of water supply pipeline images and calculating the optical flow field displacement vectors of adjacent frame pixels; dividing pixels into rigid background and non-rigid interference pixels according to the displacement vector distribution, and generating an environmental interference confidence mask containing two-dimensional coordinates of non-rigid interference pixels and associated interference weights; S2, constructing a coordinate projection matrix by combining the inertial pose matrix of the camera, mapping the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system and recording the inverse coordinate transformation matrix; expanding along the cylindrical generatrix to generate a two-dimensional planar canvas, extracting the interference weights of the environmental interference confidence mask corresponding to the overlapping areas of multiple frames, fusing the gray values ​​of the overlapping area pixels according to the inverse weight mapping relationship, and generating a panoramic feature map of the pipe wall. S3. Construct a pixel gradient structure tensor matrix of the downsampling level of the panoramic feature map of the pipe wall, and locate the structural pixel set by obtaining the ratio of the principal and secondary eigenvalues ​​through eigenvalue decomposition; extract activation values ​​along the multi-resolution channel, superimpose a first gain factor on the activation values ​​within the structural pixel set, and superimpose a smaller second gain factor on the activation values ​​outside the structural pixel set to generate a multi-scale feature response matrix; S4. Extract the two-dimensional pixel contour coordinates and category labels of the defect activation region in the multi-scale feature response matrix through a depth detection network; substitute the two-dimensional pixel contour coordinates into the coordinate transformation inverse matrix to perform three-dimensional spatial mapping inverse solution, obtain the three-dimensional surface boundary coordinates, construct a spatial polygon to calculate the surface area value, and output the detection results containing the three-dimensional surface boundary coordinates, surface area value, and category label.

[0028] In this implementation scheme, step S1 mainly involves quantifying, separating, and labeling the underwater dynamic interference features within the pipeline. The optical flow field displacement vector refers to the apparent motion trajectory of pixels on a two-dimensional plane caused by camera movement or water fluctuations in a continuous image sequence. The rigid background refers to the pixels of the actual pipe wall structure that maintain stable relative motion geometry with the pipeline robot. Non-rigid interference pixels refer to pixels with irregular, independent movements such as water flow fluctuations, localized water surface reflections, or free-floating particles. The environmental interference confidence mask is a numerical weight matrix used to record the spatial coordinate distribution of these interference pixels and the severity of the interference. The technical function of this step is to accurately identify the highly variable dynamic environmental interference in the water supply pipeline from the perspective of physical motion attributes, avoiding the misjudgment of water stains or reflections as pipe wall defects by conventional image processing. This provides pixel-level interference removal criteria for image feature fusion in subsequent steps.

[0029] Step S2 primarily aims to eliminate perspective distortion in the pipe image and reconstruct a high-quality panoramic feature map of the pipe wall. The camera's inertial pose matrix represents the lens's optical distortion parameters and the sensor's real-time recording of the camera's 3D attitude and position information within the pipe. The 3D cylindrical coordinate system surface mapping refers to projecting the 2D planar image onto a virtual cylindrical model corresponding to the physical pipe wall based on spatial geometric relationships. The coordinate transformation inverse matrix records the mathematical mapping topological relationship of how pixels on the 2D unfolded plane are reconstructed back to their 3D absolute spatial positions. The technical function of this step is to use spatial geometric projection to flatten the original single-image pipe image with severe edge compression distortion into a 2D canvas with a consistent physical scale. Furthermore, it forcibly introduces the interference weights calculated in step S1 into the overlapping areas of the image stitching for fusion, resulting in pixels with severe interference being assigned extremely low grayscale contribution. This directly eliminates environmental noise at the physical topology level and generates a seamless panoramic feature map.

[0030] Step S3 primarily refines the physical coherence of minute defects and suppresses the feature activation of isolated noise points. The pixel gradient structure tensor matrix is ​​a covariance matrix used to describe the distribution of pixel gray-level gradient directions and edge strength within the local neighborhood of the image. Eigenvalue decomposition to obtain the ratio of principal and secondary eigenvalues ​​refers to determining whether the local texture presents isotropic isolated spots or anisotropic line extensions by analyzing the tensor matrix. The structured pixel set refers to the set of suspected cracks or edge pixels that exhibit a continuous geometric spatial orientation after ratio filtering. The technical role of this step is to utilize the spatial distribution of the underlying tensor features to strictly distinguish between genuine small cracks in the pipe wall and scattered water stain noise at a mathematical analytical level. Furthermore, it specifically amplifies the signal gain of real crack pixels during multi-scale feature extraction, significantly enhancing the salience of small target defects in the multi-scale feature response matrix.

[0031] Step S4 primarily involves converting the pixel-level results identified by the network into three-dimensional physical measurement dimensions with absolute engineering dimensions. The deep detection network refers to a defect extraction model with high-dimensional feature encoding and spatial channel attention allocation capabilities. The three-dimensional spatial mapping inverse solution involves substituting the two-dimensional defect contour coordinates output by the detection network into the coordinate transformation inverse matrix generated in step S2 to reconstruct the three-dimensional coordinate points of the real physical world. The spatial polygon is a geometric surface patch formed by closing the loop in the three-dimensional coordinate system using these three-dimensional coordinate points as vertices. The technical advantage of this step lies in overcoming the limitation of conventional visual inspection, which can only output pixel bounding boxes. Combined with the previously established spatial mapping relationship, it directly converts the defect region in the image dimension into real three-dimensional in-situ coordinates and absolute physical surface area, providing high-precision quantitative physical indicators for pipeline engineering maintenance and leakage risk assessment.

[0032] Please see Figure 2 Specifically, the process of acquiring the water supply pipeline image sequence and calculating the optical flow field displacement vector of adjacent frame pixels is as follows: extract the pixel spatial gray-level gradient matrix and temporal gradient matrix of adjacent frames in the water supply pipeline image sequence, and establish a constant pixel brightness constraint equation; construct a multi-scale image pyramid, solve the initial optical flow vector of the pixel at the top of the multi-scale image pyramid, project the initial optical flow vector down layer by layer along the multi-scale image pyramid and iteratively update the pixel spatial gray-level gradient matrix, and converge to obtain the optical flow field displacement vector of adjacent frame pixels.

[0033] In this implementation scheme, to accurately capture the true physical movement trajectory of pixels in complex underwater environments, the pixel spatial grayscale gradient matrix and temporal gradient matrix of adjacent image frames are first extracted. The establishment of a constant pixel brightness constraint equation is based on the prior physical assumption that the grayscale value of the same physical point in the image remains unchanged within adjacent extremely short time intervals. To address the problem of the failure of the basic constraint equation due to the large-scale displacement of pixels near the pipe wall caused by robot movement, a multi-scale image pyramid is constructed. This pyramid downsamples the high-resolution image layer by layer to a lower resolution, transforming the large-distance displacements that are difficult to track at the bottom layer into small displacements that can be linearized using Taylor expansion at the top layer. After solving for the initial optical flow vector of the pixel at the top layer of the multi-scale image pyramid, this initial value is projected downwards along the pyramid layer by layer, and the pixel spatial grayscale gradient matrix is ​​iteratively updated at each layer to continuously approximate the true pixel displacement. During this tracking process, the formula for calculating the incremental update of the optical flow vector within a certain downsampling layer is as follows: ;in, The level of the pyramid downsampling is: Time coordinate position is and Increment of the pixel optical flow vector at that location; The local spatial neighborhood window set when solving for the optical flow vector; : Spatial traversal index parameter within the local spatial neighborhood window; : The pixel space grayscale gradient matrix vector corresponding to the spatial traversal index parameter; : Indicator for matrix transpose operation; : The temporal gradient scalar at the corresponding spatial traversal index parameter. Through the above top-down layer-by-layer accumulation and nonlinear iterative approximation, the system finally converges to obtain the extremely accurate optical flow field displacement vectors of adjacent frame pixels at the bottom layer, thereby physically separating the geometric distortion of the static pipe wall from the transient characteristics of the dynamic water flow at the bottom layer data dimension.

[0034] Specifically, the process of dividing pixels into rigid background and non-rigid interference pixels based on displacement vector distribution, and generating an environmental interference confidence mask containing two-dimensional coordinates of non-rigid interference pixels and associated interference weights is as follows: A high-dimensional motion feature space is constructed by aggregating the amplitude and direction angle of the optical flow field displacement vectors of adjacent frame pixels. Density clustering is performed in the high-dimensional motion feature space to separate the principal component clusters that match the prior trajectory of the pipeline robot as rigid background pixels. Discrete motion feature points outside the principal component clusters are extracted as non-rigid interference pixels. The two-dimensional coordinates of the non-rigid interference pixels are extracted, and the Mahalanobis distance distribution features of the optical flow field displacement vector amplitudes of the corresponding non-rigid interference pixels deviating from the center of the principal component clusters are extracted to construct associated interference weights. The environmental interference confidence mask is then output.

[0035] In this implementation scheme, after acquiring the motion features of all pixels on the screen, it is necessary to separate the real rigid background of the pipe wall from the underwater impurity interference from the perspective of physical kinematics. The system first aggregates the amplitude and direction angle of the optical flow field displacement vector of adjacent frame pixels to construct a high-dimensional motion feature space, which can comprehensively reflect the instantaneous dynamic attributes of each pixel. Since the pipe robot moves relatively smoothly along its axis inside the pipe, the real rigid pipe wall pixels will exhibit a highly consistent overall radial motion pattern in visual mapping, while water vortices, floating impurities, and local highlights will exhibit chaotic random motion that deviates from the main trajectory. Therefore, performing density clustering in the high-dimensional motion feature space can unsupervisedly and naturally group a large number of continuous pixels that follow the unified rigid body kinematics together, thereby separating the principal component clusters that match the prior trajectory of the pipe robot's motion as rigid background pixels, and accurately identifying discrete motion feature points outside this high-density space as non-rigid interference pixels. To quantify the adverse effects of these transient disturbances on subsequent image stitching, the system extracts the Mahalanobis distance distribution features of the optical flow field displacement vector amplitudes corresponding to non-rigid disturbance pixels, which deviate from the centers of the principal component clusters. This feature is then used to construct the associated disturbance weights. Using Mahalanobis distance instead of ordinary Euclidean distance effectively eliminates the dimensional differences in motion features across velocity amplitude and deflection angle dimensions, as well as the covariance correlation of the data. The formula for calculating these associated disturbance weights is as follows: ;in, : Coordinate position is and The associated interference weights corresponding to the non-rigid interference pixels at the location; The high-dimensional motion feature vector of this pixel deviates from the center of the principal component cluster by the Mahalanobis distance scalar. The dynamic bandwidth coefficient controls the decay rate of the weight space. To ensure the system's scene adaptability under different pipe water pressure and flow rates, as well as multiple robot travel speeds, this invention discloses a method for determining the dynamic bandwidth coefficient. Specifically, it extracts high-dimensional motion feature vectors of all rigid background pixels within the principal component cluster, calculates the arithmetic mean of the Mahalanobis distances from these feature vectors to the geometric center of the principal component cluster, and directly assigns this arithmetic mean to the dynamic bandwidth coefficient. Through this dynamic nonlinear mapping mechanism, the system assigns interference weights that are closer to the extreme high values ​​to random disturbances whose kinematic distance deviates further from the main motion trajectory. The final output is an environmental interference confidence mask that can accurately indicate the topological position and severity of impurities across the entire screen, directly providing crucial pixel-level physical screening basis for the subsequent generation of seamless panoramic images from 3D cylindrical surfaces.

[0036] Please see Figure 3 Specifically, the process of constructing a coordinate projection matrix by combining the camera's intrinsic parameters with the inertial pose matrix, mapping the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system, and recording the inverse coordinate transformation matrix is ​​as follows: Extract the camera's rotation and translation components relative to the tube axis from the inertial pose matrix, and construct a coordinate projection matrix by combining the camera's intrinsic parameters (focal length and optical center coordinates), the camera's rotation components relative to the tube axis, and the translation components; apply the coordinate projection matrix to project the two-dimensional coordinates of the image sequence pixels onto the surface of a three-dimensional cylindrical coordinate system with the tube axis as the geometric center, obtain the three-dimensional spatial coordinates of the pixels, record the injective mapping topological relationship between the two-dimensional coordinate domain and the three-dimensional spatial coordinate domain of the image sequence pixels, and generate the inverse coordinate transformation matrix.

[0037] In this implementation scheme, to completely eliminate the visual perspective distortion caused by the water supply pipe as a closed cylinder in single-view images, the system must restore the distorted two-dimensional pixels to the real physical space. Conventional image stitching often directly aligns feature points on the two-dimensional plane, which can lead to the severe compression or even loss of tiny cracks at the pipe wall edge due to distortion. Therefore, this step first extracts the camera's rotation and translation components relative to the pipe axis from the inertial pose matrix. These two components record the yaw, pitch, and roll attitude deviations of the pipe robot caused by the impact of water flow during its movement. Combining the calibrated camera intrinsic focal length and optical center coordinates, the system can accurately reconstruct the complete optical path of light from the three-dimensional physical world through the camera lens and onto the photosensitive element, thereby constructing a precise coordinate projection matrix. Applying this matrix, the system can project the two-dimensional coordinate rays of the image sequence pixels along the reverse direction of light propagation onto the surface of a preset three-dimensional cylindrical coordinate system with the pipe axis as the geometric center and a known radius, thus solving for the real physical position of each pixel on the inner wall of the pipe. The spatial mapping calculation formula for this process is as follows: ;in, : Column vector of pixel three-dimensional spatial coordinates; The field-of-view depth scale constraint factor is determined by the fixed physical radius of the pipeline; The camera rotation component matrix relative to the tube axis extracted from the inertial pose matrix; The inverse of the camera intrinsic parameter matrix; : The horizontal two-dimensional coordinates of pixels in an image sequence; Vertical two-dimensional coordinates of pixels in an image sequence; T: identifier for matrix transpose operation; : The translation component column vector extracted from the inertial pose matrix. Through the above physical backprojection, the system not only obtains the three-dimensional spatial coordinates of the pixels, but more importantly, records the one-to-one injective mapping topological relationship between the two-dimensional image domain and the three-dimensional cylindrical domain, generating the coordinate transformation inverse matrix. This inverse matrix is ​​the core transformation basis for subsequent steps to transform the pixel-level defects obtained by the detection algorithm into the real three-dimensional physical area.

[0038] Specifically, the process of generating a two-dimensional planar canvas by unfolding along the cylindrical generatrix, extracting environmental interference confidence mask interference weights corresponding to the overlapping regions of multiple frames, and fusing the pixel gray values ​​of the overlapping regions according to the inverse weight mapping relationship to generate a panoramic feature map of the pipe wall is as follows: Extract the cylindrical polar angle variable and axial height variable of the surface of the three-dimensional cylindrical coordinate system, map the cylindrical polar angle variable and axial height variable to the Cartesian plane coordinate system to establish a two-dimensional planar canvas, and match the overlapping regions of the image sequence pixels in the two-dimensional planar canvas of multiple frames; extract the environmental interference confidence mask interference weights corresponding to the overlapping regions of multiple frames, construct an interference weight attenuation function, and apply the interference weight attenuation function to perform normalized weighted fusion on the pixel gray values ​​of the image sequence at the same coordinate position in the overlapping regions of multiple frames to output the panoramic feature map of the pipe wall.

[0039] In this implementation scheme, after obtaining the three-dimensional cylindrical spatial distribution of pixels, the three-dimensional pipe wall needs to be converted into a flat base map suitable for deep learning model processing, while eliminating ghosting and underwater environmental noise at the stitching of multiple frames. The system first extracts the cylindrical polar angle and axial height variables from the surface of the three-dimensional cylindrical coordinate system, similar to cutting and flattening a cylindrical paper tube along its generatrix. These two spatial variables are then proportionally mapped to the Cartesian plane coordinate system, thus establishing a seamless two-dimensional planar canvas. Since the pipe robot continuously captures images along the pipe axis, multiple frames inevitably have a large number of overlapping areas on the two-dimensional planar canvas. Conventional mean fusion would mix underwater reflections, suspended impurities, and the real pipe wall texture, resulting in a blurred background. To ensure the purity of the pipe wall features, the system accurately matches the coordinates of pixels in the overlapping area of ​​the image sequence and extracts the corresponding environmental interference confidence mask interference weights generated in the previous steps. An interference weight decay function based on exponential decay characteristics is constructed, and this function is applied to perform normalized weighted fusion on the gray values ​​of pixels at the same coordinate position within the overlapping area. The calculation formula for this normalized weighted fusion is as follows: ;in, The coordinates of the normalized weighted fusion of the pipe wall panoramic feature map on the two-dimensional canvas are: and The final grayscale value at the location; The total number of overlapping image sequences mapped to a specific coordinate on a two-dimensional plane canvas; Temporal index identifier for multi-frame overlapping image sequences; :No. The original pixel grayscale value projected onto this coordinate from the frame image sequence; The adjustment coefficient of the interference weight decay function; Extracted from the first The frame corresponds to the interference weight value of the environmental interference confidence mask. Regarding the method for determining the adjustment coefficient, the system extracts the global variance parameter of all interference weight values ​​within the overlapping area of ​​the multi-frame sequence, calculates the reciprocal of the global variance parameter, and directly sets this reciprocal as the adjustment coefficient. This setting method ensures that the stronger the penalty of the attenuation function is in areas with more severe local water body interference. Through this nonlinear mapping relationship, the system causes the contribution of pixels with extremely high environmental interference weights (such as highly reflective points) to decrease exponentially during the fusion process, while clear pipe wall pixels with small interference weights dominate the final grayscale representation, thus outputting a high-fidelity panoramic feature map of the pipe wall that possesses both a global macroscopic physical view and completely eliminates underwater impurity interference at the micro-pixel level.

[0040] Please see Figure 4Specifically, the process of constructing the pixel gradient structure tensor matrix of the downsampling level of the panoramic feature map of the pipe wall, and locating the structural pixel set by calculating the ratio of principal and secondary eigenvalues ​​through eigenvalue decomposition is as follows: Extract the horizontal and vertical pixel derivative matrices of the panoramic feature map of the pipe wall at the local spatial resolution, and fuse the horizontal and vertical pixel derivative matrices to construct a local neighborhood covariance matrix; define the local neighborhood covariance matrix as the pixel gradient structure tensor matrix, perform eigenvalue decomposition on the pixel gradient structure tensor matrix to extract the first principal eigenvalue representing the gradient of the main local texture direction and the second eigenvalue representing the orthogonal gradient of the local texture; establish an anisotropic proportional response function for the first and second principal eigenvalues ​​to calculate the ratio of principal and secondary eigenvalues, and extract coordinate nodes presenting a continuous spatial distribution based on the output distribution of the anisotropic proportional response function, thereby locating and generating the structural pixel set.

[0041] In this implementation scheme, to accurately isolate real physical cracks and structural damage from the complex pipe wall background, the system avoids the traditional simple segmentation based on absolute pixel grayscale thresholds. Instead, it performs in-depth analysis at the level of geometric topological coherence of local texture. In the panoramic feature map of the pipe wall, background noise such as water surface reflections or isolated sediments exhibits a gradient distribution that diverges uniformly in all directions in both the horizontal and vertical pixel derivative matrices, which is a typical isotropic feature. In contrast, real fine cracks in the pipe wall show a strong continuous orientation along their extension direction, with extremely high gradient abrupt changes in the direction perpendicular to the crack's cross-section, which is a significant anisotropic feature. Therefore, the system constructs a local neighborhood covariance matrix, i.e., a pixel gradient structure tensor matrix, by fusing the derivative matrices of the two directions. After performing eigenvalue decomposition on this matrix, the extracted first principal eigenvalue represents the gradient energy in the direction of the most drastic texture change within the local neighborhood, and the second eigenvalue represents the gradient energy in the direction orthogonal to it. To quantitatively amplify this anisotropic difference and filter out isolated noise, the system establishes anisotropic proportional response functions for the first principal eigenvalue and the second eigenvalue. The nonlinear calculation process of this function is as follows: ;in, :Located in the panoramic features of the pipe wall Figure 2 3D coordinates and Anisotropic proportional response output value at the location; The first principal eigenvalue obtained by decomposing the pixel gradient structure tensor matrix at this coordinate point; The second eigenvalue obtained by decomposing the pixel gradient structure tensor matrix at this coordinate point; A small smoothing constant term to prevent numerical overflow caused by the denominator reaching a minimum value; Hyperbolic tangent nonlinear operator; The scaling mapping coefficient controls the upper limit of the global response intensity. Regarding the method for determining the scaling mapping coefficient, the system extracts the first principal feature value set of all pixels in the spatial plane of the entire pipe wall panoramic feature map, calculates the global median of these first principal feature value sets, and directly sets the reciprocal of this global median as the scaling mapping coefficient. Through this analytical formula, when the local area of ​​the image is an isolated water droplet or a reflective noise point, the feature values ​​in the two orthogonal directions tend to be equal, and the numerator term rapidly approaches zero, resulting in deep suppression of the overall response. When the area is a linear pipe wall crack, the difference between the principal and secondary feature values ​​is huge, and the response value is exponentially amplified and enhanced. Based on the output distribution of this response function, coordinate nodes exhibiting a continuous spatial distribution are extracted. The system can locate and generate extremely accurate structural pixel sets in the complex underwater light and shadow, providing reliable underlying physical prior location information for subsequent feature pyramid attention enhancement.

[0042] Specifically, the process of extracting activation values ​​along multi-resolution channels, superimposing a first gain factor on activation values ​​within the structured pixel set, and superimposing a smaller second gain factor on activation values ​​outside the structured pixel set to generate a multi-scale feature response matrix is ​​as follows: The panoramic feature map of the pipe wall is input into a feature pyramid architecture. Local receptive field feature maps of the multi-resolution channels are extracted along bottom-up and top-down paths. The channel-dimensional activation and spatial-dimensional activation of the local receptive field feature maps are extracted as activation values ​​for the multi-resolution channels. The spatial mapping coordinates of the structured pixel set in the multi-resolution channels are matched. A first gain factor representing feature enhancement is configured in regions where spatial mapping coordinates overlap, and a smaller second gain factor is configured in regions where spatial mapping coordinates differ. Nonlinear modulation of the channel-dimensional and spatial-dimensional activation is performed using the first and second gain factors. The nonlinearly modulated local receptive field feature maps are then aggregated to construct a multi-scale feature response matrix.

[0043] In this implementation scheme, considering the extremely wide physical range of defects in water supply pipelines, including both large-area sheet-like scale corrosion and extremely small capillary crack deformation, the system inputs a panoramic feature map of the pipe wall into a feature pyramid architecture to ensure the model's ability to capture multi-scale defects in parallel and further highlight key structural features. Following bottom-up and top-down paths, the model can extract local receptive field feature maps across downsampling levels of different spatial resolutions, thereby simultaneously obtaining macroscopic background context semantics and microscopic edge detail information. Based on this multi-scale processing, the channel dimension activation and spatial dimension activation of the local receptive field feature maps are extracted to comprehensively measure the intensity of information response in both depth representation and breadth distribution of the neural network feature layers. Subsequently, the system maps and matches the two-dimensional spatial coordinates of the high-precision structural pixel set obtained in the previous key step to these multi-resolution channels. In effective regions where the spatially mapped coordinates coincide—i.e., local regions where the underlying physical laws determine the existence of real defects—the system configures a first gain factor to enhance the characterization features; in broad background or water flow interference regions with dissimilar coordinates, the system configures a smaller second gain factor. By applying these two asymmetric gain factors to perform nonlinear modulation aggregation on the channel-dimensional activation and spatial-dimensional activation, the real structural damage signal is nonlinearly amplified by the network, while background fluid interference is further suppressed by the network. The specific nonlinear modulation aggregation calculation process is as follows: ;in, After nonlinear modulation, at the first The coordinate positions in the multi-resolution feature channels are and Aggregate output value of local receptive field feature response at the location; :Nonlinear correction filtering operator, used for unidirectional zeroing of negative redundant noise; The spatial gain modulation coefficient is dynamically configured. When the coordinate belongs to the mapping range of the structured pixel set, the coefficient is given a first gain factor, and when it is outside the set range, it is given a second gain factor. The first The channel-dimensional activation scalar of each feature layer channel at the global abstract semantic level; : Spatial dimensional activation of a pixel at a specific coordinate within the feature layer of this channel; The offset penalty truncation term is obtained from the adaptive convergence training of the model. Regarding the determination method of the first and second gain factors, the system presets the first gain factor to a constant of one to ensure the lossless flow of geometric morphology of real defect features during the forward propagation of the high-dimensional network. Simultaneously, the system statistically analyzes the spatial distribution density ratio of structural pixels within the neighborhood of each local spatial receptive field to the total number of pixels in the neighborhood, and directly assigns this spatial distribution density ratio to the second gain factor. This adaptive dynamic parameter configuration mechanism makes the spatial gain modulation coefficient of isolated blank background regions extremely small, thus completely eliminating useless attention activation in these blank regions through the subtraction operation of the offset penalty truncation term. Finally, the system aggregates these locally receptive field feature maps that have undergone dual fine modulation of spatial and channel characteristics to construct a multi-scale feature response matrix. This matrix not only has extremely low noise but also maximizes the significance of real defect signals across scales, greatly reducing the computational burden on subsequent deep convolutional detection networks for defect classification and regression against deep-water turbid pipe wall backgrounds.

[0044] Please see Figure 5 Specifically, the process of extracting the two-dimensional pixel contour coordinates and category labels of the defect activation region in the multi-scale feature response matrix through a deep detection network is as follows: The multi-scale feature response matrix is ​​input into the multi-scale feature encoder of the deep detection network to extract the high-dimensional feature vector output by the multi-scale feature encoder. A spatial channel collaborative attention layer is applied to the high-dimensional feature vector to extract the local saliency heat map. The closed pixel set formed by the defect activation boundary within the local saliency heat map is extracted to generate the two-dimensional pixel contour coordinates. The semantic feature components within the region enclosed by the two-dimensional pixel contour coordinates are extracted, and the semantic feature components are input into the classification perceptron to parse and map the defect category label.

[0045] In this implementation scheme, to accurately extract the true defect morphology and assign it semantic attributes from the multi-scale feature response matrix, the system inputs this matrix into the multi-scale feature encoder of the deep detection network, converting the underlying pixel texture features into a high-dimensional feature vector containing high-order abstract semantics. In the complex underwater pipe wall environment, simple convolutional extraction is easily affected by background sediment deposition, leading to blurred boundaries. Therefore, the system applies a spatial channel collaborative attention layer to the high-dimensional feature vector. This attention layer can dynamically identify and amplify specific channel features representing defect characteristics, while focusing on high-frequency edge change regions in the spatial dimension, thereby extracting a locally significant thermal distribution map that excludes background interference. The specific calculation formula for the thermal values ​​in the locally significant thermal distribution map is as follows: ;in, Located in spatial coordinates and The local significant thermal output value at the location; The total number of feature channels contained in a high-dimensional feature vector; The traversal index parameter for the feature channels; Channel importance weight coefficients corresponding to specific feature channels; : The activation response value of a high-dimensional feature vector at a specific feature channel and spatial coordinates; Hyperbolic tangent activation operator; Spatial sharpening adjustment coefficient; The edge response intensity extracted at this coordinate after performing Laplacian edge high-frequency filtering on the channel average feature map; and : Horizontal and vertical traversal index parameters used for global space normalization summation; and The maximum boundary size of the feature map in the horizontal and vertical directions. Regarding the method for determining the spatial sharpening adjustment coefficient, the system extracts the global data variance parameter of the entire high-dimensional feature vector across all spatial dimensions, calculates the reciprocal of this global data variance parameter, and directly assigns the calculated reciprocal value to the spatial sharpening adjustment coefficient. This allows images with more complex backgrounds to adaptively receive higher edge sharpening penalties. Through this collaborative attention mechanism, the system can accurately extract closed pixel sets formed by high-heat value activation boundaries from the local saliency heatmap, thereby generating continuous closed two-dimensional pixel contour coordinates. Finally, the system extracts highly condensed semantic feature components within the region enclosed by these two-dimensional pixel contour coordinates and inputs these semantic feature components into a classification perceptron for high-dimensional spatial classification mapping, accurately resolving the corresponding defect category labels, and completing the determination from low-level image features to high-level semantic disease types.

[0046] Specifically, the process of substituting the two-dimensional pixel contour coordinates into the inverse coordinate transformation matrix to perform a three-dimensional spatial mapping inverse solution, obtaining the three-dimensional surface boundary coordinates, constructing a spatial polygon to calculate the surface area value, and outputting the detection result containing the three-dimensional surface boundary coordinates, surface area value, and category label is as follows: Extract the edge node sequence within the two-dimensional pixel contour coordinates, input the edge node sequence into the inverse coordinate transformation matrix to perform a nonlinear geometric back projection operation, extract the three-dimensional surface boundary coordinates of the edge node sequence on the three-dimensional cylindrical surface, construct a spatial polygon on the three-dimensional cylindrical surface according to the topological connection relationship of the edge node sequence; perform surface integration operation on the spatial polygon to calculate the surface area value, aggregate the three-dimensional surface boundary coordinates, surface area value, and defect category label to construct a multi-dimensional defect state description table, and output the detection result.

[0047] In this implementation scheme, after obtaining the two-dimensional detection results output by the neural network, it is necessary to break through the limitation of traditional machine vision, which can only output pixel-level two-dimensional bounding boxes, and restore the detection results to the absolute engineering dimensions in the real physical world. Because the inner wall of the water supply pipe has a curved cylindrical topology, directly calculating the area of ​​pixel contours on a two-dimensional plane will produce a huge perspective truncation error. Therefore, the system extracts the edge node sequence within the coordinates of the two-dimensional pixel contours and inputs these edge node sequences into the previously recorded inverse coordinate transformation matrix to perform a nonlinear geometric backprojection operation. This operation re-projects each pixel lacking depth information back into the three-dimensional physical space, accurately extracting the three-dimensional surface boundary coordinates of the edge node sequence on the real three-dimensional cylindrical surface. To calculate the true area of ​​the physical defect, the system constructs a spatial polygon on the three-dimensional cylindrical surface according to the original topological connection relationship of the edge node sequence, and discretizes this spatial polygon into a triangular mesh that closely fits the curvature of the pipe wall. Then, a surface integral operation is performed on the spatial polygon to calculate the surface area. The specific calculation formula for converting this surface integral into the sum of the discrete spatial triangular mesh surfaces is as follows: ;in, The absolute physical surface area of ​​the defect on the actual inner wall of the pipe; Curvature compensation correction coefficient; The total number of discrete triangular faces divided by the constructed spatial polygon; Traversal index parameters for discrete triangle faces; , , The projection length component of the first spatial physical direction vector of a specific triangular discrete patch onto the three orthogonal data axes of a preset three-dimensional coordinate system. The projection length components of the second spatial physical direction vector of the specific triangular discrete surface patch onto the three orthogonal data axes. Regarding the method for determining the curvature compensation correction coefficient, the system extracts the inherent standard physical radius parameter of the pipeline, calculates the reciprocal of the standard physical radius parameter to obtain the average geometric curvature of the pipe wall, and assigns the amplified value of this average geometric curvature, mapped by an exponential function, to the curvature compensation correction coefficient. This rigorously eliminates the area underestimation error caused by approximating the cylindrical surface with a planar triangle. After the above three-dimensional inverse solution and surface integral calculation, the system aggregates the three-dimensional surface boundary coordinates, surface area values, and defect category labels to construct a multi-dimensional defect status description table and outputs the detection results. This completely connects the entire chain from two-dimensional visual images to three-dimensional real physical engineering quantity measurement, providing directly usable high-precision quantitative indicators for the safety maintenance and leakage risk assessment of urban pipe networks.

[0048] Please see Figure 6A pipeline defect detection system based on multi-scale attention is used to execute the aforementioned pipeline defect detection method based on multi-scale attention. It includes the following modules: an interference separation module, used to acquire a sequence of water supply pipeline images and calculate the optical flow field displacement vectors of adjacent frame pixels; based on the displacement vector distribution, pixels are divided into rigid background and non-rigid interference pixels, generating an environmental interference confidence mask containing the two-dimensional coordinates of non-rigid interference pixels and associated interference weights; a panoramic reconstruction module, used to construct a coordinate projection matrix by combining the in-camera participating inertial pose matrix, mapping the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system and recording the inverse coordinate transformation matrix; expanding along the cylindrical generatrix to generate a two-dimensional planar canvas, extracting the interference weights of the environmental interference confidence mask corresponding to the overlapping areas of multiple frames, fusing the gray values ​​of the overlapping area pixels according to the inverse weight mapping relationship, and generating the pipe wall... The system comprises a panoramic feature map and a feature response module. The former constructs a pixel gradient structure tensor matrix at the downsampling level of the panoramic feature map of the pipe wall, and uses eigenvalue decomposition to obtain the ratio of primary and secondary eigenvalues ​​to locate the structural pixel set. The latter extracts activation values ​​along multi-resolution channels, superimposes a first gain factor on activation values ​​within the structural pixel set, and superimposes a smaller second gain factor on activation values ​​outside the structural pixel set, generating a multi-scale feature response matrix. The latter is a 3D inverse solution module, which extracts the 2D pixel contour coordinates and category labels of the defect activation regions in the multi-scale feature response matrix using a depth detection network. It then substitutes the 2D pixel contour coordinates into the coordinate transformation inverse matrix to perform 3D spatial mapping and inverse solution, obtaining the 3D surface boundary coordinates and constructing a spatial polygon to calculate the surface area. The module outputs the detection results containing the 3D surface boundary coordinates, surface area values, and category labels.

[0049] In this implementation scheme, the interference separation module serves as the data purification front-end of the entire detection system. Its main function is to automatically filter underwater dynamic environmental noise from the raw video stream acquired by the pipeline robot. This module uses optical flow field calculation and cluster analysis to completely separate the rigid, real pipe wall passively following the robot's viewpoint from randomly moving suspended impurities or localized highlights, generating a mask that quantifies the degree of these interferences. The operation of this module ensures that all subsequent spatial stitching and algorithm analysis are based on a clean and reliable physical base map, fundamentally preventing the system from misreporting underwater transient impurities as pipe wall structural defects. The panoramic reconstruction module, as the geometric correction and spatial stitching hub of the system, primarily eliminates the severe perspective distortion caused by single-view images in a closed cylindrical pipe. This module uses inertial navigation pose and camera intrinsic parameters to project the 2D image backward onto a 3D physical cylindrical surface and flatten it along the generatrix. Simultaneously, it forcibly introduces the interference weights output by the front-end module, performing a cliff-like attenuation fusion on high-interference pixels at the intersection of multiple overlapping frames. This module successfully breaks through the limitations of traditional frame-by-frame detection, which leads to fragmented views and edge distortions, providing the algorithm with a physically consistent and seamless macroscopic panoramic canvas. The feature response module, as the core feature extraction and signal enhancement engine of the system, primarily functions to accurately refine and amplify the morphological features of minute defects in the complex background of the pipe wall. This module abandons conventional absolute grayscale thresholding and instead uses gradient structure tensor matrix depth analysis to determine the anisotropic coherence of local textures, strictly distinguishing real micro-cracks from isolated noise at the mathematical topological level, and implementing directional gain modulation for structural features in multi-scale feature channels. This module significantly enhances the signal of micro-structural damage in deep-water environments, greatly reducing the difficulty of feature extraction for small target defects in the backend depth detection network. The 3D inverse solution module, as the final engineering quantification and result output terminal of the system, primarily transforms the pixel-level two-dimensional defect contours identified by the network model into three-dimensional physical measurement indicators with absolute engineering dimensions. This module, after locking the closed boundary of the defect using a depth detection network, directly calls the inverse coordinate transformation matrix stored in the panoramic reconstruction module to reproject the two-dimensional contour nodes back into the real three-dimensional pipe wall surface space, and calculates the absolute physical surface area of ​​the defect using spatial surface integration. This module enables the system to overcome the limitations of traditional visual inspection that can only output two-dimensional pixel boxes, and directly provides high-precision, quantifiable three-dimensional in-situ spatial data for pipeline maintenance and leakage risk assessment.

[0050] In summary, this application has at least the following effects:

[0051] A pipeline defect detection method and system based on multi-scale attention accurately separates underwater dynamic environmental impurities and generates interference confidence masks through optical flow field displacement clustering. Combined with the camera's in-camera participating inertial pose matrix, the 2D image is back-projected onto a 3D cylindrical surface for reconstruction and flattening, completely eliminating perspective distortion and non-rigid noise interference in the local image from a physical topology level. Simultaneously, the eigenvalue decomposition of the pixel gradient structure tensor matrix is ​​used to deeply analyze the anisotropic coherence properties of the surface physical morphology. Directional gain modulation is applied to structural micro-defects in multi-scale feature channels, effectively purifying high-frequency defect signals against complex pipe wall backgrounds. Finally, overcoming the limitation of traditional machine vision that can only output 2D pixel boundaries, the system uses a collaborative coordinate transformation inverse matrix to back-map the 2D defect contour to 3D in-situ space for surface integration, directly outputting the absolute physical surface area and true 3D spatial coordinates of the defect. This achieves a complete technical closed loop from underlying physical denoising to high-precision 3D engineering quantity measurement, providing highly valuable and accurate decision-making data for the safety maintenance and leakage risk assessment of urban water supply networks.

[0052] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0053] This invention is described with reference to flowchart illustrations and / or block diagrams of systems, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0054] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0055] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0056] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0057] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A pipeline defect detection method based on multi-scale attention, characterized in that, Includes the following steps: S1. Obtain the image sequence of the water supply pipeline and calculate the optical flow field displacement vector of adjacent frame pixels. Based on the displacement vector distribution, divide the pixels into rigid background and non-rigid interference pixels, and generate an environmental interference confidence mask containing two-dimensional coordinates of non-rigid interference pixels and associated interference weights. S2. Combine the inertial pose matrix of the camera to construct a coordinate projection matrix, map the image sequence pixels to the surface of the three-dimensional cylindrical coordinate system and record the inverse coordinate transformation matrix; A two-dimensional planar canvas is generated by unfolding along the cylinder generatrix. The environmental interference confidence mask interference weights corresponding to the overlapping areas of multiple frames are extracted. The pixel gray values ​​of the overlapping areas are fused according to the weight inverse proportional mapping relationship to generate a panoramic feature map of the pipe wall. S3. Construct the pixel gradient structure tensor matrix of the downsampling level of the panoramic feature map of the pipe wall, and locate the set of structural pixels by obtaining the ratio of the principal and secondary eigenvalues ​​through eigenvalue decomposition. Activation values ​​are extracted along the multi-resolution channels. A first gain factor is superimposed on the activation values ​​within the structured pixel set, and a smaller second gain factor is superimposed on the activation values ​​outside the structured pixel set to generate a multi-scale feature response matrix. S4. Extract the two-dimensional pixel contour coordinates and category labels of the defect activation region in the multi-scale feature response matrix through a deep detection network; substitute the two-dimensional pixel contour coordinates into the coordinate transformation inverse matrix to perform three-dimensional spatial mapping inverse solution, obtain the three-dimensional surface boundary coordinates and construct a spatial polygon to calculate the surface area value, and output the detection results containing the three-dimensional surface boundary coordinates, surface area value and category label. The specific process of dividing pixels into rigid background and non-rigid interference pixels based on displacement vector distribution, and generating an environmental interference confidence mask containing two-dimensional coordinates of non-rigid interference pixels and associated interference weights is as follows: A high-dimensional motion feature space is constructed by aggregating the magnitude and orientation angle of the optical flow field displacement vectors of adjacent frame pixels. Density clustering is then performed in the high-dimensional motion feature space to separate the principal component clusters that match the prior trajectory of the pipeline robot as rigid background pixels. Discrete motion feature points outside the principal component clusters are extracted as non-rigid interference pixels. The two-dimensional coordinates of the non-rigid interference pixels are extracted, and the Mahalanobis distance distribution features of the magnitude of the optical flow field displacement vector corresponding to the non-rigid interference pixels deviating from the center of the principal component cluster are extracted to construct the associated interference weights and output the environmental interference confidence mask. The specific process of constructing the pixel gradient structure tensor matrix at the downsampling level of the panoramic feature map of the pipe wall, and locating the set of structured pixels by calculating the ratio of principal and secondary eigenvalues ​​through eigenvalue decomposition is as follows: Extract the horizontal and vertical pixel derivative matrices of the panoramic feature map of the pipe wall at local spatial resolution, and fuse the horizontal and vertical pixel derivative matrices to construct a local neighborhood covariance matrix. The local neighborhood covariance matrix is ​​defined as the pixel gradient structure tensor matrix. Eigenvalue decomposition is performed on the pixel gradient structure tensor matrix to extract the first principal eigenvalue representing the gradient of the main direction of the local texture and the second eigenvalue representing the orthogonal gradient of the local texture. An anisotropic proportional response function is established for the first principal eigenvalue and the second eigenvalue to obtain the ratio of principal to secondary eigenvalues. Based on the output distribution of the anisotropic proportional response function, coordinate nodes that present a continuous spatial distribution are extracted, and a set of structured pixels is located and generated.

2. The pipeline defect detection method based on multi-scale attention according to claim 1, characterized in that: The specific process of acquiring the image sequence of the water supply pipeline and calculating the optical flow field displacement vector of adjacent frame pixels is as follows: Extract the spatial grayscale gradient matrix and temporal gradient matrix of pixels in adjacent frames of a water supply pipeline image sequence, and establish a constant pixel brightness constraint equation. Construct a multi-scale image pyramid, solve for the initial optical flow vector of the pixel at the top of the multi-scale image pyramid, project the initial optical flow vector down the multi-scale image pyramid layer by layer and iteratively update the pixel spatial gray-level gradient matrix, and converge to obtain the optical flow field displacement vector of the pixel in the adjacent frame.

3. The pipeline defect detection method based on multi-scale attention according to claim 1, characterized in that: The specific process of constructing a coordinate projection matrix by combining the camera's inertial pose matrix, mapping the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system, and recording the inverse coordinate transformation matrix is ​​as follows: Extract the camera rotation and translation components relative to the tube axis from the inertial pose matrix, and construct a coordinate projection matrix by combining the camera intrinsic focal length and optical center coordinates, the camera rotation components relative to the tube axis, and the translation components. The coordinate projection matrix is ​​used to project the two-dimensional coordinates of the pixels in the image sequence onto the surface of a three-dimensional cylindrical coordinate system with the tube axis as the geometric center, to obtain the three-dimensional spatial coordinates of the pixels, record the injective mapping topological relationship between the two-dimensional coordinate domain and the three-dimensional spatial coordinate domain of the pixels in the image sequence, and generate the coordinate transformation inverse matrix.

4. The pipeline defect detection method based on multi-scale attention according to claim 3, characterized in that: The specific process of generating a 2D planar canvas by unfolding along the cylinder generatrix, extracting environmental interference confidence mask interference weights corresponding to overlapping regions of multiple frames, and fusing the pixel grayscale values ​​of overlapping regions according to the inverse weight ratio mapping relationship to generate a panoramic feature map of the pipe wall is as follows: Extract the cylindrical polar angle and axial height variables from the surface of the three-dimensional cylindrical coordinate system, map the cylindrical polar angle and axial height variables to the Cartesian plane coordinate system to establish a two-dimensional plane canvas, and match the overlapping areas of the image sequence pixels in the two-dimensional plane canvas across multiple frames. Extract the environmental interference confidence mask interference weights corresponding to the overlapping regions of multiple frames, construct the interference weight attenuation function, and apply the interference weight attenuation function to perform normalized weighted fusion on the pixel gray values ​​of the image sequence at the same coordinate position in the overlapping regions of multiple frames, and output the panoramic feature map of the pipe wall.

5. The pipeline defect detection method based on multi-scale attention according to claim 4, characterized in that: The specific process of extracting activation values ​​along the multi-resolution channels, superimposing a first gain factor on activation values ​​within the structured pixel set, and superimposing a smaller second gain factor on activation values ​​outside the structured pixel set to generate a multi-scale feature response matrix is ​​as follows: The panoramic feature map of the pipe wall is input into the feature pyramid architecture. Local receptive field feature maps of multi-resolution channels are extracted along the bottom-up and top-down paths. The channel dimension activation and spatial dimension activation of the local receptive field feature maps are extracted as the activation values ​​of the multi-resolution channels. Match the spatial mapping coordinates of the structural pixel set in the multi-resolution channel, configure a first gain factor to enhance the characterization of the feature in the region where the spatial mapping coordinates coincide, and configure a smaller second gain factor in the region where the spatial mapping coordinates are different. The channel-dimensional activation and spatial-dimensional activation are nonlinearly modulated by applying the first and second gain factors, and the local receptive field feature maps after nonlinear modulation are aggregated to construct a multi-scale feature response matrix.

6. The pipeline defect detection method based on multi-scale attention according to claim 1, characterized in that: The specific process of extracting the two-dimensional pixel contour coordinates and category labels of defect activation regions from the multi-scale feature response matrix using a deep detection network is as follows: The multi-scale feature response matrix is ​​input into the multi-scale feature encoder of the deep detection network. The high-dimensional feature vector output by the multi-scale feature encoder is extracted. A spatial channel collaborative attention layer is applied to the high-dimensional feature vector to extract the local saliency heat map. The closed pixel set formed by the defect activation boundary within the local saliency heat map is extracted to generate two-dimensional pixel contour coordinates. Extract semantic feature components from the region enclosed by two-dimensional pixel contour coordinates, and input the semantic feature components into a classification perceptron to parse and map defect category labels.

7. The pipeline defect detection method based on multi-scale attention according to claim 6, characterized in that: The specific process of substituting the two-dimensional pixel contour coordinates into the inverse coordinate transformation matrix to perform three-dimensional spatial mapping and inverse solution, obtaining the three-dimensional surface boundary coordinates, constructing a spatial polygon to calculate the surface area value, and outputting the detection result containing the three-dimensional surface boundary coordinates, surface area value, and category label is as follows: Extract the edge node sequence within the two-dimensional pixel contour coordinates, input the edge node sequence into the coordinate transformation inverse matrix to perform a nonlinear geometric back projection operation, extract the three-dimensional surface boundary coordinates of the edge node sequence on the three-dimensional cylindrical surface, and construct a spatial polygon on the three-dimensional cylindrical surface according to the topological connection relationship of the edge node sequence. Perform surface integration on the spatial polygon to calculate the surface area value, aggregate the three-dimensional surface boundary coordinates, surface area value and defect category label to construct a multi-dimensional defect status description table, and output the detection results.

8. A pipeline defect detection system based on multi-scale attention, used to execute the pipeline defect detection method based on multi-scale attention as described in any one of claims 1-7, characterized in that, Includes the following modules: The interference separation module is used to acquire the image sequence of the water supply pipeline, calculate the optical flow field displacement vector of adjacent frame pixels, divide the pixels into rigid background and non-rigid interference pixels according to the displacement vector distribution, and generate an environmental interference confidence mask containing the two-dimensional coordinates of non-rigid interference pixels and associated interference weights. The panoramic reconstruction module is used to construct a coordinate projection matrix by combining the inertial pose matrix of the camera, mapping the image sequence pixels to the surface of a three-dimensional cylindrical coordinate system and recording the inverse coordinate transformation matrix; A two-dimensional planar canvas is generated by unfolding along the cylinder generatrix. The environmental interference confidence mask interference weights corresponding to the overlapping areas of multiple frames are extracted. The pixel gray values ​​of the overlapping areas are fused according to the weight inverse proportional mapping relationship to generate a panoramic feature map of the pipe wall. The feature response module is used to construct the pixel gradient structure tensor matrix of the downsampling level of the panoramic feature map of the pipe wall, and to locate the set of structural pixels by obtaining the ratio of the principal and secondary eigenvalues ​​through eigenvalue decomposition. Activation values ​​are extracted along the multi-resolution channels. A first gain factor is superimposed on the activation values ​​within the structured pixel set, and a smaller second gain factor is superimposed on the activation values ​​outside the structured pixel set to generate a multi-scale feature response matrix. The 3D inverse kinematics module is used to extract the 2D pixel contour coordinates and category labels of the defect activation region in the multi-scale feature response matrix through a deep detection network; it substitutes the 2D pixel contour coordinates into the coordinate transformation inverse matrix to perform 3D spatial mapping inverse kinematics, obtains the 3D surface boundary coordinates, constructs a spatial polygon to calculate the surface area value, and outputs the detection results containing the 3D surface boundary coordinates, surface area value, and category label.

Citation Information

Patent Citations

  • Automatic inter-image analysis of multiple building images for building floor plan generation

    CN118036116A

  • Three-dimensional reconstruction method of arbitrary point tracking network based on dynamic perception

    CN118212364A