Intelligent detection method for internal defects of pipeline based on image recognition

By using an image recognition-based intelligent detection method for internal defects in pipelines, the problems of insufficient full coverage and feature fusion in traditional detection methods are solved, enabling complete detection and accurate evaluation of the pipeline inner wall and outputting accurate defect information.

CN122391165APending Publication Date: 2026-07-14GUANGXI CONSTR VOCATIONAL & TECH COLLEGE

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGXI CONSTR VOCATIONAL & TECH COLLEGE
Filing Date
2026-04-24
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Traditional methods for detecting internal defects in pipelines cannot achieve full coverage, lack effective fusion of multi-level features, and cannot accurately focus and weight defect areas, resulting in incomplete detection results and a high susceptibility to errors.

Method used

An intelligent defect detection method for pipelines based on image recognition is adopted. The method acquires a sequence of circular scan images through an endoscope, performs image preprocessing, performs multi-level feature extraction and attention-guided network fusion to generate defect candidate regions with weighted feature representation, and combines pipeline structural information to perform defect morphology analysis and classification to generate a comprehensive defect assessment report.

Benefits of technology

It achieves continuous circumferential acquisition of the inner wall of the pipeline, fully covering all areas. The feature extraction and fusion process improves the purity and reliability of the defect area, outputs accurate defect category labels and morphological parameters, and forms an objective and comprehensive defect assessment result.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391165A_ABST
    Figure CN122391165A_ABST
Patent Text Reader

Abstract

The present application relates to pipeline nondestructive testing image recognition technical field, specifically to pipeline internal defect intelligent detection method based on image recognition, including: through endoscopic equipment gathers pipeline internal surface annular scanning image sequence, obtains the feature map set containing potential defect area through image preprocessing and multilevel feature extraction;Defect candidate region is generated by using improved attention guide network to complete feature fusion and defect candidate region focusing processing, and the weighted feature expression of the candidate region is generated;Through defect morphology analysis and classification discrimination, output defect category label and morphology parameter, and generate comprehensive defect evaluation report combined with pipeline structure information.The method is suitable for pipeline annular structure to realize global continuous acquisition, eliminate detection blind area, strengthen defect features through attention weighting, suppress redundant background interference, improve defect positioning accuracy and classification accuracy, and guarantee the integrity, accuracy and reliability of pipeline internal defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology for pipeline nondestructive testing, and in particular to an intelligent detection method for internal defects in pipelines based on image recognition. Background Technology

[0002] Traditional pipeline internal defect detection often employs single-frame endoscopic image capture, discrete image acquisition, or linear scanning. Image feature extraction and preliminary defect identification are then achieved through manual interpretation combined with conventional convolutional neural networks. This approach only performs basic feature processing on single or unordered images, using fixed thresholds to generate defect candidate regions. Conventional detection methods rely on single-frame, non-continuous images for detection, feature extraction remains at a single level, and feature fusion uses simple stitching methods.

[0003] The inner wall of a pipeline has a wide circumferential range and a ring-shaped structure. Single-frame and linear acquisition cannot cover the entire area, resulting in circumferential detection blind spots, and small and hidden defects are easily missed. Conventional networks lack a targeted attention weighting mechanism, cannot effectively integrate multi-level features, suffer from strong interference from redundant background features, have insufficient focusing accuracy on defect candidate regions, incomplete defect feature representation, and are prone to errors in morphological analysis and classification, making it difficult to form accurate and comprehensive defect assessment results.

[0004] To address the issue that the internal annular structure of pipelines cannot be fully covered by conventional image acquisition, and to address the problems of ineffective fusion of multi-level features and inability to accurately focus and weight defect areas, this method enables complete acquisition, accurate focusing, and intelligent identification of internal pipeline defects. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing an intelligent detection method for internal defects in pipelines based on image recognition.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: an intelligent detection method for internal defects in pipelines based on image recognition, comprising:

[0007] Acquire a sequence of annular scan images of the inner surface of a pipe, obtained using an endoscopic device;

[0008] The annular scan image sequence of the inner surface of the pipe is preprocessed to obtain the preprocessed image sequence;

[0009] Image feature extraction is performed on the preprocessed image sequence to obtain a multi-level feature map set containing potential defect regions;

[0010] An improved attention-guided network is used to fuse the multi-level feature map set and focus on the defect candidate region to generate a defect candidate region set containing weighted feature representations.

[0011] Perform defect morphology analysis and classification on the set of defect candidate regions, and output the defect category label and morphology parameters for each candidate region;

[0012] Based on the defect category labels and morphological parameters, combined with pipeline structure information, a comprehensive defect assessment report is generated.

[0013] As a further aspect of the present invention, the annular scan image sequence of the inner surface of the pipe is preprocessed to obtain a preprocessed image sequence, including:

[0014] The annular scan image sequence of the inner surface of the pipe is subjected to annular distortion correction processing, and the annular image is mapped into a planar unfolded image to generate a preliminary corrected image sequence.

[0015] The preliminary corrected image sequence is subjected to illumination non-uniformity compensation processing to eliminate brightness differences caused by uneven distribution of light source in the endoscopic device, thereby generating an illumination-balanced image sequence.

[0016] The illumination-equalized image sequence is subjected to image denoising and contrast enhancement processing to suppress image noise and highlight image texture details, thereby generating the preprocessed image sequence.

[0017] As a further aspect of the present invention, image feature extraction is performed on the preprocessed image sequence to obtain a multi-level feature map set containing potential defect regions, including:

[0018] The pre-trained feature extraction network is invoked to perform layer-by-layer convolution processing on single frames in the preprocessed image sequence.

[0019] At multiple different depth levels of the feature extraction network, initial feature maps with different spatial resolutions and semantic abstraction levels are output respectively.

[0020] Spatial scale alignment is performed on the initial feature maps from different levels to ensure that the feature maps of each layer have the same resolution in the spatial dimension;

