Heat distribution pipeline defect image processing method
By building a hybrid window attention network and combining triangle and rectangular window technology, the problem of boundary distortion of rectangular window technology in thermal pipeline image detection is solved, and more efficient image super resolution is achieved, and detection accuracy and reliability are improved.
Patent Information
- Application Number
- CN202411730289.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2024-12-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During use, thermal pipelines are prone to defects such as corrosion and cracks, resulting in low image resolution and blurred details, affecting the accuracy of defect detection. The rectangular shift window technology has distortion at the boundary and limited modes.
A hybrid window attention network is built, combining triangle window technology and rectangular window technology to extract local and global features of the image, and the complementarity of features is achieved through fusion, reducing boundary distortion, allowing the model to access more unique filtering modes.
The image super-resolution effect is improved, and the attention mechanism can be activated on more image pixels, extract long-distance and multi-scale features, and enhance the accuracy and reliability of detection.
Smart Images

Figure CN119205595A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of image enhancement, and in particular relates to a method for processing thermal pipeline defect images. Background Art
[0002] With the acceleration of urbanization and the increase in industrial demand, thermal pipelines have become important infrastructure; however, thermal pipelines are prone to defects such as corrosion, cracks, and wear during long-term use, which may cause short circuits in the pipelines, affect operational safety, and even cause major accidents; therefore, timely and accurate detection of thermal pipeline defects is crucial; however, due to the complex surface of the pipeline, the acquired images often have problems such as low resolution and blurred details, which affect defect detection. Through super-resolution technology, the image clarity can be enhanced while maintaining the overall structure of the image, so that small-sized, high-intensity defects can be clearly displayed, further improving the accuracy and reliability of detection.
[0003] In recent years, the application of Transformer-based models in the field of computer vision has gradually increased, especially in image enhancement, super-resolution, and target detection tasks. Transformer-based models can extract complex information and long-distance dependencies in images, making them perform well in these tasks. The rectangular shift window technology currently used in the Transformer architecture is a common practice in super-resolution models, which can improve the quality and robustness of image enhancement. However, the rectangular shift window technology has distortion at the boundaries and the shift pattern is limited. In order to solve the above problems, the present invention proposes a method for processing thermal pipeline defect images. The method constructs a hybrid window attention network, uses the triangular window technology and the rectangular window technology to work synchronously, reduces boundary distortion, and allows the model to access more unique screening modes, can activate the attention mechanism on more image pixels, and extract long-distance and multi-scale features, thereby improving the image super-resolution effect. Summary of the invention
[0004] The present invention provides a method for processing defect images of thermal pipelines, which aims to fully extract local features and global features of images by constructing a hybrid window attention network, utilizing the triangular window technology and the rectangular window technology to work synchronously, and then fuse the local features and the global features to achieve complementarity between the local features and the global features.
[0005] The present invention integrates the triangular window technology and the rectangular window technology to provide a thermal pipeline defect image processing method, which includes the following steps.
[0006] S1. Use a thermal imaging camera to extract the distribution image of the pipeline system, obtain the thermal pipeline defect image to be processed, annotate the collected thermal pipeline defect image, and the annotated images constitute a thermal pipeline defect image dataset. The dataset is divided into a training set and a validation set.
[0007] S2. Construct a channel information extraction module, including a global average pooling layer, a 1×1 convolution layer, a GeLU activation function, a LeakyReLU activation function, and a channel attention mechanism to assign weights to each channel and enhance the representation capability of the features.
[0008] S3. Construct a local window attention module, including batch normalization layer, channel information extraction module, rectangular window attention, triangular window attention, 3×3 convolution layer, maximum pooling layer and LeakyReLU activation function.
[0009] S4. Construct a global window attention module, including batch normalization layer, channel information extraction module, rectangular window attention, triangular window attention, 7×7 convolution layer, global average pooling layer and LeakyReLU activation function.
[0010] S5. Build a local information extraction module, which consists of N local window attention modules, information fusion layer and 3×3 convolution layer, and input the thermal pipeline defect image features. After the first local window attention module, we get , the subsequent module uses the output of the previous module as input to further optimize the local information, combining the output of N local window attention modules and The fused features are passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, residual connections are introduced to improve the stability of training.
[0011] S6. Build a global information extraction module, which consists of M global window attention modules, information fusion layer and 3×3 convolution layer, and input the thermal pipeline defect image features. After the first global window attention module, we get , the subsequent modules use the output of the previous module as input to further optimize the global information, combining the output of the M global window attention modules and The fused features are passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, residual connections are introduced to improve the stability of training.
[0012] S7. Construct a hybrid window attention network, which consists of a local information extraction module, a global information extraction module and a 1×1 convolutional layer.
[0013] S8. Construct a thermal pipeline defect image enhancement model. The model consists of a shallow feature extraction module, a hybrid window attention network and an image reconstruction module. The thermal pipeline defect image is input into the model to obtain an enhanced thermal pipeline defect image.
[0014] Preferably, in step S2, for the channel information extraction module, the thermal pipeline defect image feature is input ,right Perform global average pooling operation to reduce information redundancy. , Represents the global average pooling operation. The pooling result is enhanced through a 1×1 convolution layer and a GeLU activation function to enhance the representation of nonlinear features and improve the model training effect. , represents a 1×1 convolutional layer, represents the GeLU activation function, and then a 1×1 convolutional layer and a LeakyReLU activation function are used to further enhance the expressiveness of the features. , represents a 1×1 convolutional layer, Represents the LeakyReLU activation function. The output passes through the channel attention mechanism. According to the importance of different channels, each channel is assigned a weight. Finally, the channel weight is multiplied by Get the channel attention features, , represents the channel attention mechanism, Represents element-wise multiplication.
[0015] Preferably, in step S2, information redundancy is reduced by global average pooling, and the 1×1 convolution layer is combined with GeLU and LeakyReLU activation functions to gradually enhance the expression ability of nonlinear features. Subsequently, the channel attention mechanism adaptively assigns weights to different channels so that the model pays more attention to important features. Finally, the weighted channel information is multiplied element by element with the input features to further improve the feature selection accuracy of the model. This series of operations effectively improves the model training efficiency and generalization ability.
[0016] Preferably, in step S3, for the local window attention module, the thermal pipeline defect image features are input , first of all Perform batch normalization operation. , Represents a batch normalization operation, and then Channel information extraction, triangle local feature extraction and rectangle local feature extraction are performed respectively. The channel information extraction module is used to extract the Channel information extraction is performed , Represents the channel information extraction module, which uses a triangular window attention, a 3×3 convolutional layer, a maximum pooling layer, and a multi-layer perceptron. Extract the local features of the triangle , represents the triangle window attention, represents a 3×3 convolutional layer, Represents the maximum pooling operation, MLP represents the multi-layer perceptron, and uses rectangular window attention, 3×3 convolutional layer, maximum pooling layer and multi-layer perceptron. Rectangular local feature extraction is performed to obtain , represents the rectangular window attention, represents a 3×3 convolutional layer, represents the maximum pooling operation, Represents a multilayer perceptron, which connects the results of triangle local feature extraction and rectangle local feature extraction to obtain , Represents the connection operation, which adds the connected features to the channel attention features obtained by the channel information extraction module to improve the overall performance , Represents element-by-element addition. In order to further enhance the local feature extraction and nonlinear expression capabilities of the model, a multilayer perceptron, a 3×3 convolutional layer, and a LeakyReLU activation function are used to optimize the added features. , represents a multilayer perceptron, represents a 3×3 convolutional layer, Represents the LeakyReLU activation function. Finally, in order to improve the stability of model training, a residual connection is introduced. and Add elements to get local information of the image , Stands for element-wise addition.
[0017] Preferably, in step S3, the model performance is enhanced by batch normalization, channel information extraction and local feature extraction. First, the triangular and rectangular window attention is combined with 3×3 convolution, maximum pooling and multi-layer perceptron to effectively extract local features. Then the two local features are connected and added to the channel attention features to strengthen the fusion of global and local information. LeakyReLU and residual connection are used to further optimize the nonlinear expression ability and stability of the model, avoid gradient disappearance, and improve feature learning efficiency.
[0018] Preferably, in step S4, for the global window attention module, the thermal pipeline defect image features are input , first of all Perform batch normalization operation. , Represents a batch normalization operation, and then Channel information extraction, triangle global feature extraction and rectangle global feature extraction are performed respectively. The channel information extraction module is used to extract Channel information extraction is performed , Represents the channel information extraction module, which uses a triangular window attention, a 7×7 convolutional layer, a global average pooling layer, and a multi-layer perceptron. Extract the global features of the triangle , represents the triangle window attention, represents a 7×7 convolutional layer, represents the global average pooling operation, MLP represents the multi-layer perceptron, and uses rectangular window attention, 7×7 convolutional layer, global average pooling layer and multi-layer perceptron. Rectangular global feature extraction is performed to obtain , represents the rectangular window attention, represents a 7×7 convolutional layer, represents the global average pooling operation, Represents a multi-layer perceptron, which connects the results of triangle global feature extraction and rectangle global feature extraction to obtain , Represents the connection operation, which adds the connected features to the channel attention features obtained by the channel information extraction module to improve the overall performance , Represents element-by-element addition. In order to further enhance the global feature extraction and nonlinear expression capabilities of the model, a multilayer perceptron, a 7×7 convolutional layer, and a LeakyReLU activation function are used to optimize the added features. , represents a multilayer perceptron, represents a 7×7 convolutional layer, Represents the LeakyReLU activation function. Finally, in order to improve the stability of model training, a residual connection is introduced. and Add elements to get global image information , Stands for element-wise addition.
[0019] Preferably, in step S4, batch normalization, channel information extraction, and triangle and rectangle global feature extraction are combined to effectively improve the global feature expression ability of the model. 7×7 convolution, global average pooling, and multi-layer perceptron are used to fully capture global information, and the importance of different channels is enhanced through the channel attention mechanism. The combination of triangle and rectangular windows enriches the diversity of global features, and the element addition operation further fuses features to improve model performance. Through LeakyReLU and residual connection, the nonlinear expression ability and training stability are enhanced, the gradient vanishing problem is avoided, and the robustness and accuracy of the model are improved.
[0020] Preferably, in step S5, for the local information extraction module, the module is composed of N local window attention modules, an information fusion layer and a 3×3 convolution layer, and the thermal pipeline defect image feature is input After the first local window attention module, we get , Represents a local window attention module. The subsequent local window attention module uses the output of the previous local window attention module as input to further optimize the local information. After all local window attention modules are calculated, The output of each local window attention module is connected to the information fusion layer. , They are the outputs of N local window attention modules. The fused information is passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, a residual connection is introduced to improve the stability of training. , represents a 3×3 convolutional layer, Stands for element-wise addition.
[0021] Preferably, in step S5, the local features of the input are gradually optimized through N local window attention modules to ensure the multi-level expression of local information. The output of each module is used as the input of the subsequent module, so that the local features are continuously captured and strengthened. The information fusion layer connects the original input and the output of each local module to ensure the effective fusion of local information at all levels. The 3×3 convolution layer is used to reduce the number of parameters and the complexity of the model while retaining the integrity of the local features. The residual connection improves the stability of the training, avoids the disappearance of the gradient, and ensures the robustness and efficient training of the model.
[0022] Preferably, in step S6, for the global information extraction module, the module is composed of M global window attention modules, an information fusion layer and a 3×3 convolution layer, and the thermal pipeline defect image feature is input After the first global window attention module, we get , Represents the global window attention module. The subsequent global window attention module uses the output of the previous global window attention module as input to further optimize the global information. After all global window attention modules are calculated, The output of each global window attention module is connected to the information fusion layer. , They are the outputs of M global window attention modules respectively. The fused information is passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, a residual connection is introduced to improve the stability of training. , represents a 3×3 convolutional layer, Stands for element-wise addition.
[0023] Preferably, in step S6, the global features of the input are gradually optimized through M global window attention modules to ensure the multi-level expression of global information. The output of each module is used as the input of the subsequent module, so that the global features are continuously captured and strengthened. The information fusion layer connects the original input and the output of each global module to ensure the effective fusion of global information at all levels. The 3×3 convolutional layer is used to reduce the number of parameters and the complexity of the model while retaining the integrity of the global features. The residual connection improves the stability of the training, avoids the disappearance of the gradient, and ensures the robustness and efficient training of the model.
[0024] Preferably, in step S7, the hybrid window attention network is composed of a local information extraction module, a global information extraction module and a 1×1 convolutional layer, and the thermal pipeline defect image features are input. P local information extraction modules are used to extract and optimize the local features of the image, and Q global information extraction modules are used to extract and optimize the global features of the image. Then, the optimized local features and the optimized global features are element-wise added to make the local features and the global features complementary. , represents P local information extraction modules, represents Q global information extraction modules, It represents element-by-element addition, and then uses a 1×1 convolutional layer to compress and integrate the features to prevent information redundancy. Finally, a residual connection is introduced to improve the stability of training. , represents a 1×1 convolutional layer, Stands for element-wise addition.
[0025] Preferably, in step S7, the hybrid window attention network optimizes local and global features respectively through the local information extraction module and the global information extraction module, and adds the two to achieve feature complementarity, effectively combining fine-grained and global semantic information. Through the layer-by-layer optimization of P local information extraction modules and Q global information extraction modules, the model can more accurately extract multi-scale features, use 1×1 convolutional layers to compress and integrate features, reduce information redundancy, reduce computational complexity, and introduce residual connections to improve training stability, avoid the gradient vanishing problem, and ensure the robustness and efficient training of the model.
[0026] Compared with the prior art, the present invention has the following beneficial effects: The technical solution provided by the present invention is a hybrid window attention network, which utilizes the triangular window technology and the rectangular window technology to work synchronously, solves the problem of distortion at the boundary of the rectangular window technology, and allows the model to access more unique screening modes. It can activate the attention mechanism on more thermal pipeline defect image pixels, and extract long-distance, multi-scale features, fully extract the local features and global features of the image, and then fuse the local features and the global features to achieve the complementarity of the local features and the global features, thereby improving the image super-resolution effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a flow chart of the thermal pipeline defect image processing method provided by the present invention.
[0028] Figure 2 It is a structural diagram of the channel information extraction module provided by the present invention.
[0029] Figure 3 It is a structural diagram of the local window attention module provided by the present invention.
[0030] Figure 4 This is a structural diagram of the global window attention module provided by the present invention.
[0031] Figure 5 It is a structural diagram of the local information extraction module provided by the present invention.
[0032] Figure 6 It is a structural diagram of the global information extraction module provided by the present invention.
[0033] Figure 7 This is a structural diagram of the hybrid window attention network provided by the present invention.
[0034] Figure 8 This is a super-resolution effect diagram of a low-resolution thermal pipeline defect image provided by the present invention. DETAILED DESCRIPTION
[0035] The following will be combined with the accompanying drawings of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] See also Figures 1 to 8 The present invention provides a method for processing defect images of thermal pipelines, which aims to fully extract local features and global features of the image by constructing a hybrid window attention network, using the triangular window technology and the rectangular window technology to work synchronously, and then fuse the local features and the global features to achieve complementarity between the local features and the global features.
[0037] See also Figure 1 As shown, a thermal pipeline defect image processing method in an embodiment of the present application.
[0038] S1. Select a suitable thermal imaging camera, determine the best shooting position of the camera, shoot at multiple angles and multiple time periods as needed, obtain 3,000 thermal pipeline defect images, annotate the collected thermal pipeline defect images, and the annotated images constitute a thermal pipeline defect image dataset. The dataset is divided into a training set and a validation set in a ratio of 7:3.
[0039] S2. Construct a channel information extraction module, including a global average pooling layer, a 1×1 convolution layer, a GeLU activation function, a LeakyReLU activation function, and a channel attention mechanism to assign weights to each channel and enhance the representation capability of the features.
[0040] Furthermore, if Figure 2 As shown, input thermal pipeline defect image features To the channel information extraction module, first Perform global average pooling operation to reduce information redundancy. , Represents the global average pooling operation. The pooling result is enhanced through a 1×1 convolution layer and a GeLU activation function to enhance the representation of nonlinear features and improve the model training effect. , represents a 1×1 convolutional layer, represents the GeLU activation function, and then a 1×1 convolutional layer and a LeakyReLU activation function are used to further enhance the expressiveness of the features. , represents a 1×1 convolutional layer, Represents the LeakyReLU activation function. The output passes through the channel attention mechanism. According to the importance of different channels, each channel is assigned a weight. Finally, the channel weight is multiplied by Get the channel attention features, , represents the channel attention mechanism, Represents element-wise multiplication.
[0041] S3. Construct a local window attention module, including batch normalization layer, channel information extraction module, rectangular window attention, triangular window attention, 3×3 convolution layer, maximum pooling layer and LeakyReLU activation function.
[0042] Furthermore, if Figure 3 As shown, input thermal pipeline defect image features To the local window attention module, first Perform batch normalization operation. , Represents the batch normalization operation, and then Channel information extraction, triangle local feature extraction and rectangle local feature extraction are performed respectively. The channel information extraction module is used to extract the Channel information extraction is performed , Represents the channel information extraction module, which uses a triangular window attention, a 3×3 convolutional layer, a maximum pooling layer, and a multi-layer perceptron. Extract the local features of the triangle , represents the triangle window attention, represents a 3×3 convolutional layer, Represents the maximum pooling operation, MLP represents the multi-layer perceptron, and uses rectangular window attention, 3×3 convolutional layer, maximum pooling layer and multi-layer perceptron. Rectangular local feature extraction is performed to obtain , represents the rectangular window attention, represents a 3×3 convolutional layer, represents the maximum pooling operation, Represents a multilayer perceptron, which connects the results of triangle local feature extraction and rectangle local feature extraction to obtain , Represents the connection operation, which adds the connected features to the channel attention features obtained by the channel information extraction module to improve the overall performance , Represents element-by-element addition. In order to further enhance the local feature extraction and nonlinear expression capabilities of the model, a multilayer perceptron, a 3×3 convolutional layer, and a LeakyReLU activation function are used to optimize the added features. , represents a multilayer perceptron, represents a 3×3 convolutional layer, Represents the LeakyReLU activation function. Finally, in order to improve the stability of model training, a residual connection is introduced. and Add elements to get local information of the image , Stands for element-wise addition.
[0043] S4. Construct a global window attention module, including batch normalization layer, channel information extraction module, rectangular window attention, triangular window attention, 7×7 convolution layer, global average pooling layer and LeakyReLU activation function.
[0044] Furthermore, if Figure 4 As shown, input thermal pipeline defect image features To the global window attention module, first Perform batch normalization operation. , Represents a batch normalization operation, and then Channel information extraction, triangle global feature extraction and rectangle global feature extraction are performed respectively. The channel information extraction module is used to extract Channel information extraction is performed , Represents the channel information extraction module, which uses a triangular window attention, a 7×7 convolutional layer, a global average pooling layer, and a multi-layer perceptron. Extract the global features of the triangle , represents the triangle window attention, represents a 7×7 convolutional layer, represents the global average pooling operation, MLP represents the multi-layer perceptron, and uses rectangular window attention, 7×7 convolutional layer, global average pooling layer and multi-layer perceptron. Rectangular global feature extraction is performed to obtain , represents the rectangular window attention, represents a 7×7 convolutional layer, represents the global average pooling operation, Represents a multi-layer perceptron, which connects the results of triangle global feature extraction and rectangle global feature extraction to obtain , Represents the connection operation, which adds the connected features to the channel attention features obtained by the channel information extraction module to improve the overall performance , Represents element-by-element addition. In order to further enhance the global feature extraction and nonlinear expression capabilities of the model, a multilayer perceptron, a 7×7 convolutional layer, and a LeakyReLU activation function are used to optimize the added features. , represents a multilayer perceptron, represents a 7×7 convolutional layer, Represents the LeakyReLU activation function. Finally, in order to improve the stability of model training, a residual connection is introduced. and Add elements to get global image information , Stands for element-wise addition.
[0045] S5. Build a local information extraction module, which consists of 40 local window attention modules, information fusion layer and 3×3 convolution layer, and input the thermal pipeline defect image features After the first local window attention module, we get The subsequent modules use the output of the previous module as input to further optimize the local information, combining the output of the 40 local window attention modules and The fused features are passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, residual connections are introduced to improve the stability of training.
[0046] Furthermore, if Figure 5 As shown in Figure 2, the local information extraction module consists of 40 local window attention modules, information fusion layers, and 3×3 convolutional layers. The input is the thermal pipeline defect image feature. After the first local window attention module, we get , Represents a local window attention module. The subsequent local window attention module uses the output of the previous local window attention module as input to further optimize the local information. After all local window attention modules are calculated, The output of each local window attention module is connected to the information fusion layer. , They are the outputs of 40 local window attention modules respectively. The fused information is passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, a residual connection is introduced to improve the stability of training. , represents a 3×3 convolutional layer, Stands for element-wise addition.
[0047] S6. Build a global information extraction module, which consists of 20 global window attention modules, information fusion layer and 3×3 convolution layer, and input the thermal pipeline defect image features After the first global window attention module, we get , the subsequent modules use the output of the previous module as input to further optimize the global information, combining the output of the 20 global window attention modules and The fused features are passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, residual connections are introduced to improve the stability of training.
[0048] Furthermore, if Figure 6 As shown in the figure, the global information extraction module consists of 20 global window attention modules, information fusion layer and 3×3 convolution layer, and inputs the thermal pipeline defect image features. After the first global window attention module, we get , Represents the global window attention module. The subsequent global window attention module uses the output of the previous global window attention module as input to further optimize the global information. After all global window attention modules are calculated, The output of each global window attention module is connected to the information fusion layer. , They are the outputs of 20 global window attention modules respectively. The fused information is passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, a residual connection is introduced to improve the stability of training. , represents a 3×3 convolutional layer, Stands for element-wise addition.
[0049] S7. Construct a hybrid window attention network, which consists of a local information extraction module, a global information extraction module and a 1×1 convolutional layer.
[0050] Furthermore, if Figure 7 As shown in the figure, the hybrid window attention network consists of a local information extraction module, a global information extraction module and a 1×1 convolutional layer. After obtaining the thermal pipeline defect image using a thermal imaging camera, the image is input into the shallow feature extraction module to obtain the initial features of the thermal pipeline defect image. , thermal pipeline defect image features The local features of the image are extracted and optimized by 8 local information extraction modules and the global features of the image are extracted and optimized by 16 global information extraction modules. Then the optimized local features and the optimized global features are added element by element, so that the local features and the global features complement each other. , Represents 8 local information extraction modules, represents 16 global information extraction modules, It represents element-by-element addition, and then uses a 1×1 convolutional layer to compress and integrate the features to prevent information redundancy. Finally, a residual connection is introduced to improve the stability of training. , represents a 1×1 convolutional layer, Stands for element-wise addition.
[0051] S8. Construct a thermal pipeline defect image enhancement model. The model consists of a shallow feature extraction module, a hybrid window attention network and an image reconstruction module. The thermal pipeline defect image is input into the model to obtain an enhanced thermal pipeline defect image.
[0052] Furthermore, in step S8, a thermal pipeline defect image enhancement model is developed using the Python language through the Pycharm application and implemented based on the Pytorch framework. The model inputs a low-resolution thermal pipeline defect image and starts training using a self-supervised learning method. The model effectively extracts local and global features in the image.
[0053] Furthermore, if Figure 8 As shown, Figure 8 The left half is a low-resolution thermal pipeline defect image. Figure 8 The middle right half is a high-resolution thermal pipeline defect image obtained after being processed by the thermal pipeline defect image enhancement model, which significantly enhances the clarity and recognizability of the thermal pipeline defect image and improves the accuracy of subsequent detection and processing.
[0054] The above are only preferred embodiments of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the protection scope of the present invention.
Claims
1. A method for processing thermal pipeline defect images, characterized in that: The following steps are involved: S1. Use a thermal imaging camera to extract a distribution image of the pipeline system and obtain a thermal pipeline defect image to be processed; S2. Construct a channel information extraction module, including a global average pooling layer, a 1×1 convolution layer, a GeLU activation function, a LeakyReLU activation function, and a channel attention mechanism, assign weights to each channel, and enhance the representation capability of features; S3. Build a local window attention module, including batch normalization layer, channel information extraction module, rectangular window attention, triangle window attention, 3×3 convolution layer, maximum pooling layer and LeakyReLU activation function; S4. Build a global window attention module, including batch normalization layer, channel information extraction module, rectangular window attention, triangle window attention, 7×7 convolution layer, global average pooling layer and LeakyReLU activation function; S5, construct a local information extraction module, including N local window attention modules and an information fusion layer; S6, construct a global information extraction module, including M global window attention modules and an information fusion layer; S7. Construct a hybrid window attention network, which consists of a local information extraction module, a global information extraction module and a 1×1 convolutional layer; S8. Construct a thermal pipeline defect image enhancement model. The model consists of a shallow feature extraction module, a hybrid window attention network and an image reconstruction module. The thermal pipeline defect image is input into the model to obtain an enhanced thermal pipeline defect image.
2. A thermal pipeline defect image processing method according to claim 1, characterized in that: In S2, for the channel information extraction module, the thermal pipeline defect image feature is input ,right Perform global average pooling operation to reduce information redundancy. , Represents the global average pooling operation. The pooling result is enhanced through a 1×1 convolution layer and a GeLU activation function to enhance the representation of nonlinear features and improve the model training effect. , represents a 1×1 convolutional layer, represents the GeLU activation function, and then uses a 1×1 convolutional layer and a LeakyReLU activation function to enhance the expressiveness of the feature. , represents a 1×1 convolutional layer, Represents the LeakyReLU activation function. The output passes through the channel attention mechanism. According to the importance of different channels, each channel is assigned a weight. Finally, the channel weight is multiplied by Get the channel attention features, , represents the channel attention mechanism, Represents element-wise multiplication.
3. A thermal pipeline defect image processing method according to claim 1, characterized in that: In S3, for the local window attention module, the thermal pipeline defect image features are input , first of all Perform batch normalization operation. , Represents the batch normalization operation, and then Channel information extraction, triangle local feature extraction and rectangle local feature extraction are performed respectively. The channel information extraction module is used to extract the Channel information extraction is performed , Represents the channel information extraction module, which uses a triangular window attention, a 3×3 convolutional layer, a maximum pooling layer, and a multi-layer perceptron. Extract the local features of the triangle , represents the triangle window attention, represents a 3×3 convolutional layer, represents the maximum pooling operation, Represents a multilayer perceptron using rectangular window attention, 3×3 convolutional layers, max pooling layers, and multilayer perceptron pairs Rectangular local feature extraction is performed to obtain , represents the rectangular window attention, represents a 3×3 convolutional layer, represents the maximum pooling operation, Represents a multilayer perceptron, which connects the results of triangle local feature extraction and rectangle local feature extraction to obtain , Represents the connection operation, which adds the connected features to the channel attention features obtained by the channel information extraction module to improve the overall performance , Represents element-by-element addition. In order to enhance the local feature extraction and nonlinear expression capabilities of the model, a multilayer perceptron, a 3×3 convolutional layer, and a LeakyReLU activation function are used to optimize the added features. , represents a multilayer perceptron, represents a 3×3 convolutional layer, Represents the LeakyReLU activation function. Finally, in order to improve the stability of model training, a residual connection is introduced. and Add elements to get local information of the image , Stands for element-wise addition.
4. A thermal pipeline defect image processing method according to claim 1, characterized in that: In S4, for the global window attention module, the thermal pipeline defect image features are input , first of all Perform batch normalization operation. , Represents the batch normalization operation, and then Channel information extraction, triangle global feature extraction and rectangle global feature extraction are performed respectively. The channel information extraction module is used to extract Channel information extraction is performed , Represents the channel information extraction module, which uses a triangular window attention, a 7×7 convolutional layer, a global average pooling layer, and a multi-layer perceptron. Extract the global features of the triangle , represents the triangle window attention, represents a 7×7 convolutional layer, represents the global average pooling operation, MLP represents the multi-layer perceptron, and uses rectangular window attention, 7×7 convolutional layer, global average pooling layer and multi-layer perceptron. Rectangular global feature extraction is performed to obtain , represents the rectangular window attention, represents a 7×7 convolutional layer, represents the global average pooling operation, Represents a multi-layer perceptron, which connects the results of triangle global feature extraction and rectangle global feature extraction to obtain , Represents the connection operation, which adds the connected features to the channel attention features obtained by the channel information extraction module to improve the overall performance , Represents element-by-element addition. In order to enhance the global feature extraction and nonlinear expression capabilities of the model, a multilayer perceptron, a 7×7 convolutional layer, and a LeakyReLU activation function are used to optimize the added features. , represents a multilayer perceptron, represents a 7×7 convolutional layer, Represents the LeakyReLU activation function. Finally, in order to improve the stability of model training, a residual connection is introduced. and Add elements to get global image information , Stands for element-wise addition.
5. The method for processing thermal pipeline defect images according to claim 1, characterized in that: In S5, for the local information extraction module, the module consists of N local window attention modules, information fusion layer and 3×3 convolution layer, and inputs the thermal pipeline defect image feature After the first local window attention module, we get , Represents a local window attention module. The subsequent local window attention module uses the output of the previous local window attention module as input to optimize local information. After all local window attention modules are calculated, The output of each local window attention module is connected to the information fusion layer. , They are the outputs of N local window attention modules. The fused information is passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, a residual connection is introduced to improve the stability of training. , represents a 3×3 convolutional layer, Stands for element-wise addition.
6. A thermal pipeline defect image processing method according to claim 1, characterized in that: In S6, for the global information extraction module, the module consists of M global window attention modules, information fusion layer and 3×3 convolution layer, and inputs the thermal pipeline defect image feature After the first global window attention module, we get , Represents the global window attention module. The subsequent global window attention module uses the output of the previous global window attention module as input to optimize the global information. After all global window attention modules are calculated, The output of each global window attention module is connected to the information fusion layer. , They are the outputs of M global window attention modules respectively. The fused information is passed through a 3×3 convolutional layer to reduce the number of parameters and the complexity of the model. Finally, a residual connection is introduced to improve the stability of training. , represents a 3×3 convolutional layer, Stands for element-wise addition.
7. The method for processing thermal pipeline defect images according to claim 1, characterized in that: In S7, the hybrid window attention network consists of a local information extraction module, a global information extraction module and a 1×1 convolutional layer, and inputs the thermal pipeline defect image features. P local information extraction modules are used to extract and optimize the local features of the image, and Q global information extraction modules are used to extract and optimize the global features of the image. Then, the optimized local features and the optimized global features are element-wise added to make the local features and the global features complementary. , represents P local information extraction modules, represents Q global information extraction modules, It represents element-by-element addition, and then uses a 1×1 convolutional layer to compress and integrate the features to prevent information redundancy. Finally, a residual connection is introduced to improve the stability of training. , represents a 1×1 convolutional layer, Stands for element-wise addition.
Citation Information
Patent Citations
Image defogging method and system based on global feature fusion attention network
CN113344806A
Automobile part image super-resolution method based on dual-channel residual attention
CN118570065A
Cited By
Rabbit airway in-situ tumor image processing method
CN119887602A
Self-adaptive defect detection method and device and storage medium
CN122223031A
