Gas facility corrosion identification method based on semantic segmentation
By combining semantic segmentation and feature extraction methods with the MSFF-DDRNet model, the problems of high workload and high misjudgment rate in the identification of rust in gas facilities are solved, and high-precision identification of rust areas and degree of rust are achieved.
Patent Information
- Application Number
- CN202511802795.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2045-12-03
AI Technical Summary
In existing technologies, the identification of rust on gas facilities suffers from the problems of large workload for manual review and high error rate, especially in irregularly shaped areas, making it difficult to achieve high-precision automated identification.
A semantic segmentation-based approach is adopted to extract suspected corrosion areas through a semantic segmentation model. Combined with a feature extraction and classification ensemble model, the corrosion areas are identified and the degree of corrosion is determined. The MSFF-DDRNet model is used for multi-scale feature fusion and dynamic weight feature fusion to improve the recognition accuracy.
It effectively reduces the workload of manual review, improves the accuracy of identifying rusted areas, reduces misjudgments, and achieves efficient and accurate identification of rust on gas facilities.
Smart Images

Figure CN121259336B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a method for identifying rust on gas facilities based on semantic segmentation. Background Technology
[0002] Steel gas facilities (pipelines, valves, etc.) are prone to rust at connections and bends due to contact with air and moisture, and are usually painted to prevent rusting. However, painting is not allowed on certain critical parts, such as pipe or valve connections, which are often prone to rusting due to complex chemical reactions. Gas companies conduct regular manual inspections to check for rust and monitor the corrosion status of critical parts.
[0003] To avoid misjudgments or omissions by inspectors, current technology typically involves submitting inspection results after taking photos, with the backend reviewing the photos to determine if gas facilities show signs of corrosion. This ensures the accuracy and reliability of inspection results. However, the primary problem with manual photo review is the large workload. Random checks cannot achieve comprehensive coverage and there is a certain time lag, which may leave potential hazards for gas safety.
[0004] With the development of image recognition technology, rust identification can be performed using target monitoring methods, which solves the problem of large workload for manual review. However, the target monitoring method is not very accurate in identifying irregularly shaped rust areas and often results in misjudgments. Summary of the Invention
[0005] The purpose of this invention is to improve the accuracy of rust identification by avoiding misjudgment through semantic segmentation, feature extraction and pattern recognition, while solving the problem of large workload in manual review. This invention provides a method for identifying rust in gas facilities based on semantic segmentation.
[0006] To achieve the above-mentioned objectives, the embodiments of the present invention provide the following technical solutions:
[0007] A method for identifying corrosion of gas facilities based on semantic segmentation includes the following steps:
[0008] Step 1: Acquire images of the gas facility;
[0009] Step 2: Extract suspected rust areas from the gas facility image using a semantic segmentation model;
[0010] The semantic segmentation model includes a backbone path, a high-resolution path, a low-resolution path, a dynamic weight feature fusion module, and a segmentation head. The output of the backbone path is connected to the high-resolution path and the low-resolution path, respectively. The output of the high-resolution path and the low-resolution path are connected to the dynamic weight feature fusion module, respectively. The output of the dynamic weight feature fusion module is connected to the segmentation head, and the segmentation head outputs suspected rust areas.
[0011] Step 3: Generate feature vectors for suspected rusted areas through feature extraction;
[0012] Step 4: Based on the feature vector, determine whether corrosion has occurred and the degree of corrosion through a classification ensemble model.
[0013] The proposed solution identifies the presence and extent of corrosion in gas facilities through three stages: semantic segmentation, feature extraction, and classification ensemble model. This addresses the issue of heavy workload in manual inspection and improves the accuracy of corrosion area identification through three-stage image processing, reducing or avoiding false positives. Specifically, the semantic segmentation model extracts suspected corrosion areas, generates feature vectors for these areas through feature extraction, and finally, the classification ensemble model determines the presence and extent of corrosion. The proposed semantic segmentation model (MSFF-DDRNet) aims to achieve accurate identification and extraction of suspected corrosion areas, providing high-quality input for subsequent corrosion identification.
[0014] Furthermore, the backbone path includes an initial block, a first basic residual block, a second basic residual block, and a third basic residual block connected in sequence.
[0015] In the above scheme, the core role of the basic residual block is to complete key tasks such as feature refinement, capability enhancement and gradient optimization while preserving the spatial dimension of the feature map. The continuously connected basic residual blocks can gradually extract more complex semantic features without compressing the size of the feature map through stacked convolution operations. From basic edge and texture features, they are gradually aggregated into recognizable target features, providing accurate detail support for subsequent semantic segmentation and avoiding the loss of small targets or detailed information due to scale compression.
[0016] Furthermore, the high-resolution path includes a multi-scale feature extraction and fusion module, a fourth basic residual block, and a first bottleneck residual block connected in sequence; the output of the first basic residual block is connected to the input of the multi-scale feature extraction and fusion module, the output of the third basic residual block is connected to the input of the multi-scale feature extraction and fusion module, and the output of the first bottleneck residual block is connected to the input of the dynamic weight feature fusion module.
[0017] In the above scheme, based on the original DDRNet model framework, a multi-scale feature extraction and fusion module (MSFF) is introduced into the high-resolution path. The core idea of MSFF is to effectively improve the information utilization efficiency of the model in features at different scales by using a specific scale alignment strategy and grouped feature interaction on the basis of multi-scale fused features.
[0018] Furthermore, the low-resolution path includes a fifth basic residual block, a sixth basic residual block, a second bottleneck residual block, and a deep aggregation pyramid pooling module connected in sequence. The output of the second basic residual block is connected to the input of the fifth basic residual block, the output of the fifth basic residual block is connected to the input of the multi-scale feature extraction and fusion module, and the output of the deep aggregation pyramid pooling module is connected to the input of the dynamic weight feature fusion module.
[0019] In the above scheme, a Deep Applied Pyramid Pooling (DAPPM) module is introduced into the low-resolution path. The core idea of DAPPM is to extract features from different scales through multi-level pooling operations and then aggregate them, thereby enhancing the scale invariance and semantic expressive power of the features. The Dynamic Weighted Feature Fusion (DWFF) module dynamically fuses the output features of the high-resolution and low-resolution paths.
[0020] Furthermore, the multi-scale feature extraction and fusion module includes a sampling unit, an attention masking unit, and a fusion unit connected in sequence, wherein the sampling unit includes a first sampling branch, a second sampling branch, and a third sampling branch;
[0021] The first sampling branch includes a hybrid pooling layer and a first grouping interaction mechanism layer;
[0022] The second sampling branch includes a second grouping interaction mechanism layer;
[0023] The third sampling branch includes a bilinear interpolation layer and a third grouping interaction mechanism layer;
[0024] The first group interaction mechanism layer, the second group interaction mechanism layer, and the third group interaction mechanism layer are group interaction mechanism layers with the same structure, and are respectively connected to the input end of the attention mask unit.
[0025] In the above scheme, the multi-scale feature extraction and fusion module (MSFF) first receives three feature scales from the backbone network and the low-resolution feature network, which are the large-scale features f output by the first basic residual block. 1 / 4 The mesoscale features f of the third basic residual block output 1 / 8 The small-scale feature f of the fifth basic residual block output 1 / 16Due to the different resolutions, specific strategies are needed to align them to a uniform scale to ensure consistency in subsequent fusion operations. Among these, large-scale features f... 1 / 4 Hybrid pooling (max pooling and average pooling layers) is used for downsampling. Max pooling enhances local responses, while average pooling preserves overall smoothness. The two complement each other, contributing to a balanced modeling of details and semantics. Mesoscale feature f 1 / 8 Standard convolution enhancement is performed directly, serving as the baseline scale for scale fusion. Small-scale feature f 1 / 16 Bilinear interpolation is used to upsample to a mid-scale feature resolution, ensuring smooth interpolation and avoiding artifacts. After scale alignment, the feature maps of the three scales are unified to the same spatial size, laying the foundation for subsequent information exchange and fusion.
[0026] Furthermore, any grouping interaction mechanism layer divides the input features into G groups along the channel dimension. , Let G represent the j-th feature group, where j = 1, 2, ..., G;
[0027] Each set of features Compared with the previous set of features The generated transitive features After being processed by convolution, three features are generated:
[0028] (1) Transmission characteristics Used to pass in the next set of features ;
[0029] (2) Main output characteristics Used to construct feature sets;
[0030] (3) Weighting features , used to generate weight sets;
[0031] Concatenate the main output features generated from each set of features to construct a feature set. The weighted features generated from each set of features are concatenated to construct a weight set. ;
[0032] Weight set Converted into channel attention vectors through convolution. Used for weighted adjustment of feature sets Then, output the vector set.
[0033] In the above scheme, considering that different scale channels often carry different types of semantic information, the multi-scale feature extraction and fusion module (MSFF) introduces a group interaction mechanism to enhance the feature expression capability at each scale, and then performs information transmission and fusion group by group to achieve the dual goal of local fine mining and global overall association. This interaction mode avoids the problem of channel isolation.
[0034] Furthermore, the first sampling branch outputs vector set G11, the second sampling branch outputs vector set G22, and the third sampling branch outputs vector set G33. A CAT operation is performed on vector sets G11, G22, and G33, concatenating them into a multi-channel tensor C_cat. This multi-channel tensor C_cat is then input into the attention masking unit to generate the attention mask A. i , i∈a,b,c,A a A b A c These are the attention masks corresponding to the first sampling branch, the second sampling branch, and the third sampling branch, respectively.
[0035] Using attention mask A a Weighted vector set G11, attention mask A b Weighted vector set G22, attention mask A c The vector set G33 is weighted and the feature map G1 is obtained through the fusion unit.
[0036] In the above scheme, attention mask A is generated. i The key regions of the features are enhanced spatially, and the feature map scale is aligned. This enhances the feature expressiveness in both spatial and channel dimensions, resulting in a final feature map that combines local detail with global semantics, especially strengthening the key mesoscale feature f. 1 / 8 Its semantic perception and structural recognition capabilities provide more accurate input support for downstream segmentation tasks.
[0037] Furthermore, the dynamic weighted feature fusion module first applies deformable convolution operations to the features output from the high-resolution path and the features output from the low-resolution path, respectively, to obtain feature H. pre and feature L pre ;
[0038] Then feature H pre and feature L pre The concatenation is performed along the channel dimension to form a fused feature C. This fused feature C is then input into progressively dimensionality-reduced convolutional blocks to generate dynamic weights. and ;
[0039] Finally, feature H is evaluated based on dynamic weights. pre and L pre We perform weighted fusion to obtain the fused feature map H:
[0040]
[0041] Among them, H preThe features obtained by performing deformable convolution operations on the features output from the high-resolution path, L pre Features obtained by performing deformable convolution operations on features output from low-resolution paths; The dynamic weights corresponding to the high-resolution path. This represents the dynamic weights corresponding to the low-resolution path.
[0042] In the above scheme, before fusion, the Dynamic Weighted Feature Fusion (DWFF) module first applies deformable convolution operations to the features output from the high-resolution path and the features output from the low-resolution path, respectively, to enhance their adaptability to geometric deformation and target structure. The processed features are denoted as H. pre and L pre This serves as the foundational input for subsequent fusion. This process can dynamically adjust the receptive region of the convolution while preserving the semantics of the features, thereby improving the sensitivity of the features to target edges and complex shapes.
[0043] Compared with existing technologies, the beneficial effects of this invention are as follows: The semantic segmentation model of this invention can extract suspected rust areas, then generate feature vectors for these areas through feature extraction, and finally determine whether rust has occurred and the degree of rust through a classification ensemble model. By identifying whether gas facilities are rusted and the degree of rust through three stages—semantic segmentation, feature extraction, and classification ensemble model—this invention solves the problem of heavy workload in manual inspection. Furthermore, the three-stage image processing improves the accuracy of rust area identification and reduces or avoids misjudgments. Attached Figure Description
[0044] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a flowchart of the method of the present invention;
[0046] Figure 2 This is a schematic diagram of the network structure of the semantic segmentation model of the present invention;
[0047] Figure 3 This is a schematic diagram of the network structure of the multi-scale feature extraction and fusion module of the present invention;
[0048] Figure 4 This is a schematic diagram of the structure of the group interaction mechanism layer of the present invention;
[0049] Figure 5 This is a schematic diagram of the dynamic weight feature fusion module of the present invention;
[0050] Figure 6 This is a schematic diagram illustrating the extraction of suspected rusted areas in this invention;
[0051] Figure 7 This is a schematic diagram of the classification integration model of the present invention. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0053] It should be noted that similar reference numerals and letters in the following figures denote similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, the terms "first," "second," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance, or suggesting any such actual relationship or order between these entities or operations. Additionally, the terms "connected," "linked," etc., can refer to a direct connection between elements, modules, or units, or an indirect connection via other elements, modules, or units.
[0054] Example 1:
[0055] This invention is achieved through the following technical solutions, such as... Figure 1 As shown, the method for identifying corrosion of gas facilities based on semantic segmentation includes the following steps:
[0056] Step 1: Acquire images of the gas facilities.
[0057] Inspection personnel take photos and upload images of the gas facilities, or collect images of the gas facilities through cameras installed at key locations within the facilities. This embodiment focuses on the corrosion of key parts of the gas facilities; therefore, the images collected specifically refer to those of key areas, such as pipe connections, pipe deformation points, and valves.
[0058] Step 2: Extract suspected rust areas from the gas facility image using a semantic segmentation model.
[0059] Figure 2This is a schematic diagram of the network structure of the semantic segmentation model (MSFF-DDRNet), as shown below. Figure 2 As shown, the semantic segmentation model (MSFF-DDRNet) adds a multi-scale feature extraction and fusion module (MSFF) and a dynamic weight feature fusion module (DWFF) to the framework of the deep dual-resolution network (DDRNet) for semantic segmentation, so as to realize the dynamic fusion of output features of high-resolution path and low-resolution path.
[0060] For more details, please continue reading. Figure 2 The semantic segmentation model includes a backbone path, a high-resolution path, a low-resolution path, a dynamic weight feature fusion module (DWFF), and a segmentation head. The output of the backbone path is connected to the high-resolution path and the low-resolution path, respectively. The output of the high-resolution path and the low-resolution path are connected to the dynamic weight feature fusion module, respectively. The output of the dynamic weight feature fusion module is connected to the segmentation head, and the segmentation head outputs suspected rust areas.
[0061] The backbone path includes an initial block, a first basic residual block, a second basic residual block, and a third basic residual block connected in sequence.
[0062] The high-resolution path includes a multi-scale feature extraction and fusion module (MSFF), a fourth basic residual block, and a first bottleneck residual block connected in sequence. The output of the first basic residual block is connected to the input of the multi-scale feature extraction and fusion module, the output of the third basic residual block is connected to the input of the multi-scale feature extraction and fusion module, and the output of the first bottleneck residual block is connected to the input of the dynamic weight feature fusion module.
[0063] The low-resolution path includes a fifth basic residual block, a sixth basic residual block, a second bottleneck residual block, and a deep aggregation pyramid pooling module (DAPPM) connected in sequence. The output of the second basic residual block is connected to the input of the fifth basic residual block, the output of the fifth basic residual block is connected to the input of the multi-scale feature extraction and fusion module, and the output of the deep aggregation pyramid pooling module is connected to the input of the dynamic weight feature fusion module.
[0064] Regarding the connection relationship between the high-resolution path and the low-resolution path: the output of the multi-scale feature extraction and fusion module is connected to the input of the sixth basic residual block, the output of the fifth basic residual block is connected to the input of the fourth basic residual block, the output of the fourth basic residual block is connected to the input of the second bottleneck residual block, and the output of the sixth basic residual block is connected to the input of the first bottleneck residual block.
[0065] The processing steps of a semantic segmentation model:
[0066] A large number of gas facility images were collected and labeled to form a first training set with a scale of H×W×C. The labels included suspected rusted areas, and H, W, and C represented the height, width, and number of channels of the gas facility image, respectively. The first training set was input into the main path and processed through initial block processing to obtain a scale of H×W×C. Feature map F1; feature map F1 is processed by the first basic residual block to obtain a scale of Feature map F2; feature map F2 is processed by the second basic residual block to obtain a scale of Feature map F3; feature map F3 is processed by the third basic residual block to obtain a scale of Feature map F4.
[0067] Feature map F3, after being processed by the fifth basic residual block, yields a scale of... Feature map P1; feature map F2, feature map F4, and feature map P1 are input together into a multi-scale feature extraction and fusion module for processing to obtain a scale of... Feature map G1; feature map P1, after upsampling, is input together with feature map G1 into the fourth basic residual block for processing, resulting in a scale of... Feature map G2; feature map G1, after downsampling, and feature map P1 are input together into the sixth basic residual block for processing to obtain a scale of... Feature map P2; after upsampling, feature map P2 and feature map G2 are input together into the first bottleneck residual block for processing, resulting in a scale of... Feature map G3; feature map G2, after downsampling, and feature map P2 are input together into the second bottleneck residual block for processing, resulting in a scale of... Feature map P3 is input into the deep aggregation pyramid pooling module for processing to obtain feature map P4; feature map P4 and feature map G3 are input into the dynamic weight feature fusion module for processing to obtain feature map H.
[0068] Figure 3 This is a schematic diagram of the network structure of the Multi-Scale Feature Extraction and Fusion (MSFF) module, as shown below. Figure 3As shown, the multi-scale feature extraction and fusion module (MSFF) includes a sampling unit, an attention masking unit, and a fusion unit. The sampling unit includes a first sampling branch, a second sampling branch, and a third sampling branch. The core of the MSFF module is to introduce a group interaction mechanism in each sampling branch based on multi-scale feature fusion to enhance the richness and discriminative power of feature representation. Through specific scale alignment strategies and group feature interactions, the MSFF module can effectively improve the information utilization efficiency of the model in features at different scales.
[0069] The first sampling branch includes, in sequence, a convolutional block 1 (Conv+BN+ReLU), a hybrid pooling layer, a first group interaction layer, and a convolutional block 2 (Conv+BN+ReLU). The hybrid pooling layer includes a max pooling layer and an average pooling layer. Large-scale feature map f 1 / 4 (i.e., feature map F2) After being processed by convolutional block 1, it is downsampled using max pooling and average pooling layers respectively. The outputs of the max pooling layer and the average pooling layer are added together and then fed into the first grouping interaction mechanism layer. Finally, it passes through convolutional block 2 to obtain the result with the mid-scale feature f. 1 / 8 (i.e., feature map F4) is a feature map of the same scale.
[0070] The second sampling branch includes a convolutional block 1 (Conv+BN+ReLU) and a second group interaction layer connected in sequence. Mesoscale feature f 1 / 8 (i.e., feature map F4) After being processed by convolutional block 1, it is input into the second grouping interaction mechanism layer, and the output is the same as the mesoscale feature f. 1 / 8 Feature maps of the same scale.
[0071] The third sampling branch includes, in sequence, convolutional block 1 (Conv+BN+ReLU), a bilinear interpolation layer (Bilinear), a third group interaction mechanism layer (Group Interaction), and convolutional block 2 (Conv+BN+ReLU). Small-scale feature f 1 / 16 (i.e., feature map P1) After being processed by convolutional block 1, it is upsampled by a bilinear interpolation layer and then input into the third grouping interaction mechanism layer. Finally, it passes through convolutional block 2 to obtain the mid-scale feature f. 1 / 8 Feature maps of the same scale.
[0072] This solution takes into account that different channels often carry different types of semantic information. In the multi-scale feature extraction and fusion module, features at all three scales are processed using a grouping interaction mechanism, with information being transferred and fused layer by layer. The processing logic of the three grouping interaction mechanism layers is the same; therefore, this embodiment only uses one of the grouping interaction mechanism layers as an example for introduction.
[0073] Figure 4 This is a schematic diagram of the structure of the group interaction mechanism layer, as shown below. Figure 4 As shown, firstly, the input features are divided into G groups along the channel dimension. This avoids the high number of parameters and computational load caused by direct interaction across all channels. Let G represent the j-th feature group, where j = 1, 2, ..., G. Each feature group is first expanded by a 1×1 convolution to increase the number of channels and enhance its expressive power. The core function of the 1×1 convolution is to "upgrade" the channel dimension without changing the feature space size. After channel expansion, the "semantic capacity" of each feature group is significantly improved. Fine-grained features that were difficult to distinguish with a single channel can be more accurately expressed through multi-channel combination encoding, laying the foundation for subsequent cross-group interaction and attention selection. While enhancing the local expressive power of a single group, it maintains the "lightweight" advantage brought by grouping, resolving the contradiction between the high computational cost of full-channel interaction and the insufficient expressive power of a single feature group. Next, each feature group... Compared with the previous set of features The generated transitive features After being processed by convolution, three features are generated: (1) Transitive features Used to pass in the next set of features (2) Main output characteristics (3) Weighted features This is used to generate the weight set. The first set of features... Transmission features without input, Group G features The generated transitive features are no longer output. Then, the main output features generated from each set of features are concatenated to construct a feature set. The weighted features generated from each set of features are concatenated to construct a weight set. The purpose of this mechanism is to ensure that each feature channel not only contains its own local information, but also transmits feature information. By integrating channel information from all preceding groups, this interactive mode achieves the dual goals of detailed local mining and global correlation, avoiding the problem of channel isolation. Finally, the weight set... Converted into channel attention vectors through convolution. Used for weighted adjustment of feature sets This is to highlight key semantic features. The interaction mechanism ultimately achieves this through "grouping expansion and transmission" and "weight set"... →Channel attention vector →Feature set The "weighted" process enhances the features of the channel dimension.
[0074] The first sampling branch outputs vector set G11, the second sampling branch outputs vector set G22, and the third sampling branch outputs vector set G33. Vector sets G11, G22, and G33 are subjected to a CAT operation and concatenated into a multi-channel tensor C_cat with the shape [B, H / 8, W / 8, C_total], where B represents the batch size and C_total is the number of channels in C_cat. The multi-channel tensor C_cat is input into the attention mask unit to enhance the collaborative representation across different scales. Through several convolutional blocks (dimensionality reduction + global correlation extraction) and softmax normalization, an attention mask A with the same size as the input space is generated. i Let i ∈ a, b, c, a = 1 / 4, b = 1 / 8, c = 1 / 16. Split C_cat into C11, C22, and C33, and use the attention mask A. 1 / 4 Weighted vector set G11, attention mask A 1 / 8 Weighted vector set G22, attention mask A 1 / 16 The vector set G33 is weighted and finally fused by the fusion unit to output the feature map G1.
[0075] In summary, the Multi-Scale Feature Extraction and Fusion (MSFF) module preserves the spatial details of features through hybrid pooling and bilinear interpolation, and generates an attention mask A. i Key regions of the features are enhanced spatially, and the feature maps are ultimately scaled (unified to f). 1 / 8 Its grouping interaction mechanism layer enhances feature representation in the channel dimension. Therefore, MSFF integrates three strategies: multi-scale modeling, channel grouping interaction, and attention modulation, simultaneously enhancing feature representation capabilities in both spatial and channel dimensions. The final output feature map G1 possesses both local details and global semantics, especially strengthening key mesoscale features f. 1 / 8 Its semantic perception and structural recognition capabilities provide more accurate input support for downstream segmentation tasks.
[0076] Figure 5 This is a schematic diagram of the Dynamic Weighted Feature Fusion (DWFF) module, as shown below. Figure 5 As shown, the Dynamic Weighted Feature Fusion (DWFF) module first applies deformable convolution operations (DConv) to the high-resolution features (i.e., feature map G3 output from the high-resolution path) and the low-resolution features (i.e., feature map P4 output from the low-resolution path) to enhance its adaptability to geometric deformation and target structure, thereby obtaining feature H. pre and L preThis serves as the foundational input for subsequent fusion. This process can dynamically adjust the receptive region of the convolution while preserving the semantics of the features, thereby improving the sensitivity of the features to target edges and complex shapes.
[0077] To achieve a more adaptive fusion strategy, the dynamic weighted feature fusion module introduces a lightweight weight generation network to generate features H. pre and L pre The concatenation along the channel dimension forms a fused feature C, which carries contextual information from both scales. This fused feature C is then input into progressively dimensionality-reduced convolutional blocks, where global dependencies are extracted to generate two dynamic weights. and , which correspond to the fusion weights of high-resolution features and low-resolution features, respectively.
[0078] It should be noted that the sigmoid activation function is used in the last layer of dynamic weight generation to ensure that the dynamic weights fluctuate within the range of [0,1], but they are not forcibly normalized, i.e., not forcibly... This allows the model to flexibly enhance the feature representation of a certain branch according to actual semantic needs when facing different scenarios, thereby improving the freedom and flexibility of the fusion strategy.
[0079] Finally, the dynamic weight feature fusion module applies the generated dynamic weights to the features H at both scales. pre and L pre We perform weighted fusion to obtain the fused feature map H:
[0080]
[0081] Among them, H pre L represents the features obtained after applying deformable convolution to high-resolution features. pre Features obtained by performing deformable convolution on low-resolution features; The dynamic weights corresponding to high-resolution features. These are the dynamic weights corresponding to low-resolution features.
[0082] Figure 6 This is a schematic diagram of the extraction of suspected rusted areas, such as... Figure 6 As shown, the feature map H is finally input into the segmentation head for semantic segmentation. After the loss function Loss guides the model optimization direction, the output is a binary segmentation map of the same size H×W as the gas facility image, where the pixel value of the rust area is 255 (white) and the pixel value of the background is 0 (black). After multiplying the original gas facility image by the mask matrix, the suspected rust area is obtained.
[0083] Step 3: Generate feature vectors for suspected rusted areas through feature extraction.
[0084] Based on existing open-source libraries such as Scikit-image and cv2, grayscale features, morphological features, texture features, and spatial features were calculated for suspected rusted areas. Multiple features, including but not limited to those shown in Table 1, were extracted to characterize the rusted areas. These features were then converted into feature vectors to provide a foundation for subsequent identification and classification of rusted areas. Table 1 shows the extracted features.
[0085] Table 1 Extracted Feature Table
[0086]
[0087] Step 4: Based on the feature vector, determine whether corrosion has occurred and the degree of corrosion through a classification ensemble model.
[0088] Figure 7 This is a schematic diagram of the structure of the classification ensemble model, such as Figure 7 As shown, N random forest (RF) models and M XGBoost models are constructed, where N and M may be equal or unequal, with N=15 and M=15 being preferred.
[0089] In the extracted feature vectors, positive samples are defined as "general corrosion" and "severe corrosion" samples, and negative samples are defined as "non-corrosion" samples. For training each model in the classification ensemble model, the "non-corrosion" negative samples are randomly undersampled from the feature vectors, ensuring that the ratio of undersampled negative samples to the total number of positive samples is 1:1. Each undersampling is performed independently to ensure that the training subsets of different models are different.
[0090] The training data for each model consists of two parts: randomly undersampled negative samples from the feature vector and the full dataset of positive samples. The feature vectors are used to train both the Random Forest and XGBoost models, resulting in 30 model outputs. Finally, a voting process is used to determine the category of each model's output; the category with the most outputs is the final classification result of the ensemble model. The classification ensemble model identifies the category as whether the suspected rusted area has rusted, and the degree of rust: non-rusted, moderately rusted, or severely rusted.
[0091] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for gas installation corrosion identification based on semantic segmentation, characterized in that, The method comprises the following steps: Step 1, collecting a gas facility image; Step 2, extracting a suspected rust area in the gas facility image through a semantic segmentation model; The semantic segmentation model comprises a backbone path, a high-resolution path, a low-resolution path, a dynamic weight feature fusion module and a segmentation head, the output end of the backbone path is connected with the high-resolution path and the low-resolution path respectively, the output end of the high-resolution path and the output end of the low-resolution path are connected with the dynamic weight feature fusion module respectively, the output end of the dynamic weight feature fusion module is connected with the segmentation head, and the segmentation head outputs the suspected rust area; The backbone path comprises sequentially connected initial blocks, first, second and third basic residual blocks; The high-resolution path comprises sequentially connected multi-scale feature extraction fusion modules, a fourth basic residual block and a first bottleneck residual block; the output end of the first basic residual block is connected with the input end of the multi-scale feature extraction fusion module, the output end of the third basic residual block is connected with the input end of the multi-scale feature extraction fusion module, and the output end of the first bottleneck residual block is connected with the input end of the dynamic weight feature fusion module; The low-resolution path comprises sequentially connected fifth and sixth basic residual blocks, a second bottleneck residual block and a deep aggregation pyramid pooling module; the output end of the second basic residual block is connected with the input end of the fifth basic residual block, the output end of the fifth basic residual block is connected with the input end of the multi-scale feature extraction fusion module, and the output end of the deep aggregation pyramid pooling module is connected with the input end of the dynamic weight feature fusion module; Step 3, generating a feature vector of the suspected rust area through feature extraction; Step 4, judging whether rust occurs and the rust degree based on the feature vector through a classification ensemble model.
2. A semantic segmentation based gas installation corrosion identification method according to claim 1, characterized in that, The multi-scale feature extraction fusion module comprises sequentially connected sampling units, attention mask units and fusion units, and the sampling units comprise first, second and third sampling branches; The first sampling branch comprises a hybrid pooling layer and a first grouping interaction mechanism layer; The second sampling branch comprises a second grouping interaction mechanism layer; The third sampling branch comprises a bilinear interpolation layer and a third grouping interaction mechanism layer; The first, second and third grouping interaction mechanism layers are grouping interaction mechanism layers with the same structure and are connected with the input end of the attention mask unit respectively.
3. The gas facility rust identification method based on semantic segmentation according to claim 2, wherein Any of the packet interaction mechanism layers divides the input features along the channel dimension into G groups , denotes the j-th group of features, j = 1, 2,... G; Each group of features With the previous group of features Generated transfer features After the convolution processing, three parts of features are generated: (1) pass characteristics , for passing the next set of characteristics ; (2) main output features for constructing the feature set; (3) weight features for generating a weight set; concatenating the primary output features generated for each group of features to build a feature set concatenating the weight features generated for each group of features to build a weight set ; set of weights converted to a channel attention vector by a convolution process for weighting adjusting the set of features and output a set of vectors.
4. The method of claim 2, wherein the method further comprises: The first sampling branch outputs a vector set G11, the second sampling branch outputs a vector set G22, and the third sampling branch outputs a vector set G33. The vector set G11, the vector set G22, and the vector set G33 are subjected to a CAT operation and spliced into a multi-channel tensor C_cat. The multi-channel tensor C_cat is input into an attention mask unit to generate an attention mask A i , i∈a,b,c, A a , i∈a,b,c, A b , i∈a,b,c, A c are attention masks corresponding to the first sampling branch, the second sampling branch, and the third sampling branch, respectively. Using attention mask A a Weighting the vector set G11, attention mask A b Weighting the vector set G22, attention mask A c Weighting the vector set G33, and obtaining the feature map G1 through the fusion unit.
5. The gas facility rust identification method based on semantic segmentation according to claim 1, wherein The dynamic weight feature fusion module first applies a deformable convolution operation to the features output by the high-resolution path and the features output by the low-resolution path respectively, to obtain features H pre and features L pre , respectively. Then the feature H pre and the feature L pre are spliced in the channel dimension to form a fusion feature C, the fusion feature C is input into a convolution block with stepwise dimension reduction to generate dynamic weights and ; Finally, the feature H is fused according to the dynamic weight pre and L pre weighted fusion, and a fused feature map H is obtained. wherein H pre is a feature obtained after a deformable convolution operation on the feature output by the high-resolution path, L pre is a feature obtained after a deformable convolution operation on the feature output by the low-resolution path; is a dynamic weight corresponding to the high-resolution path, is a dynamic weight corresponding to the low-resolution path.
Citation Information
Patent Citations
Substation oil leakage and metal corrosion detection method and system based on semantic segmentation
CN113763358A
Asymmetric road scene semantic segmentation network for multi-scale feature extraction
CN117746364A