[0021] The feature maps of each layer, after spatial scale alignment, are aggregated to form the multi-layer feature map set containing the potential defect region.

[0022] As a further aspect of the present invention, the step of using an improved attention-guided network to fuse the multi-level feature map set and focus on defect candidate regions to generate a set of defect candidate regions containing weighted feature representations includes:

[0023] The multi-level feature map set is input into the parallel feature processing branch of the improved attention-guided network;

[0024] Within the improved attention-guided network, the correlation between feature maps at different levels is calculated through a cross-level feature interaction module to generate an inter-level attention weight map.

[0025] Based on the inter-level attention weight map, the feature maps in the multi-level feature map set are dynamically weighted and fused to generate a fused feature map.

[0026] A spatial attention mechanism is performed on the fused feature map to generate a spatial attention heatmap, which is used to indicate regions in the image that contain defects.

[0027] Based on the regions in the spatial attention heatmap that exceed a preset threshold, corresponding feature blocks are extracted from the fused feature map, and these feature blocks constitute the set of defect candidate regions containing weighted feature expressions.

[0028] As a further aspect of the present invention, the working principle of the improved attention guidance network includes:

[0029] The improved attention-guided network includes a global context-aware subnetwork and a local detail enhancement subnetwork;

[0030] The global context-aware subnetwork receives the deepest semantic feature map in the multi-level feature map set, captures the context information of the entire image through global pooling operation, and generates a global context feature vector.

[0031] The local detail enhancement subnetwork receives shallow detail feature maps from the multi-level feature map set, and enhances local texture and edge information through a dense connection structure to generate a detail enhancement feature map;

[0032] The global context feature vector and the detail enhancement feature map are modulated, and the detail enhancement feature map is adaptively scaled on different channels using the global context feature vector to generate a modulated feature map.

[0033] The cross-level feature interaction module calculates the inter-level attention weight map based on the modulated feature map and the feature maps of other levels in the multi-level feature map set.

[0034] As a further aspect of the present invention, defect morphology analysis and classification processing are performed on the defect candidate region set, and the defect category label and morphological parameters of each candidate region are output, including:

[0035] For each defect candidate region in the defect candidate region set that contains a weighted feature representation, perform region feature decoding and reconstruct it into a standardized feature tensor of fixed size;

[0036] The standardized feature tensor is input into a pre-trained defect classification network, and the defect classification network outputs a preliminary probability distribution of defect categories.

[0037] Simultaneously, the standardized feature tensor is input into the morphological parameter regression network, which outputs multiple parameter values ​​representing the geometric shape of the defect. These multiple parameter values ​​include approximate length, approximate width, estimated depth, and estimated area of ​​the defect.

[0038] The defect category probability distribution and the multiple parameter values ​​are jointly processed, including threshold judgment of the category probability and rationality verification of the parameter values, and finally the defect category label and morphological parameters are determined and output.

[0039] As a further aspect of the present invention, the standardized feature tensor is input into a pre-trained defect classification network, and the defect classification network outputs a preliminary defect category probability distribution, including:

[0040] The pre-trained defect classification network contains multiple cascaded residual blocks for performing deep feature transformation on the input standardized feature tensor.

[0041] At the end of the pre-trained defect classification network, a fully connected layer is connected to a Softmax activation function to map the features after deep feature transformation to probability values ​​belonging to each predefined defect category.

[0042] The probability values ​​belonging to each predefined defect category are normalized and arranged to form the preliminary defect category probability distribution.

[0043] As a further aspect of the present invention, the defect category probability distribution and the plurality of parameter values ​​are jointly post-processed, including:

[0044] Set a defect category determination threshold, and take the category corresponding to the maximum probability value in the defect category probability distribution as a candidate category. When the maximum probability value is greater than the defect category determination threshold, the candidate category is confirmed as the final category; otherwise, it is marked as an unknown category.

[0045] The range of the multiple parameter values ​​output by the morphological parameter regression network is checked to see if each parameter value is within its corresponding preset reasonable physical range. Values ​​that exceed the preset reasonable physical range are clipped to the boundary value of the preset reasonable physical range.

[0046] The confirmed final category or the marked unknown category is combined with the parameter value after range verification to form the defect category label and morphological parameter.

[0047] As a further aspect of the present invention, a comprehensive defect assessment report is generated based on the defect category label and morphological parameters, combined with pipeline structure information, including:

[0048] Construct a report generation template, which includes fields for defect location, defect category, morphological parameters, and risk assessment related to the pipeline structure;

[0049] Fill the corresponding fields of the report generation template with the defect category labels and morphological parameters;

[0050] The pipeline structure information is obtained from an external database or input, and the pipeline structure information includes pipeline material, design pressure, and service life.

[0051] Based on the pipe material, design pressure, and service life in the pipe structure information, and combined with the defect category label and morphological parameters, the risk level description text associated with the defect category label and morphological parameters is determined through a preset rule mapping table.

[0052] Fill the risk level description text into the risk assessment field of the report generation template to complete the generation of the comprehensive defect assessment report.

[0053] As a further aspect of the present invention, based on the pipe material, design pressure, and service life in the pipe structure information, and combined with the defect category label and morphological parameters, a risk level description text associated with the defect category label and morphological parameters is determined through a preset rule mapping table, including:

[0054] Use the defect category label as the main query key to find the corresponding basic risk level in the preset rule mapping table;

[0055] Using the depth and area estimates in the morphological parameters as adjustment factors, and combining the pipe material and design pressure in the pipe structure information, the risk level adjustment coefficient is found in the preset rule mapping table.

[0056] The basic risk level is superimposed with the risk level adjustment coefficient to obtain a preliminary risk level value;

[0057] Based on the service life in the pipeline structure information, the service life influence factor is found in the preset rule mapping table, and the preliminary risk level value is corrected to obtain the final risk level value.

