Automatic detection and repair method in pipeline installation
By constructing a welding defect detection network and using pipeline repair robots, the problems of low accuracy and efficiency in pipeline welding inspection have been solved, achieving high-precision automated inspection and repair.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies for pipeline welding inspection suffer from low accuracy and low efficiency.
A welding defect detection network is adopted, including a backbone feature module, a local feature extraction module, a global feature extraction module, a residual enhancement module, and a hybrid attention module. The network detects welding defects in pipelines through image processing and automatically repairs them using a pipeline repair robot.
It significantly improves the accuracy and efficiency of welding defect detection, enabling accurate identification and location of welding defects and achieving automated repair.
Smart Images

Figure CN121811136A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing technology, specifically relating to an automatic detection and repair method for pipeline installation. Background Technology
[0002] In numerous industrial and public sectors such as petrochemicals, municipal water supply and drainage, and natural gas transmission, pipeline systems serve as the core infrastructure for fluid transport. The quality of their installation directly determines the operational safety, stability, and service life of the entire system. Welding, as a core connection process in pipeline installation, is crucial for ensuring the integrity of welded joints, guaranteeing a leak-free, high-pressure-resistant, and corrosion-resistant pipeline system.
[0003] Currently, pipeline welding inspection is generally carried out through manual inspection or simple machine vision algorithms, which has problems such as low inspection efficiency, low inspection accuracy, and inability to adapt to complex fields. Summary of the Invention
[0004] The purpose of this application is to provide an automatic detection and repair method for pipeline installation, which can solve the technical problems of low detection accuracy and low detection efficiency in existing pipeline welding detection methods.
[0005] To solve the above-mentioned technical problems, this application is implemented as follows: In a first aspect, embodiments of this application provide an automatic detection and repair method for pipeline installation, the method comprising: Obtain pipe installation images containing welding defect labels, preprocess multiple pipe installation images, and construct a dataset based on the preprocessed multiple pipe installation images; A welding defect detection network is constructed, which includes a backbone feature module, a local feature extraction module, a global feature extraction module, a residual enhancement module, a hybrid attention module, and a detection head; The dataset is divided into a training set and a test set according to a preset ratio. The welding defect detection network is trained using the training set and tested using the test set. The target pipe image after welding is acquired, and the welding defect detection network after training is used to detect welding defects in the target pipe image to obtain the location and type of welding defects in the target pipe image. The pipeline repair robot automatically repairs the target pipeline corresponding to the target pipeline image based on the location and type of welding defects in the target pipeline image.
[0006] As an optional implementation of the first aspect of this application, the welding defect detection network performs welding defect detection on the target pipeline image to obtain the location and type of welding defects in the target pipeline image, specifically as follows: Based on the main feature module, the target pipeline image is subjected to basic feature extraction to obtain the main basic features; The local feature extraction module and the global feature extraction module respectively perform local feature extraction and global feature extraction on the backbone basic features to obtain target local features and target global features; The residual enhancement module performs residual enhancement processing on the target local features to obtain residual local features. The residual local features and the target global features are concatenated along the channel dimension to obtain the global-local fused features; The global-local fusion features are subjected to attention enhancement processing based on the hybrid attention module to obtain target detection features; The detection head performs defect detection on the target detection features to obtain the location and type of welding defects in the target pipeline image.
[0007] As an optional implementation of the first aspect of this application, the local feature extraction module performs local feature extraction on the main basic features to obtain target local features, specifically as follows: The backbone basic features are sequentially processed by 3×3 convolution through four consecutive 3×3 convolutional layers to obtain the first local convolutional features. The first local convolutional feature is subjected to max pooling based on the max pooling layer to obtain the first max pooling feature; The first max pooling feature is processed by two consecutive 3×3 convolutional layers to obtain the second local convolutional feature. The second local convolutional feature is subjected to max pooling based on the max pooling layer to obtain the second max pooling feature; The second max pooling feature is processed by a 3×3 convolutional layer to obtain the third local convolutional feature. The target local features are obtained by performing max pooling on the third local convolutional features based on the max pooling layer.
[0008] As an optional implementation of the first aspect of this application, the global feature extraction module performs global feature extraction on the backbone basic features to obtain target global features, specifically as follows: Based on the ViT network layers, feature extraction is performed on the backbone basic features to obtain global information features; The backbone basic features are sequentially processed by 3×3 convolution, BN, and ReLU activation layers to obtain the first global convolutional features. The first global convolutional feature is subjected to max pooling based on the max pooling layer to obtain the third max pooling feature; The third max pooling feature is sequentially processed by 3×3 convolution, BN, and ReLU activation layers to obtain the second global convolution feature. The second global convolutional feature is subjected to max pooling based on the max pooling layer to obtain the fourth max pooling feature; The fourth max pooling feature is processed by 3×3 convolution, BN and ReLU activation layers in sequence to obtain the third global convolution feature. The global information features and the third global convolutional features are concatenated along the channel dimension to obtain the global fusion features; The target global feature is obtained by performing a residual connection between the global fusion feature and the backbone basic feature.
[0009] As an optional implementation of the first aspect of this application, the residual enhancement module performs residual enhancement processing on the target local features to obtain residual local features, specifically as follows: The target local features are processed by a 1×1 convolution layer to obtain the initial convolutional features. The initial convolutional features are divided into four equal segments along the channel dimension to obtain the first segmentation feature, the second segmentation feature, the third segmentation feature, and the fourth segmentation feature, respectively. The first segmentation feature is processed by a 1×1 convolution layer to obtain the first residual convolution feature. The first residual convolutional feature and the second segmentation feature are added element-wise to obtain the first residual fusion feature. The first residual fusion feature is then processed by a 3×3 convolutional layer to obtain the second residual convolutional feature. The first residual convolution feature, the second residual convolution feature, and the third segmentation feature are added element-wise to obtain the second residual fusion feature; The second residual fusion feature is processed by a 5×5 convolution layer to obtain the third residual convolution feature; The first residual convolution feature, the second residual convolution feature, the third residual convolution feature, and the fourth segmentation feature are added element-wise to obtain the third residual fusion feature; The third residual fusion feature is processed by a 7×7 convolution layer to obtain the fourth residual convolution feature. The first residual convolutional feature, the second residual convolutional feature, the third residual convolutional feature, and the fourth residual convolutional feature are concatenated along the channel dimension to obtain the fourth residual fusion feature; The fourth residual fusion feature is processed by a 1×1 convolution layer to obtain the fifth residual convolution feature. The fifth residual convolution feature is then connected to the target local feature residual to obtain the residual local feature.
[0010] As an optional implementation of the first aspect of this application, the hybrid attention module performs attention enhancement processing on the global-local fusion features to obtain target detection features, specifically: The global-local fusion features are processed by two 3×3 convolutional layers to obtain the first attention convolutional features and the second attention convolutional features, respectively. The first attention convolutional feature and the second attention convolutional feature are concatenated along the channel dimension to obtain the first attention fusion feature; The first attention fusion feature is subjected to channel attention enhancement processing according to the channel attention mechanism to obtain the first channel attention enhanced feature; The first channel attention enhancement feature and the second attention convolution feature are concatenated along the channel dimension to obtain the second attention fusion feature; Based on the spatial attention mechanism, the second attention fusion feature is subjected to spatial attention enhancement processing to obtain the first spatial attention enhancement feature; The first spatial attention enhancement feature is processed by channel attention enhancement according to the channel attention mechanism to obtain the second channel attention enhancement feature; The first spatial attention enhancement feature and the first channel attention enhancement feature are concatenated along the channel dimension to obtain the third attention fusion feature; Based on the spatial attention mechanism, the third attention fusion feature is subjected to spatial attention enhancement processing to obtain the second spatial attention enhancement feature; The second spatial attention enhancement feature and the second channel attention enhancement feature are added element-wise to obtain a hybrid attention feature; The hybrid attention features are processed by performing 3×3 convolution and 1×1 convolution on the 3×3 convolution layer and 1×1 convolution layer respectively to obtain the target detection features.
[0011] As an optional implementation of the first aspect of this application, the step of preprocessing multiple pipe installation images and constructing a dataset based on the preprocessed multiple pipe installation images includes: Each of the pipe installation images is sequentially subjected to denoising, illumination normalization, cropping, and pixel normalization to obtain a preprocessed pipe image corresponding to each of the pipe installation images; Data augmentation is performed on each of the preprocessed pipeline images to obtain multiple augmented images corresponding to each preprocessed pipeline image, and the dataset is constructed based on all the augmented images.
[0012] Secondly, embodiments of this application provide an automatic detection and repair system for pipeline installation, the system comprising: Data construction module: acquires pipe installation images containing welding defect labels, preprocesses multiple pipe installation images, and constructs a dataset based on the preprocessed multiple pipe installation images; Network construction module: Constructs a welding defect detection network, which includes a backbone feature module, a local feature extraction module, a global feature extraction module, a residual enhancement module, a hybrid attention module, and a detection head; Network training module: Divides the dataset into a training set and a test set according to a preset ratio, trains the welding defect detection network based on the training set, and tests the trained welding defect detection network based on the test set; Real-time detection module: acquires the target pipe image after welding, and performs welding defect detection on the target pipe image according to the trained welding defect detection network to obtain the location and type of welding defects in the target pipe image; Automatic Repair Module: The pipeline repair robot automatically repairs the target pipeline corresponding to the target pipeline image based on the location and type of welding defects in the target pipeline image.
[0013] Thirdly, embodiments of this application provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0014] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0015] In the embodiments of this application, compared with the prior art, the following technical effects are achieved: This application acquires images of the installed target pipeline and uses a welding defect detection network to detect defects in the acquired images, thereby obtaining the location and type of welding defects in the target pipeline. Subsequently, a pipeline repair robot automatically repairs the pipeline based on the obtained defect location and type, thus realizing the detection and automatic repair of welding defects during the pipeline installation process. The local feature extraction module uses a hierarchical structure with multiple 3×3 convolutions and max pooling processes, ensuring that each 3×3 convolution and max pooling layer processes higher-level local information than the previous layer, thus significantly improving the network's ability to extract local information. The global feature extraction module uses a strategy of extracting and then fusing two extraction branches, so that the final extracted global features contain information from both branches, greatly improving the information richness of the global features. One branch uses a ViT network layer to extract the backbone basic features to extract rich global context information, while the other branch uses a shallow convolutional structure consisting of two 3×3 convolutions followed by max pooling and one 3×3 convolution, establishing a smooth feature abstraction process from low-level to mid-level to high-level, preserving important hierarchical semantic information. The information extracted from the two branches is then fused, resulting in a global fusion feature that includes both global contextual information from the ViT network layer branches and hierarchical semantic information from the shallow convolutional structure branches, significantly improving the network's ability to understand complex scenes. The residual enhancement module performs four equal segments on the target's local features and then applies four different enhancement paths to each of the four segments. Compared to directly processing the target's local features, this significantly reduces the network's computational load. The convolutional kernels of the four paths are progressively enlarged to capture different receptive fields. Except for the first enhancement path with a 1×1 convolutional kernel, the input of each subsequent enhancement path includes the enhanced feature information from all the preceding paths. Finally, the outputs of the four enhancement paths are concatenated and fused to form a complex residual structure combining cascaded splitting and dense connections. This significantly improves the network's ability to identify and locate defects. The hybrid attention module uses channel attention and spatial attention mechanisms as its core. These two attention mechanisms alternately enhance the global-local fusion features to dynamically calibrate channel importance and accurately locate key spatial regions, significantly improving the network's defect detection accuracy. Attached Figure Description
[0016] Figure 1 This is a flowchart of an automatic detection and repair method for pipeline installation provided by some embodiments of this application; Figure 2 This is a schematic diagram of the structure of a welding defect detection network in an automatic detection and repair method for pipeline installation provided by some embodiments of this application; Figure 3This is a schematic diagram of the residual enhancement module in an automatic detection and repair method for pipeline installation provided by some embodiments of this application; Figure 4 This is a schematic diagram of the structure of a hybrid attention module in an automatic detection and repair method for pipeline installation provided by some embodiments of this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0019] The following description, in conjunction with the accompanying drawings, details an automatic detection and repair method and system for pipeline installation provided in this application, through specific embodiments and application scenarios.
[0020] Example An automatic detection and repair method for pipeline installation includes: S100: Obtain pipe installation images containing welding defect labels, preprocess multiple pipe installation images, and construct a dataset based on the preprocessed multiple pipe installation images; According to an optional implementation of this embodiment, step S100 involves preprocessing multiple pipe installation images and constructing a dataset based on the preprocessed multiple pipe installation images, including: Each pipe installation image is sequentially processed by denoising, illumination normalization, cropping, and pixel normalization to obtain the preprocessed pipe image corresponding to each pipe installation image; Data augmentation is performed on each preprocessed pipeline image to obtain multiple augmented images corresponding to each preprocessed pipeline image, and a dataset is constructed based on all the augmented images.
[0021] It should be noted that preprocessing steps such as denoising, illumination normalization, cropping, and pixel normalization can improve the quality of images of people in the workshop. Then, each image after the preprocessing steps is subjected to data augmentation methods such as geometric transformation and pixel transformation to obtain a dataset that has been augmented.
[0022] S200: Construct a welding defect detection network, which includes a backbone feature module, a local feature extraction module, a global feature extraction module, a residual enhancement module, a hybrid attention module, and a detection head; S300: Divide the dataset into training and testing sets according to a preset ratio, train the welding defect detection network based on the training set, and test the trained welding defect detection network based on the testing set. It should be noted that the dataset is divided into training and test sets in a 4:1 ratio. Cross-entropy loss and L1 loss functions are constructed and used to calculate the loss during training. Backpropagation using the Adam optimizer is employed to adjust the network parameters. The network parameters are continuously adjusted by setting the number of training iterations until convergence. Then, the network with converged parameters is tested using the test set and evaluated according to evaluation metrics. If the evaluation results meet the detection requirements, the network training is complete; otherwise, the network parameters are adjusted and retrained until the detection requirements are met.
[0023] S400: Acquire the target pipe image after welding, and perform welding defect detection on the target pipe image according to the trained welding defect detection network to obtain the location and type of welding defects in the target pipe image; According to an optional implementation of this embodiment, S400 is specifically as follows: S410: Extract basic features from the target pipeline image based on the backbone feature module to obtain the backbone basic features; S420: Based on the local feature extraction module and the global feature extraction module, local feature extraction and global feature extraction are performed on the backbone basic features respectively to obtain the target local features and the target global features; S430: Perform residual enhancement processing on the local features of the target based on the residual enhancement module to obtain the residual local features; S440: The residual local features and the target global features are concatenated along the channel dimension to obtain the global-local fused features; S450: The global and local fusion features are enhanced with attention based on the hybrid attention module to obtain the target detection features; S460: Based on the detection head, perform defect detection on the target detection features to obtain the location and type of welding defects in the target pipeline image.
[0024] It should be noted that the process involves extracting basic features from the preprocessed target pipeline image using a backbone feature module (which employs a pre-trained EfficientNet). Next, a local feature extraction module extracts local features from the backbone features to obtain target local features. Simultaneously, a global feature extraction module extracts global features from the backbone features to obtain target global features. Subsequently, the target local features extracted by the local feature extraction module are processed by a residual enhancement module to obtain residual local features. These residual local features are then concatenated with the target global features along the channel dimension to obtain global-local fusion features. A hybrid attention module then performs attention enhancement on the global-local fusion features to obtain target detection features. Finally, a detection head performs defect detection on the target detection features to determine the location and type of welding defects in the target pipeline image.
[0025] According to an optional implementation of this embodiment, in S420, the local feature extraction module performs local feature extraction on the main basic features to obtain the target local features, specifically as follows: S4211: The backbone basic features are sequentially processed by 3×3 convolution based on four consecutive 3×3 convolutional layers to obtain the first local convolutional features; S4212: Perform max pooling on the first local convolutional features according to the max pooling layer to obtain the first max pooling features; S4213: The first max pooling feature is processed by 3×3 convolution in sequence based on two consecutive 3×3 convolutional layers to obtain the second local convolutional feature; S4214: Perform max pooling on the second local convolutional features based on the max pooling layer to obtain the second max pooling features; S4215: The second max pooling feature is processed by a 3×3 convolutional layer to obtain the third local convolutional feature; S4216: Max pooling is performed on the third local convolutional features based on the max pooling layer to obtain the target local features.
[0026] It should be noted that the local feature extraction module first performs four consecutive 3×3 convolutions on the backbone basic features. Each convolution is followed by ReLU activation to introduce non-linearity. This combination of four convolutions and activation functions greatly enhances the network's non-linear expressive ability, enabling it to learn and combine very complex local patterns. Simultaneously, the stacking of four 3×3 convolutions provides a receptive field equivalent to a 7×7 convolution kernel, but with fewer parameters, resulting in higher computational efficiency. Furthermore, multiple non-linear transformations enhance feature discriminative power, thereby capturing the first local convolutional features that are further combined locally. The first local convolutional features are then max-pooled using a 2x2 max-pooling layer with a stride of 2 to retain the most salient features, yielding the first max-pooled features. Finally, two consecutive 3×3 convolutional layers are used to further refine the features. The third convolutional layer performs two consecutive 3×3 convolutions on the first max-pooling feature. Further convolutions are then performed on the resulting first max-pooling feature, enabling the network to learn a wider range of more abstract local patterns, thus obtaining the second local convolutional feature. This second local convolutional feature is then max-pooled again by a max-pooling layer to obtain the second max-pooling feature. Finally, the second max-pooling feature is processed sequentially by a 3×3 convolutional layer and a max-pooling layer to obtain the target local feature. At this point, the 3×3 convolution integrates the local patterns extracted in the first two stages into a highly refined local feature representation (the third local convolutional feature). The final max-pooling operation compresses the third local convolutional feature to a smaller size while retaining the most essential, multi-layered filtered local information (the target local feature).
[0027] According to an optional implementation of this embodiment, in S420, the global feature extraction module performs global feature extraction on the backbone basic features to obtain the target global features, specifically as follows: S4221: Based on the ViT network layers, feature extraction is performed on the backbone basic features to obtain global information features; S4222: The backbone basic features are sequentially processed by 3×3 convolution, BN and ReLU activation layers to obtain the first global convolution feature; S4223: Perform max pooling on the first global convolutional features based on the max pooling layer to obtain the third max pooling features; S4224: The third max pooling feature is processed by 3×3 convolution, BN and ReLU activation in sequence according to the 3×3 convolutional layer, BN layer and ReLU activation layer to obtain the second global convolutional feature; S4225: Max pooling is performed on the second global convolutional feature based on the max pooling layer to obtain the fourth max pooling feature; S4226: The fourth max pooling feature is processed by 3×3 convolution, BN and ReLU activation in sequence according to the 3×3 convolutional layer, BN layer and ReLU activation layer to obtain the third global convolutional feature; S4227: Concatenate the global information features and the third global convolutional features along the channel dimension to obtain the global fusion features; S4228: Perform residual connections between the global fusion features and the backbone basic features to obtain the target global features.
[0028] It should be noted that before extracting features from the backbone basic features through the ViT network layers, the backbone basic features need to be converted into a vector sequence adapted to ViT. This vector sequence is then input into ViT and processed by multiple encoders to obtain a sequence representation rich in global information. This sequence representation is then aggregated through global average pooling to obtain global information features. Simultaneously, the backbone basic features are sequentially processed by 3×3 convolutional layers, BN layers, and ReLU activation layers to obtain the first global convolutional features. BN and ReLU activation stabilize the feature distribution and introduce non-linearity, respectively. Next, a max pooling layer is used to max pool the first global convolutional features to reduce computation and increase translation invariance, thus obtaining the third max pooling. The third max-pooling feature is then subjected to repeated convolution and max-pooling operations through a 3×3 convolutional layer, a BN layer, a ReLU activation layer, and a max-pooling layer to obtain the fourth max-pooling feature. Next, the fourth max-pooling feature is subjected to 3×3 convolution, BN, and ReLU activation operations sequentially through a 3×3 convolutional layer, a BN layer, and a ReLU activation layer to obtain the third global convolutional feature with highly refined semantic representation. Finally, the global information feature and the third global convolutional feature are concatenated along the channel dimension to obtain the global fusion feature. Before fusion, the global information feature needs to be spatially expanded to match the third global convolutional feature. Finally, the global fusion feature is residually connected to the backbone basic feature to ensure that the information in the original backbone basic feature is not lost or degraded, ultimately obtaining the target global feature.
[0029] According to an optional implementation of this embodiment, in S430, the residual enhancement module performs residual enhancement processing on the target local features to obtain residual local features, specifically: S431: Perform 1×1 convolution processing on the local features of the target using a 1×1 convolutional layer to obtain the initial convolutional features; S432: Divide the initial convolutional features into four equal segments along the channel dimension to obtain the first segmentation feature, the second segmentation feature, the third segmentation feature, and the fourth segmentation feature; S433: Perform 1×1 convolution processing on the first segmentation feature according to the 1×1 convolution layer to obtain the first residual convolution feature; S434: Add the first residual convolution feature and the second segmentation feature element-wise to obtain the first residual fusion feature, and perform 3×3 convolution processing on the first residual fusion feature according to the 3×3 convolution layer to obtain the second residual convolution feature. S435: The first residual convolution feature, the second residual convolution feature, and the third segmentation feature are added element-wise to obtain the second residual fusion feature; S436: The second residual fusion feature is processed by a 5×5 convolution layer to obtain the third residual convolution feature; S437: The first residual convolution feature, the second residual convolution feature, the third residual convolution feature, and the fourth segmentation feature are added element-wise to obtain the third residual fusion feature; S438: The third residual fusion feature is processed by 7×7 convolution based on the 7×7 convolution layer to obtain the fourth residual convolution feature; S439: The first residual convolutional feature, the second residual convolutional feature, the third residual convolutional feature and the fourth residual convolutional feature are concatenated along the channel dimension to obtain the fourth residual fusion feature; S4310: Perform 1×1 convolution processing on the fourth residual fusion feature according to the 1×1 convolution layer to obtain the fifth residual convolution feature, and connect the fifth residual convolution feature with the target local feature residual to obtain the residual local feature.
[0030] It should be noted that the residual enhancement module first performs 1×1 convolution processing on the local features of the target through a 1×1 convolutional layer to adjust the number of channels and obtain initial convolutional features. Then, the initial convolutional features are divided into four equal parts along the channels to obtain the first segmentation feature, the second segmentation feature, the third segmentation feature, and the fourth segmentation feature. This provides independent input for the subsequent four processing paths with different receptive fields. Furthermore, each branch only has one-quarter of the original feature's channels, resulting in a significantly lower total computational cost compared to directly performing large-kernel convolution on all channels. Firstly, the first path performs a 1×1 convolution on the first segmentation feature to perform basic feature transformation. The first residual convolutional feature is obtained and will be used as a shared feature for all subsequent paths. Then, the second path element-wise adds the first residual convolutional feature to the second segmentation feature, fusing the information from the original second segmentation feature and the transformed first residual convolutional feature to obtain the first residual fused feature. This first residual fused feature is then processed by a 3×3 convolutional layer. The 3×3 convolution captures a slightly larger local pattern and introduces a medium receptive field, thus obtaining the second residual convolutional feature. Next, the third path element-wise adds the first and second residual convolutional features obtained from the first two paths to the original third segmentation feature. The first path involves adding the first, second, and third residual convolutional features together to enrich the information flow, resulting in the second residual fusion feature. This second residual fusion feature is then processed by a 5×5 convolutional layer, capturing a wider range of regional features to obtain the third residual convolutional feature. The final path combines the first, second, and third residual convolutional features obtained from the first three paths with the original fourth segmentation feature, and then processes the third residual fusion feature through a 7×7 convolutional layer to obtain the fourth residual convolutional feature. This is the path with the deepest fusion and the largest receptive field; the 7×7 convolution can integrate a very broad range of contextual information. Understanding larger local structures is crucial. Then, the products of the four paths (first residual convolutional feature, second residual convolutional feature, third residual convolutional feature, and fourth residual convolutional feature) are concatenated along the channel dimension to obtain a diverse feature (fourth residual fusion feature) containing different receptive fields from 1×1 to 7×7. These features complement each other to form a comprehensive description of the local region. Finally, the fourth residual fusion feature is processed by a 1×1 convolutional layer to adjust the number of channels and integrate channel information, resulting in a fifth residual convolutional feature. The fifth residual convolutional feature is then connected to the residual of the target local feature to ensure that no original information is lost.
[0031] According to an optional implementation of this embodiment, in S450, the hybrid attention module performs attention enhancement processing on the global-local fusion features to obtain target detection features, specifically: S451: The global-local fusion features are processed by two 3×3 convolutional layers to obtain the first attention convolutional features and the second attention convolutional features respectively. S452: The first attention convolutional features and the second attention convolutional features are concatenated along the channel dimension to obtain the first attention fusion features; S453: Perform channel attention enhancement processing on the first attention fusion feature according to the channel attention mechanism to obtain the first channel attention enhanced feature; S454: The first channel attention enhancement feature and the second attention convolution feature are concatenated along the channel dimension to obtain the second attention fusion feature; S455: Based on the spatial attention mechanism, the second attention fusion feature is subjected to spatial attention enhancement processing to obtain the first spatial attention enhanced feature; S456: Perform channel attention enhancement processing on the first spatial attention enhancement feature according to the channel attention mechanism to obtain the second channel attention enhancement feature; S457: The first spatial attention enhancement feature and the first channel attention enhancement feature are concatenated along the channel dimension to obtain the third attention fusion feature; S458: Based on the spatial attention mechanism, the third attention fusion feature is subjected to spatial attention enhancement processing to obtain the second spatial attention enhancement feature; S459: Add the second spatial attention enhancement features and the second channel attention enhancement features element-wise to obtain the hybrid attention features; S4510: The hybrid attention features are processed by 3×3 convolution and 1×1 convolution in sequence according to the 3×3 convolution layer and 1×1 convolution layer to obtain the target detection features.
[0032] It should be noted that by performing 3×3 convolutions on the global-local fusion features separately using two parallel 3×3 convolutional layers, the first attention convolutional feature and the second attention convolutional feature are obtained respectively. These two independent convolutional layers can extract slightly different or complementary information from the same input, increasing feature diversity and providing richer material for subsequent attention. By concatenating the first and second attention convolutional features along the channel dimension, the number of channels is temporarily expanded, and two different perspectives are combined. Subsequently, the concatenated first attention fusion feature is enhanced with channel attention through a channel attention mechanism to obtain the first channel attention enhanced feature. The attention mechanism employs the SE module from SENet. This mechanism generates a channel weight vector through global average pooling, fully connected layers, and the sigmoid function. This weight vector is then multiplied by the first attention fusion feature, thereby selecting important channels from the first attention fusion feature to obtain the first channel attention-enhanced feature. Next, by concatenating the first channel attention-enhanced feature with the second attention convolutional feature along the channel dimension, the enhancement effect is preserved while preventing information loss, forming a hybrid of enhanced and original information, resulting in the second attention fusion feature. Finally, the second attention fusion feature is further enhanced using a spatial attention mechanism. First, spatial attention enhancement processing is performed to obtain the first spatial attention enhanced feature. The spatial attention mechanism then applies global max pooling and global average pooling to the second attention fusion feature, concatenating the two pooled features and performing a 1×1 convolution followed by sigmoid activation to obtain spatial attention weights. These weights are then element-wise multiplied with the second attention fusion feature to highlight important regions in the spatial dimension, resulting in the first spatial attention enhanced feature. Next, a second channel attention mechanism is used to enhance the first spatial attention enhanced feature through channel attention processing. Based on spatial focus, channel dimension calibration is performed again to obtain a more refined first spatial attention enhanced feature. The system employs a two-channel attention enhancement feature. Simultaneously, it concatenates the first spatial attention enhancement feature with the first channel attention enhancement feature along the channel dimension, fusing features from the spatial to channel path with features from the channel to spatial path to achieve information interaction between different attention paths. Then, it enhances the third attention fusion feature using a spatial attention mechanism to achieve deeper and more accurate spatial positioning, thus obtaining the second spatial attention enhancement feature. Finally, it adds the second spatial attention enhancement feature and the second channel attention enhancement feature element-wise to achieve the final output of the two different attention mechanisms, resulting in a hybrid attention feature that simultaneously contains refined spatial and channel information.Then, the hybrid attention features are processed by sequentially applying 3×3 and 1×1 convolutional layers to integrate and transform them, while retaining all enhanced key information, resulting in the final target detection features.
[0033] S500: The pipeline repair robot automatically repairs the target pipeline corresponding to the target pipeline image based on the location and type of welding defects in the target pipeline image. It should be noted that the pipeline repair robot receives the location and type of welding defects, enters the corresponding location on the target pipeline, and repairs the defect location according to the type of welding defect.
[0034] According to an embodiment of the automatic detection and repair method for pipeline installation, this application acquires images of the installed target pipeline and performs defect detection on the acquired images through a welding defect detection network to obtain the location and type of welding defects in the target pipeline. Subsequently, a pipeline repair robot automatically repairs the pipeline based on the obtained defect location and type, thereby achieving automatic detection and repair of welding defects during pipeline installation. The local feature extraction module uses a hierarchical structure with multiple 3×3 convolutions and max pooling processes, ensuring that each layer's 3×3 convolutions and max pooling processes higher-level local information than the previous layer, significantly improving the network's ability to extract local information. The global feature extraction module employs a strategy of extracting and fusing information from two branches, ensuring that the final extracted global features contain information from both branches, greatly enhancing the richness of the global features. One branch uses a ViT network layer to extract core features, extracting rich global contextual information. The other branch uses a shallow convolutional structure consisting of two 3×3 convolutions followed by max pooling and one 3×3 convolution, establishing a smooth feature abstraction from low to medium to high level. The process preserves important hierarchical semantic information; then, the information extracted from the two branches is fused, so that the resulting global fusion feature contains both the global context information from the ViT network layer branches and the hierarchical semantic information provided by the shallow convolutional structure branches, ultimately significantly improving the network's ability to understand complex scenes; the residual enhancement module performs four equal segments of the target's local features, and then applies four different enhancement paths to the four segments, which significantly reduces the network's computational load compared to directly processing the target's local features; the convolutional kernels of the four paths increase in size sequentially, and except for the 1×1 convolution in the first enhancement path, the input of each subsequent enhancement path contains the enhanced feature information from all the previous enhancement paths, and finally, the outputs of the four enhancement paths are concatenated and fused to form a complex residual structure combining cascaded splitting and dense connections; this significantly improves the network's ability to identify and locate defects; the hybrid attention module uses channel attention and spatial attention mechanisms as its core, and alternately enhances the global-local fusion features through these two attention mechanisms to dynamically calibrate channel importance and accurately locate key spatial regions, significantly improving the network's defect detection accuracy.
[0035] It should be noted that the automatic detection and repair method for pipeline installation provided in this application can be executed by an automatic detection and repair system for pipeline installation, or by a control module within that system for executing the automatic detection and repair method. This application uses an example of an automatic detection and repair system executing the automatic detection and repair method for pipeline installation to illustrate the automatic detection and repair method provided in this application.
[0036] An automatic detection and repair system for pipeline installation includes: Data construction module: acquire pipe installation images containing welding defect labels, preprocess multiple pipe installation images, and construct a dataset based on the preprocessed multiple pipe installation images; Network construction module: Constructs a welding defect detection network, which includes a backbone feature module, a local feature extraction module, a global feature extraction module, a residual enhancement module, a hybrid attention module, and a detection head; Network training module: Divide the dataset into training set and test set according to a preset ratio, train the welding defect detection network according to the training set, and test the trained welding defect detection network according to the test set; Real-time detection module: acquires the target pipe image after welding, and performs welding defect detection on the target pipe image according to the trained welding defect detection network to obtain the location and type of welding defects in the target pipe image; Automatic Repair Module: The pipeline repair robot automatically repairs the target pipeline corresponding to the target pipeline image based on the location and type of welding defects in the target pipeline image.
[0037] An automatic detection and repair system for pipeline installation, as described in this application embodiment, can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), etc. This application embodiment does not impose specific limitations.
[0038] An automatic detection and repair system for pipeline installation, as described in this application embodiment, can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not impose specific limitations on it.
[0039] This application provides an automatic detection and repair system for pipeline installation that can achieve... Figures 1 to 4 The various processes and technical effects of an automatic detection and repair method in pipeline installation, as described in the method embodiments, will not be repeated here to avoid repetition.
[0040] Optionally, embodiments of this application also provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the various processes of the above-described embodiment of an automatic detection and repair method for pipeline installation and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0041] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described embodiment of an automatic detection and repair method for pipeline installation and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0042] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0043] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0044] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0045] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An automatic detection and repair method for pipeline installation, characterized in that, The method includes: Obtain pipe installation images containing welding defect labels, preprocess multiple pipe installation images, and construct a dataset based on the preprocessed multiple pipe installation images; A welding defect detection network is constructed, which includes a backbone feature module, a local feature extraction module, a global feature extraction module, a residual enhancement module, a hybrid attention module, and a detection head; The dataset is divided into a training set and a test set according to a preset ratio. The welding defect detection network is trained using the training set and tested using the test set. The target pipe image after welding is acquired, and the welding defect detection network after training is used to detect welding defects in the target pipe image to obtain the location and type of welding defects in the target pipe image. The pipeline repair robot automatically repairs the target pipeline corresponding to the target pipeline image based on the location and type of welding defects in the target pipeline image.
2. The automatic detection and repair method for pipeline installation according to claim 1, characterized in that, The welding defect detection network performs welding defect detection on the target pipeline image to obtain the location and type of welding defects in the target pipeline image, specifically: Based on the main feature module, the target pipeline image is subjected to basic feature extraction to obtain the main basic features; The local feature extraction module and the global feature extraction module respectively perform local feature extraction and global feature extraction on the backbone basic features to obtain target local features and target global features; The residual enhancement module performs residual enhancement processing on the target local features to obtain residual local features. The residual local features and the target global features are concatenated along the channel dimension to obtain the global-local fused features; The global-local fusion features are subjected to attention enhancement processing based on the hybrid attention module to obtain target detection features; The detection head performs defect detection on the target detection features to obtain the location and type of welding defects in the target pipeline image.
3. The automatic detection and repair method for pipeline installation according to claim 2, characterized in that, The local feature extraction module performs local feature extraction on the main basic features to obtain the target local features, specifically: The backbone basic features are sequentially processed by 3×3 convolution through four consecutive 3×3 convolutional layers to obtain the first local convolutional features. The first local convolutional feature is subjected to max pooling based on the max pooling layer to obtain the first max pooling feature; The first max pooling feature is processed by two consecutive 3×3 convolutional layers to obtain the second local convolutional feature. The second local convolutional feature is subjected to max pooling based on the max pooling layer to obtain the second max pooling feature; The second max pooling feature is processed by a 3×3 convolutional layer to obtain the third local convolutional feature. The target local features are obtained by performing max pooling on the third local convolutional features based on the max pooling layer.
4. The automatic detection and repair method for pipeline installation according to claim 2, characterized in that, The global feature extraction module performs global feature extraction on the backbone basic features to obtain the target global features, specifically: Based on the ViT network layers, feature extraction is performed on the backbone basic features to obtain global information features; The backbone basic features are sequentially processed by 3×3 convolution, BN, and ReLU activation layers to obtain the first global convolutional features. The first global convolutional feature is subjected to max pooling based on the max pooling layer to obtain the third max pooling feature; The third max pooling feature is sequentially processed by 3×3 convolution, BN, and ReLU activation layers to obtain the second global convolution feature. The second global convolutional feature is subjected to max pooling based on the max pooling layer to obtain the fourth max pooling feature; The fourth max pooling feature is processed by 3×3 convolution, BN and ReLU activation layers in sequence to obtain the third global convolution feature. The global information features and the third global convolutional features are concatenated along the channel dimension to obtain the global fusion features; The target global feature is obtained by performing a residual connection between the global fusion feature and the backbone basic feature.
5. The automatic detection and repair method for pipeline installation according to claim 2, characterized in that, The residual enhancement module performs residual enhancement processing on the target local features to obtain residual local features, specifically as follows: The target local features are processed by a 1×1 convolution layer to obtain the initial convolutional features. The initial convolutional features are divided into four equal segments along the channel dimension to obtain the first segmentation feature, the second segmentation feature, the third segmentation feature, and the fourth segmentation feature, respectively. The first segmentation feature is processed by a 1×1 convolution layer to obtain the first residual convolution feature. The first residual convolutional feature and the second segmentation feature are added element-wise to obtain the first residual fusion feature. The first residual fusion feature is then processed by a 3×3 convolutional layer to obtain the second residual convolutional feature. The first residual convolution feature, the second residual convolution feature, and the third segmentation feature are added element-wise to obtain the second residual fusion feature; The second residual fusion feature is processed by a 5×5 convolution layer to obtain the third residual convolution feature; The first residual convolution feature, the second residual convolution feature, the third residual convolution feature, and the fourth segmentation feature are added element-wise to obtain the third residual fusion feature; The third residual fusion feature is processed by a 7×7 convolution layer to obtain the fourth residual convolution feature. The first residual convolutional feature, the second residual convolutional feature, the third residual convolutional feature, and the fourth residual convolutional feature are concatenated along the channel dimension to obtain the fourth residual fusion feature; The fourth residual fusion feature is processed by a 1×1 convolution layer to obtain the fifth residual convolution feature. The fifth residual convolution feature is then connected to the target local feature residual to obtain the residual local feature.
6. The automatic detection and repair method for pipeline installation according to claim 2, characterized in that, The hybrid attention module performs attention enhancement processing on the global-local fusion features to obtain target detection features, specifically: The global-local fusion features are processed by two 3×3 convolutional layers to obtain the first attention convolutional features and the second attention convolutional features, respectively. The first attention convolutional feature and the second attention convolutional feature are concatenated along the channel dimension to obtain the first attention fusion feature; The first attention fusion feature is subjected to channel attention enhancement processing according to the channel attention mechanism to obtain the first channel attention enhanced feature; The first channel attention enhancement feature and the second attention convolution feature are concatenated along the channel dimension to obtain the second attention fusion feature; Based on the spatial attention mechanism, the second attention fusion feature is subjected to spatial attention enhancement processing to obtain the first spatial attention enhancement feature; The first spatial attention enhancement feature is processed by channel attention enhancement according to the channel attention mechanism to obtain the second channel attention enhancement feature; The first spatial attention enhancement feature and the first channel attention enhancement feature are concatenated along the channel dimension to obtain the third attention fusion feature; Based on the spatial attention mechanism, the third attention fusion feature is subjected to spatial attention enhancement processing to obtain the second spatial attention enhancement feature; The second spatial attention enhancement feature and the second channel attention enhancement feature are added element-wise to obtain a hybrid attention feature; The hybrid attention features are processed by performing 3×3 convolution and 1×1 convolution on the 3×3 convolution layer and 1×1 convolution layer respectively to obtain the target detection features.
7. The automatic detection and repair method for pipeline installation according to claim 1, characterized in that, The step of preprocessing multiple pipe installation images and constructing a dataset based on the preprocessed pipe installation images includes: Each of the pipe installation images is sequentially subjected to denoising, illumination normalization, cropping, and pixel normalization to obtain a preprocessed pipe image corresponding to each of the pipe installation images; Data augmentation is performed on each of the preprocessed pipeline images to obtain multiple augmented images corresponding to each preprocessed pipeline image, and the dataset is constructed based on all the augmented images.
8. An automatic detection and repair system for pipeline installation, capable of implementing the automatic detection and repair method for pipeline installation as described in any one of claims 1-7, characterized in that, The system includes: Data construction module: acquires pipe installation images containing welding defect labels, preprocesses multiple pipe installation images, and constructs a dataset based on the preprocessed multiple pipe installation images; Network construction module: Constructs a welding defect detection network, which includes a backbone feature module, a local feature extraction module, a global feature extraction module, a residual enhancement module, a hybrid attention module, and a detection head; Network training module: Divide the dataset into a training set and a test set according to a preset ratio, train the welding defect detection network according to the training set, and test the trained welding defect detection network according to the test set; Real-time detection module: acquires the target pipe image after welding, and performs welding defect detection on the target pipe image according to the trained welding defect detection network to obtain the location and type of welding defects in the target pipe image; Automatic Repair Module: The pipeline repair robot automatically repairs the target pipeline corresponding to the target pipeline image based on the location and type of welding defects in the target pipeline image.
9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of an automatic detection and repair method for pipeline installation as described in any one of claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of an automatic detection and repair method for pipeline installation as described in any one of claims 1-7.