[0058] The final risk level value is mapped to a risk level with a text description, which is then used as the risk level description text.

[0059] Compared with the prior art, the advantages and positive effects of the present invention are as follows:

[0060] A sequence of annular scanning images of the pipe's internal surface is employed, adapted to the pipe's annular structure, enabling continuous circumferential acquisition. The image sequence possesses spatial continuity and structural correlation, completely covering all areas of the pipe's inner wall and eliminating coverage blind spots present in single-frame, discrete, and linear acquisition methods. Continuous images can fully preserve the spatial distribution characteristics of minute and hidden defects on the inner wall. Preprocessing performs uniform noise suppression, contrast optimization, and geometric correction on the sequence images, ensuring consistent image quality. Multi-level feature extraction leverages continuous spatial information to achieve multi-scale feature mining. Texture and contour features of potential defect areas can be fully extracted without feature loss due to acquisition limitations. This ensures that the feature map set contains complete feature information of the entire inner wall, providing a structurally matched and informationally complete data foundation for subsequent feature processing.

[0061] The improved attention-guided network can perform weighted fusion of multi-level feature map sets, assigning differentiated weights to features at different levels, strengthening the feature response of defect regions, and weakening redundant background features and irrelevant interference information. The feature fusion process achieves deep integration of features at different scales, improving the relevance and completeness of feature representation. Defect candidate region focusing processing can accurately locate the defect region, generate a set of defect candidate regions with weighted feature representation, eliminate invalid background interference regions, and improve the purity and reliability of candidate regions. Weighted features can clearly present the morphology, contour, and texture attributes of defects. Defect morphology analysis and classification can be directly completed based on accurate features, accurately outputting defect category labels and morphological parameters. Combined with pipeline structure information, it can fully reflect the actual state of defects, forming objective and comprehensive defect assessment results. Attached Figure Description

[0062] Figure 1 This is a state diagram of the intelligent detection method for internal defects in pipelines based on image recognition as described in this invention.

[0063] Figure 2 A flowchart for image feature extraction from a preprocessed image sequence;

[0064] Figure 3 A flowchart for improved attention-guided network processing. Detailed Implementation

[0065] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0066] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0067] See Figure 1 This invention provides an intelligent detection method for internal defects in pipelines based on image recognition. The specific method includes:

[0068] An endoscopic device is moved axially along the pipe and scans around its inner wall to obtain a sequence of annular scan images of the pipe's internal surface. This sequence is then preprocessed to remove geometric distortions caused by the relative motion between the device and the pipe, as well as lighting interference and noise from environmental factors, resulting in a clear preprocessed image sequence. A pre-constructed feature extraction network is used to perform multi-level convolution operations on each frame of the preprocessed image sequence, capturing image information at different scales and semantic levels, and outputting a multi-level feature map set containing potential defect areas. This multi-level feature map set is then fed into an improved attention-guided network, which uses cross-level interaction and spatial attention mechanisms to... Features from different sources are dynamically weighted and fused to highlight defect-related features, thereby generating a set of defect candidate regions containing weighted feature expressions. For each defect candidate region, defect morphology analysis and classification are performed separately. A dedicated network branch infers the probability of the defect type and regresses its geometric morphological parameters, finally outputting a discrimination result with defect category labels and morphological parameters such as length, width, depth, and area. Based on the above discrimination results and combined with external structural information such as pipeline material, design pressure, and service life, the system maps the risk level of the defect according to preset risk assessment rules and automatically generates a comprehensive defect assessment report containing defect location, attributes, geometric dimensions, and risk assessment conclusions.

[0069] In one embodiment of the present invention, the sequence undergoes annular distortion correction processing to establish a mapping relationship between the pixels of the annular image and the pixels of the unfolded planar image, unfolding the annular curved surface into a rectangular planar view to generate a preliminary corrected image sequence. Illumination non-uniformity compensation processing is then performed on the preliminary corrected image sequence, employing a grayscale equalization algorithm based on image statistical characteristics to eliminate bright and dark stripes caused by uneven circumferential light source arrangement of the endoscopic device, generating an illuminated equalized image sequence. Finally, image denoising and contrast enhancement processing is performed on the illuminated equalized image sequence, using a nonlocal mean denoising algorithm to suppress random noise and combining histogram stretching to enhance local texture contrast, highlighting edge details of cracks and corrosion areas, generating a preprocessed image sequence. (See also...) Figure 2 The pre-trained feature extraction network is invoked. This network adopts a deep convolutional neural network architecture to perform layer-by-layer convolution processing on single frames in the preprocessed image sequence, abstracting image features level by level. At multiple different depth levels of the feature extraction network, high-resolution shallow detail feature maps and low-resolution high-level semantic feature maps are output respectively, forming an initial feature map set. Spatial scale alignment processing is performed on the initial feature maps from different levels. Bilinear interpolation upsampling operation is used to unify the spatial size of the high-level feature maps to a resolution that matches the shallow feature maps. The feature maps of each layer after spatial scale alignment processing are stitched together according to the channel dimension to form a multi-level feature map set containing potential defect regions.

[0070] In practical implementation, annular distortion correction processing is performed on the annular scan image sequence of the pipe's internal surface. A mapping relationship is established between the pixel coordinates of the annular image and the pixel coordinates of the unfolded planar image, unfolding the annular curved surface into a rectangular planar view. Specifically, the annular distortion correction processing uses a polar coordinate to Cartesian coordinate transformation, setting the center point of the annular image as the pole and the annular scan radius as the reference distance, and transforming the pixel coordinates on the annular image... Mapping to planar unfolded image coordinates This generates a preliminary corrected image sequence. In a specific implementation, the radial distance between pixels in the annular image is... With angle Unfold the image on a plane to determine the x and y coordinates. and The transformation relationship satisfies the following formula:

[0071]

[0072] in: The average radius parameter of the circular scan. The inner diameter offset constant of the annular image. Represents the ring image. The distance of each pixel on the radius line from the center point Represents the ring image. The radian value of each angle. The horizontal coordinates of the unfolded image are given. The coordinates are the vertical coordinates of the unfolded image.

[0073] In some embodiments, illumination non-uniformity compensation processing is performed on the initially corrected image sequence. A gray-level equalization algorithm based on the statistical characteristics of image blocks is used to divide the image into several annular sectors. The deviation ratio between the mean pixel intensity of each sector and the overall mean is calculated to generate a compensation coefficient matrix. This compensation coefficient matrix is ​​then used to adjust the original pixel values, eliminating bright and dark stripes caused by uneven circumferential light source arrangement of the endoscopic device, thus generating an illumination-equalized image sequence. Optionally, the illumination non-uniformity compensation processing can employ a method combining homomorphic filtering and Gaussian smoothing to separate the incident light component and the reflected light component, attenuating the low-frequency incident light component while preserving high-frequency reflection details, making the overall brightness of the image more uniform.

[0074] It is understandable that image denoising and contrast enhancement are performed on the illumination-equalized image sequence. The non-local mean denoising algorithm is used to suppress random noise. The algorithm performs weighted averaging by searching for neighborhood windows of similar pixels in the image, reducing noise while preserving texture structure. Combined with the contrast-limited adaptive histogram equalization method to enhance local texture contrast, the image is divided into several sub-regions. Histogram equalization is performed in each sub-region and the gain amplitude is limited to prevent excessive amplification of background noise and highlight the edge details of cracks and corrosion areas, generating a pre-processed image sequence.

[0075] In some embodiments, a pre-trained feature extraction network is invoked. This pre-trained feature extraction network employs a deep convolutional neural network architecture, comprising five stacked downsampling convolutional layers and activation layers. It performs layer-by-layer convolutional processing on single frames in the preprocessed image sequence, progressively abstracting low-level edge features, mid-level texture features, and high-level semantic features. At multiple different depth levels of the feature extraction network, initial feature maps with different spatial resolutions and semantic abstraction levels are output. For example, the shallow feature map output in the first stage has a resolution equal to that of the original image. Preserving fine edge details, the deep feature map output in the fifth stage has a resolution equal to that of the original image. They carry highly abstract semantic information and form the initial feature map set.

[0076] Optionally, spatial scale alignment is performed on the initial feature maps from different levels. Bilinear interpolation upsampling is used to unify the spatial dimensions of high-level feature maps to a resolution matching that of shallower feature maps; that is, low-resolution feature maps are... times, times or The scale is magnified by a factor of 1 to ensure its dimensions match those of the highest resolution layer feature map. In practice, the size of the first-level shallow feature map is [size missing]. pixels, the size of the fifth-level deep feature map is Pixels, for the fifth-level feature map Double bilinear upsampling, to obtain The aligned feature map of pixels, the size of the third-level feature map is Pixels, for the third-level feature map Double bilinear upsampling yields the same result. Aligned feature maps of pixels. The feature maps of each layer after spatial scale alignment are stitched together along the channel dimension to form a multi-level feature map set containing potential defect regions.

[0077] In one embodiment of the present invention, see [reference] Figure 3 The multi-level feature map set is input into the parallel feature processing branch of the improved attention-guided network. This network has two independent branches to process deep semantics and shallow detail features respectively. Within the improved attention-guided network, the channel correlation coefficient between feature maps of different levels is calculated through a cross-level feature interaction module to generate an inter-level attention weight map reflecting the importance between levels. Based on the inter-level attention weight map, the feature maps of each level in the multi-level feature map set are summed element-wise to achieve dynamic weighted fusion and generate a fused feature map. A spatial attention mechanism is executed on the fused feature map, using convolutional layers to generate a two-dimensional spatial attention heatmap. The high-response regions of the heatmap correspond to the locations of suspected defects in the image. According to the coordinate range above a preset threshold in the spatial attention heatmap, the corresponding rectangular feature blocks are cropped on the fused feature map. All cropped feature blocks constitute a set of defect candidate regions containing weighted feature expressions. The improved attention-guided network comprises a global context-aware subnetwork and a local detail enhancement subnetwork. The global context-aware subnetwork receives the deepest semantic feature map from the multi-level feature map set and compresses the spatial dimension through global average pooling to capture the global context feature vector of the entire image. The local detail enhancement subnetwork receives shallow detail feature maps from the multi-level feature map set and enhances the transmission of local texture and edge information through dense connection structures, outputting a detail enhancement feature map. After the global context feature vector is processed by linear transformation and activation function, each channel of the detail enhancement feature map is adaptively scaled to achieve feature modulation and generate a modulated feature map. The cross-level feature interaction module uses the modulated feature map as a basis and combines it with feature maps from other levels in the multi-level feature map set to calculate the mutual information between levels, thereby deriving the inter-level attention weight map.

[0078] In the implementation, a multi-layered feature map set containing potential defect regions is input into the parallel feature processing branch of the improved attention-guided network. This branch contains two independent convolutional paths: one receives and transmits deep semantic features, and the other processes shallow, high-resolution feature maps. Within the improved attention-guided network, a cross-layer feature interaction module calculates the correlation between feature maps of different layers. This module uses channel-wise dot product operations to measure the statistical dependence of any two feature maps along the channel dimension, generating an inter-layer attention weight map that reflects the importance of features between layers. The generation process of the inter-layer attention weight map follows the following formula:

[0079]

[0080] in: Indicates the first The first layer of feature map Feature matrices of each channel Indicates the first The first layer of feature map Feature matrices of each channel This represents element-wise multiplication. This represents summing over all channels. This represents the Sigmoid activation function. That is, the desired first... layer relative to the first Attention weights between layers.

[0081] In some embodiments, based on the inter-layer attention weight map, the feature maps in the multi-layer feature map set are dynamically weighted and fused. Feature maps from different layers are multiplied by their corresponding inter-layer attention weight maps and then summed element-wise to generate a fused feature map. Optionally, the dynamic weighted fusion process can adopt a weighted-then-sum approach, that is, each layer's feature map is first multiplied by its corresponding inter-layer attention weight map, and then all weighted feature maps are summed positionally to obtain a unified fused feature map.

[0082] It is understandable that a spatial attention mechanism is executed on the fused feature map. The spatial attention mechanism consists of a single layer. The system consists of convolutional layers followed by a sigmoid activation function. These convolutional layers reduce the number of channels in the fused feature map to one dimension, generating a two-dimensional spatial attention heatmap. Regions with higher values ​​in the spatial attention heatmap indicate potential defect locations in the image. Based on regions in the spatial attention heatmap that exceed a preset threshold, corresponding rectangular feature blocks are extracted from the fused feature map. The preset threshold is set to the global maximum value of the spatial attention heatmap. The size of the extracted feature block is fixed at times [number] times. Each pixel, and all the truncated feature blocks, constitute a set of defect candidate regions containing weighted feature representations.

[0083] In some embodiments, the improved attention-guided network includes a global context-aware subnetwork and a local detail enhancement subnetwork. The global context-aware subnetwork receives the deepest semantic feature map from a multi-level feature map set, and the size of the semantic feature map is [size missing]. The spatial dimension is compressed to a certain value through global average pooling. This captures the global contextual feature vector of the entire image. The local detail enhancement subnetwork receives shallow detail feature maps from a multi-level feature map set, with the detail feature map size being [size missing]. By connecting multiple convolutional layers through a dense connection structure, the flow of local texture and edge information is enhanced, generating detail-enhanced feature maps.

[0084] Optionally, the global context feature vector and the detail enhancement feature map are modulated. The global context feature vector is expanded to the same number of channels as the detail enhancement feature map through a fully connected layer, and then copied to the same spatial size as the detail enhancement feature map through a broadcast mechanism. The expanded global context feature vector is used to adaptively scale the detail enhancement feature map channel by channel to generate the modulated feature map. The cross-level feature interaction module recalculates the inter-level attention weight map based on the modulated feature map and feature maps from other levels in the multi-level feature map set. The modulated feature map is used as the baseline feature in the weight calculation.

[0085] In one embodiment of the present invention, each defect candidate region containing a weighted feature expression in the defect candidate region set is processed by a region feature decoding module. Feature blocks of different sizes are reconstructed into a standardized feature tensor of fixed size through fully connected layers or transposed convolution operations. This standardized feature tensor is input into a pre-trained defect classification network. The network extracts highly discriminative classification features through multi-layer nonlinear transformations, outputting a preliminary defect category probability distribution covering various predefined defect types. Simultaneously, the same standardized feature tensor is input into a morphological parameter regression network. This regression network directly predicts continuous values ​​representing the geometric shape of the defect through fully connected layers, outputting multiple parameter values ​​including approximate defect length, approximate width, estimated depth, and estimated area. The defect category probability distribution and multiple parameter values ​​are jointly post-processed. On the one hand, valid categories are selected based on probability thresholds; on the other hand, the physical validity of the parameter values ​​is verified. Finally, the defect category label and morphological parameters are determined and output.

[0086] In practical implementation, for each defect candidate region containing weighted feature representations in the defect candidate region set, region feature decoding processing is performed. The region feature decoding module uses a combination of two fully connected layers and one reshaping layer to map the feature blocks of defect candidate regions with different spatial sizes into vectors of a uniform dimension, and then reconstruct them into a standardized feature tensor of a fixed size. In practical implementation, the fixed size of the standardized feature tensor is set to... ,in Indicates batch size, The feature dimension is represented, and the reconstruction process satisfies the following relationship:

[0087]

[0088] in: This represents the vector obtained by flattening the input region feature block. and These are the weight matrices for the two fully connected layers. and For bias vector, Represents the ReLU activation function. This indicates that the output vector of the fully connected layer will be reshaped as... tensor, This is the obtained standardized feature tensor.

[0089] In some embodiments, a standardized feature tensor is input into a pre-trained defect classification network. The pre-trained network consists of four fully connected layers alternating with Dropout layers, with a Dropout ratio of 0.3. The network performs nonlinear transformation and feature compression on the input standardized feature tensor, outputting a preliminary defect category probability distribution covering four categories: cracks, corrosion, pores, and sediments. Optionally, a batch normalization layer can be introduced before the fully connected layers in the pre-trained defect classification network to accelerate training convergence and stabilize the probability distribution output.

[0090] It is understandable that the same standardized feature tensor is input into the morphological parameter regression network. The morphological parameter regression network contains three fully connected layers, and the last layer outputs four consecutive real values, which respectively represent the approximate length, approximate width, estimated depth, and estimated area of ​​the defect. The approximate length and approximate width are in pixels, the estimated depth is a proportion relative to the pipe wall thickness, and the estimated area is a proportion of the area of ​​the candidate region.

[0091] In some embodiments, the defect category probability distribution and multiple parameter values ​​output by the morphological parameter regression network are jointly post-processed. The joint post-processing is divided into two parts: category determination and parameter verification. The category determination threshold is set to 0.75. The category corresponding to the highest probability in the preliminary defect category probability distribution is selected as the candidate category. When the highest probability value is greater than 0.75, the candidate category is confirmed as the final category. Otherwise, it is marked as an unknown category. Referring to Table 1, the parameter verification compares each parameter value with the preset reasonable physical range listed. Values ​​that exceed the range are cropped to the boundary value.

[0092] Table 1: Comparison Table of Reasonable Physical Ranges for Preset Morphological Parameters

[0093] Parameter name unit lower boundary value upper boundary value approximate length Pixels 5 300 approximate width Pixels 2 100 Depth estimate relative wall thickness ratio 0.05 0.80 Area estimate Regional proportion 0.01 0.90

[0094] Optionally, the parameter verification process employs a parameter-by-parameter iterative comparison method, sequentially checking whether the approximate length, approximate width, estimated depth, and estimated area fall within the corresponding intervals in Table 1. If the value is below the lower boundary, it is assigned the lower boundary value; if it is above the upper boundary, it is assigned the upper boundary value. The confirmed final category or the marked unknown category is combined with the approximate length, approximate width, estimated depth, and estimated area after range verification to form a complete defect category label and morphological parameter output.

[0095] In one embodiment of the present invention, the pre-trained defect classification network includes multiple cascaded residual blocks. Each residual block consists of several convolutional layers, batch normalization layers, and skip connections, which perform deep nonlinear feature transformation on the input standardized feature tensor. At the end of the pre-trained defect classification network, a flattening layer and a fully connected layer are connected, and then the high-dimensional feature vector after deep feature transformation is converted into probability values ​​through the Softmax activation function to calculate the probability that the input sample belongs to each predefined defect category. The probability values ​​of all categories are normalized and arranged so that the sum of the probabilities is one, forming a preliminary defect category probability distribution. Set a defect category determination threshold, select the category with the largest value in the preliminary defect category probability distribution as the candidate category. If the maximum value exceeds the determination threshold, it is determined to be this category; otherwise, the candidate region is marked as an unknown category. Perform range verification on the length approximation, width approximation, depth estimate, and area estimate output by the morphological parameter regression network one by one, compare them with the preset reasonable physical upper and lower limits, adjust the parameters below the lower limit to the lower limit value, and adjust the parameters above the upper limit to the upper limit value. Bind the confirmed defect category label or unknown category mark with the morphological parameter combination after range verification to form the final output result.

[0096] In practice, the pre-trained defect classification network contains multiple cascaded residual blocks. Each residual block consists of three convolutional layers, one batch normalization layer, and a skip connection structure. The kernel size of the convolutional layers is [missing information]. With a stride of 1 and padding of 1, the batch normalization layer standardizes the convolutional output to zero mean and unit variance. The skip connections element-wise add the input of the residual block to the output after three convolutional layers and batch normalization, performing a depth feature transformation on the standardized feature tensor of the input. In the specific implementation, the number of residual blocks is set to four, and the number of intermediate channels in each residual block is twice the number of input channels. The forward propagation process satisfies the following relationship:

[0097]

[0098] in: Indicates the first The output feature tensor of each residual block Indicates the first The composite transformation of three convolutional layers, batch normalization, and ReLU activation function within each residual block. Indicates the first The output feature tensor of each residual block.

[0099] In some embodiments, at the end of the pre-trained defect classification network, a global average pooling layer is connected to compress the three-dimensional feature tensor into a one-dimensional feature vector. This is followed by two fully connected layers: the first fully connected layer has an output dimension of 256, and the second fully connected layer has an output dimension equal to the number of predefined defect categories. Finally, a softmax activation function is used to transform the feature vector, after deep feature transformation, into probability values ​​belonging to each predefined defect category. Optionally, the global average pooling layer reduces the spatial dimension of the feature tensor. Perform average polymerization, with a size of Feature maps compressed to a length of The vector is used to reduce the risk of overfitting. The probability values ​​belonging to each predefined defect category are normalized and arranged so that the sum of the probability values ​​of all categories is 1, forming a preliminary defect category probability distribution.

[0100] It is understandable that a defect category determination threshold is set, the value of which is derived from the stability test during the engineering verification phase. Specific values ​​are shown in the table below. The category corresponding to the highest probability value in the initial defect category probability distribution is used as a candidate category. When the highest probability value is greater than the defect category determination threshold, the candidate category is confirmed as the final category; otherwise, it is marked as an unknown category. Range verification is performed on the approximate length, width, depth, and area estimates output by the morphological parameter regression network. Each parameter value is checked to see if it falls within its corresponding preset reasonable physical range. Values ​​exceeding the preset reasonable physical range are clipped to the boundary values ​​of the preset reasonable physical range, as shown in Table 2.

[0101] Table 2: Defect Judgment Threshold and Reasonable Range of Morphological Parameters

[0102] Project Name Value / Range Remark Defect category determination threshold 0.70 Used for final category confirmation Reasonable range of approximate length [5px, 300px] px represents the pixel unit Reasonable range of approximate width [2px, 150px] px represents the pixel unit Reasonable range of depth estimates [0.02,0.60] relative wall thickness ratio Reasonable range of area estimates [0.005,0.85] Proportion of candidate area

[0103] In some embodiments, the range verification adopts a parameter-by-parameter comparison method, comparing the original length approximation output by the morphological parameter regression network with the reasonable range of length approximations in the table. If the original length approximation is less than 5 pixels, it is set to 5 pixels; if it is greater than 300 pixels, it is set to 300 pixels. If the original width approximation is less than 2 pixels, it is set to 2 pixels; if it is greater than 150 pixels, it is set to 150 pixels. If the original depth estimate is less than 0.02, it is set to 0.02; if it is greater than 0.60, it is set to 0.60. If the original area estimate is less than 0.005, it is set to 0.005; if it is greater than 0.85, it is set to 0.85. Optionally, the clipping operation is implemented using a combination of mathematical minimum and maximum value functions to ensure that the parameter values ​​strictly fall within the closed interval range. The confirmed final category or the labeled unknown category is combined with the length approximation, width approximation, depth estimate, and area estimate after range verification to form the final output of defect category label and morphological parameters.

[0104] In one embodiment of the present invention, a structured report generation template is constructed. The template defines fixed data fields, including fields for the longitudinal and circumferential location of defects within the pipeline, a defect category name field, numerical morphological parameter fields for length, width, depth, and area, and a qualitative risk assessment field associated with the pipeline structure. The determined defect category labels and verified morphological parameters are filled into the corresponding fields of the report template. Structural information of the target pipeline is retrieved from an external engineering database, including the pipeline base material type, rated design pressure value, and cumulative service life data. Based on the pipeline material, design pressure, and service life, and in conjunction with the defect category labels and morphological parameters, the report is generated. The system uses state parameters and a pre-defined rule mapping table to retrieve the basic risk level score by looking up the defect category as the primary key. It then uses the estimated depth and area values ​​from the morphological parameters as the basis for quantitative adjustment, and combines material strength and design pressure to obtain the risk level adjustment coefficient. The basic risk level and the adjustment coefficient are added together to obtain the preliminary risk level value. Finally, the system introduces the influence factor of service life to weight and correct the preliminary risk level value, resulting in the final risk level value. This value is then mapped to text descriptions such as "low risk," "medium risk," and "high risk," and entered into the risk assessment field of the report template to complete the generation of the comprehensive defect assessment report.

[0105] In the specific implementation, a report generation template is constructed. The report generation template adopts a JSON structured data format, including a defect location field, a defect category field, a morphological parameter field, and a risk assessment field associated with the pipeline structure. The defect location field records the mileage station and circumferential angle of the defect in the pipeline. The defect category field stores the defect type name in string form. The morphological parameter field is an array type storing approximate length, approximate width, estimated depth, and estimated area. The risk assessment field is reserved as a text-type risk level description. The determined defect category label and the morphological parameters after range validation are written into the corresponding fields of the report generation template. For example, "circumferential crack" is filled into the defect category field, and [45,2,0.12,180] is filled into the morphological parameter field, corresponding to a length of 45 pixels, a width of 2 pixels, a depth ratio of 0.12, and an area of ​​180 square pixels, respectively. Pipeline structure information is obtained from an external pipeline management database or system input interface. The pipeline structure information includes pipeline material code, design pressure value, and service life integer. The pipeline material code "X65" represents high-strength pipeline steel, the design pressure value is 6.3 MPa, and the service life is 15 years. This information is stored in the additional structural parameter area of ​​the template.

[0106] In some embodiments, based on the pipeline material, design pressure, and service life in the pipeline structure information, combined with defect category labels and morphological parameters, a preset rule mapping table is queried. The preset rule mapping table is a hash table structure, with the defect category label as the primary key indexing the basic risk level score. Using the estimated depth and area values ​​from the morphological parameters as adjustment factors, and combining them with the ratio of the pipeline material yield strength to the design pressure in the pipeline structure information, a risk level adjustment coefficient is matched in the preset rule mapping table. The basic risk level and the risk level adjustment coefficient are then algebraically superimposed to obtain a preliminary risk level value. The calculation process satisfies the following formula:

[0107]

[0108] in: The basic risk level score is obtained from the rule mapping table. This is a depth estimate. This is an estimated area value. This is the depth adjustment factor. The area adjustment factor is obtained from the material and pressure ratio index rule mapping table. This is the preliminary risk level value obtained from the calculation.

[0109] Understandably, based on the service life in the pipeline structure information, the service life influence factor is looked up in a preset rule mapping table. The service life influence factor is a piecewise step function, increasing by 0.1 for every 5 years of service life. The initial risk level value is multiplied by the service life influence factor for correction, resulting in the final risk level value. The final risk level value is then mapped to a risk level with text descriptions. The rule mapping table defines the value range [0,3) as low risk, [3,6) as medium risk, and [6,∞) as high risk, with corresponding texts such as "Low risk: Planned maintenance," "Medium risk: Recommended for immediate investigation," and "High risk: Immediate shutdown assessment." Optionally, the risk level adjustment coefficient query uses a dual indexing strategy: first, grouping by defect category, then locating cells by material-pressure combination to retrieve the corresponding floating-point coefficient. The mapped risk level description text is written into the risk assessment field of the report generation template, completing the generation of the comprehensive defect assessment report. The report file can be exported as PDF or XML format for archiving and transmission.

[0110] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. An intelligent detection method for internal defects in pipelines based on image recognition, characterized in that, The method includes: Acquire a sequence of annular scan images of the inner surface of a pipe, obtained using an endoscopic device; The annular scan image sequence of the inner surface of the pipe is preprocessed to obtain the preprocessed image sequence; Image feature extraction is performed on the preprocessed image sequence to obtain a multi-level feature map set containing potential defect regions; An improved attention-guided network is used to fuse the multi-level feature map set and focus on the defect candidate region to generate a defect candidate region set containing weighted feature representations. Perform defect morphology analysis and classification on the set of defect candidate regions, and output the defect category label and morphology parameters for each candidate region; Based on the defect category labels and morphological parameters, combined with pipeline structure information, a comprehensive defect assessment report is generated.

2. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 1, characterized in that, The annular scan image sequence of the inner surface of the pipe is preprocessed to obtain a preprocessed image sequence, including: The annular scan image sequence of the inner surface of the pipe is subjected to annular distortion correction processing, and the annular image is mapped into a planar unfolded image to generate a preliminary corrected image sequence. The preliminary corrected image sequence is subjected to illumination non-uniformity compensation processing to eliminate brightness differences caused by uneven distribution of light source in the endoscopic device, thereby generating an illumination-balanced image sequence. The illumination-equalized image sequence is subjected to image denoising and contrast enhancement processing to suppress image noise and highlight image texture details, thereby generating the preprocessed image sequence.

3. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 1, characterized in that, Image feature extraction is performed on the preprocessed image sequence to obtain a multi-level feature map set containing potential defect regions, including: The pre-trained feature extraction network is invoked to perform layer-by-layer convolution processing on single frames in the preprocessed image sequence. At multiple different depth levels of the feature extraction network, initial feature maps with different spatial resolutions and semantic abstraction levels are output respectively. Spatial scale alignment is performed on the initial feature maps from different levels to ensure that the feature maps of each layer have the same resolution in the spatial dimension; The feature maps of each layer, after spatial scale alignment, are aggregated to form the multi-layer feature map set containing the potential defect region.

4. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 1, characterized in that, The improved attention-guided network is used to fuse the multi-level feature map set and focus on defect candidate regions, generating a set of defect candidate regions containing weighted feature representations, including: The multi-level feature map set is input into the parallel feature processing branch of the improved attention-guided network; Within the improved attention-guided network, the correlation between feature maps at different levels is calculated through a cross-level feature interaction module to generate an inter-level attention weight map. Based on the inter-level attention weight map, the feature maps in the multi-level feature map set are dynamically weighted and fused to generate a fused feature map. A spatial attention mechanism is performed on the fused feature map to generate a spatial attention heatmap, which is used to indicate regions in the image that contain defects. Based on the regions in the spatial attention heatmap that exceed a preset threshold, corresponding feature blocks are extracted from the fused feature map, and these feature blocks constitute the set of defect candidate regions containing weighted feature expressions.

5. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 4, characterized in that, The improved attention-guided network works by: The improved attention-guided network includes a global context-aware subnetwork and a local detail enhancement subnetwork; The global context-aware subnetwork receives the deepest semantic feature map in the multi-level feature map set, captures the context information of the entire image through global pooling operation, and generates a global context feature vector. The local detail enhancement subnetwork receives shallow detail feature maps from the multi-level feature map set, and enhances local texture and edge information through a dense connection structure to generate a detail enhancement feature map; The global context feature vector and the detail enhancement feature map are modulated, and the detail enhancement feature map is adaptively scaled on different channels using the global context feature vector to generate a modulated feature map. The cross-level feature interaction module calculates the inter-level attention weight map based on the modulated feature map and the feature maps of other levels in the multi-level feature map set.

6. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 1, characterized in that, The defect candidate region set is subjected to defect morphology analysis and classification processing, and the defect category label and morphological parameters of each candidate region are output, including: For each defect candidate region in the defect candidate region set that contains a weighted feature representation, perform region feature decoding and reconstruct it into a standardized feature tensor of fixed size; The standardized feature tensor is input into a pre-trained defect classification network, and the defect classification network outputs a preliminary probability distribution of defect categories. Simultaneously, the standardized feature tensor is input into the morphological parameter regression network, which outputs multiple parameter values ​​representing the geometric shape of the defect. These multiple parameter values ​​include approximate length, approximate width, estimated depth, and estimated area of ​​the defect. The defect category probability distribution and the multiple parameter values ​​are jointly processed, including threshold judgment of the category probability and rationality verification of the parameter values, and finally the defect category label and morphological parameters are determined and output.

7. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 6, characterized in that, The standardized feature tensor is input into a pre-trained defect classification network, which outputs a preliminary defect category probability distribution, including: The pre-trained defect classification network contains multiple cascaded residual blocks for performing deep feature transformation on the input standardized feature tensor. At the end of the pre-trained defect classification network, a fully connected layer is connected to a Softmax activation function to map the features after deep feature transformation to probability values ​​belonging to each predefined defect category. The probability values ​​belonging to each predefined defect category are normalized and arranged to form the preliminary defect category probability distribution.

8. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 6, characterized in that, Joint post-processing of the defect category probability distribution and the multiple parameter values ​​includes: Set a defect category determination threshold, and take the category corresponding to the maximum probability value in the defect category probability distribution as a candidate category. When the maximum probability value is greater than the defect category determination threshold, the candidate category is confirmed as the final category; otherwise, it is marked as an unknown category. The range of the multiple parameter values ​​output by the morphological parameter regression network is checked to see if each parameter value is within its corresponding preset reasonable physical range. Values ​​that exceed the preset reasonable physical range are clipped to the boundary value of the preset reasonable physical range. The confirmed final category or the marked unknown category is combined with the parameter value after range verification to form the defect category label and morphological parameter.

9. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 1, characterized in that, Based on the defect category labels and morphological parameters, combined with pipeline structure information, a comprehensive defect assessment report is generated, including: Construct a report generation template, which includes fields for defect location, defect category, morphological parameters, and risk assessment related to the pipeline structure; Fill the corresponding fields of the report generation template with the defect category labels and morphological parameters; The pipeline structure information is obtained from an external database or input, and the pipeline structure information includes pipeline material, design pressure, and service life. Based on the pipe material, design pressure, and service life in the pipe structure information, and combined with the defect category label and morphological parameters, the risk level description text associated with the defect category label and morphological parameters is determined through a preset rule mapping table. Fill the risk level description text into the risk assessment field of the report generation template to complete the generation of the comprehensive defect assessment report.

10. The intelligent detection method for internal defects in pipelines based on image recognition according to claim 9, characterized in that, Based on the pipe material, design pressure, and service life in the pipe structure information, and combined with the defect category labels and morphological parameters, a risk level description text associated with the defect category labels and morphological parameters is determined through a preset rule mapping table, including: Use the defect category label as the main query key to find the corresponding basic risk level in the preset rule mapping table; Using the depth and area estimates in the morphological parameters as adjustment factors, and combining the pipe material and design pressure in the pipe structure information, the risk level adjustment coefficient is found in the preset rule mapping table. The basic risk level is superimposed with the risk level adjustment coefficient to obtain a preliminary risk level value; Based on the service life in the pipeline structure information, the service life influence factor is found in the preset rule mapping table, and the preliminary risk level value is corrected to obtain the final risk level value. The final risk level value is mapped to a risk level with a text description, which is then used as the risk level description text.