A lightweight semantic segmentation network and method for power grid inspection
By using a lightweight semantic segmentation network, employing the MobileNet v2 backbone network and an improved hollow spatial pyramid pooling module, the problem of segmenting narrow and long targets in power grid inspection is solved, achieving efficient and accurate power grid inspection results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTHWEST JIAOTONG UNIV
- Filing Date
- 2024-11-15
- Publication Date
- 2026-07-03
AI Technical Summary
Existing semantic segmentation algorithms struggle to accurately segment narrow and elongated targets and complex backgrounds during power grid inspections, and their high computational complexity makes them difficult to deploy effectively on resource-constrained drones.
We employ a lightweight MobileNet v2 backbone network combined with a lightweight large-scale dilated spatial pyramid pooling module, along with grouped hybrid convolution and cross-attention pooling. Through cross-attention wavelet fusion and full-dimensional dynamic convolution post-processing modules, we enhance feature extraction and fusion capabilities.
It significantly improves the ability to model narrow and long targets, reduces false detections and missed detections, meets the resource constraints of UAVs, and improves the segmentation accuracy and efficiency of power grid inspection.
Smart Images

Figure QLYQS_6 
Figure QLYQS_12 
Figure QLYQS_13
Abstract
Description
Technical Field
[0001] This invention pertains to power grid inspection technology, and particularly relates to a lightweight semantic segmentation network and method for power grid inspection. Background Technology
[0002] The power system is the core of modern social infrastructure, and its safety and stability directly affect national economic and social development. However, with the continuous expansion of the power grid, traditional manual inspection methods are no longer sufficient to cope with the complex and ever-changing environment within the power grid. Manual inspection is not only time-consuming and inefficient, but also carries a high risk of missed or false inspections. Therefore, automated inspection based on drones is gradually becoming the mainstream trend in power grid inspection. Drones combined with deep learning algorithms can improve inspection efficiency and reduce labor costs, especially in inspecting critical equipment such as power lines, transmission towers, and insulators, demonstrating significant advantages.
[0003] Deep learning methods used in power grid inspection primarily involve semantic segmentation and object detection. Object detection algorithms assign bounding boxes to each object, but cannot accurately reconstruct its outline. Therefore, their application is limited in power grid inspection scenarios where precise object boundary localization is crucial. Compared to object detection, more advanced semantic segmentation algorithms assign category labels to each pixel, meticulously delineating the boundaries of target objects, which helps in discovering and locating some difficult-to-detect defects. Thus, semantic segmentation exhibits unique advantages over object detection in power grid inspection scenarios where boundary details are sensitive. However, existing semantic segmentation algorithms also have significant limitations when handling complex inspection scenarios. Targets such as power lines occupy very few pixels in aerial images, making it difficult for traditional semantic segmentation algorithms to accurately reconstruct the boundaries of narrow, elongated targets. Furthermore, complex background information further exacerbates the detection difficulty, leading to missed or false detections. In terms of computational complexity, many high-precision algorithms have a large number of parameters and high computational overhead, making efficient deployment on resource-constrained drones difficult, severely limiting their application in practical inspection tasks.
[0004] Currently, semantic segmentation methods applied to power grid inspection are mainly divided into two categories. The first category is based on encoder-decoder network structures, such as U-Net and SegNet. Zhai Xueming et al. from North China Electric Power University replaced the convolutions in U-Net with depthwise separable convolutions and introduced a channel attention module, improving the detection effect of transmission line defects. State Grid Zhejiang Electric Power Co., Ltd. introduced residual and asymmetric convolutions and reduced the network depth, optimizing the application of SegNet in power line defect detection. The second category is based on network structures with dilated convolutional layers. Chen et al. introduced a decoder structure to restore image resolution based on DeepLab v3 and captured multi-scale contextual information through the dilated spatial pyramid pooling (ASPP) module. Li Jiaxin et al. from the School of Information Engineering, Nanchang Aviation University, introduced depthwise separable convolutions to improve the structure of dilated spatial pyramid pooling (ASPP), combined with a residual network to alleviate the gradient vanishing problem in DeepLab v3+, improving the segmentation accuracy of power line clamp screws. Li Shengli et al. from North China Electric Power University added dilated convolutions with different dilation rates to the FCN structure and used conditional random fields to improve the segmentation accuracy of transmission lines. Current improvements to DeepLab v3+ have enhanced target boundary segmentation to some extent, but its ASPP module has limited modeling capabilities for narrow and elongated targets. Feature detail loss during upsampling remains, and the complex structure and high computational cost of DeepLab v3+ make it difficult to deploy effectively on resource-constrained devices such as drones. With the expansion of power system scale and the increasing demand for power grid inspection, developing a semantic segmentation model that can accurately segment various targets in the power grid, especially narrow and elongated targets, while also being efficient and lightweight, has become an urgent problem to be solved in the current power grid inspection field. Summary of the Invention
[0005] To address the challenge of accurately segmenting numerous narrow and elongated targets and multi-scale targets in complex inspection scenarios, this invention provides a lightweight semantic segmentation network and method for power grid inspection.
[0006] This invention discloses a lightweight semantic segmentation network for power grid inspection. It employs an encoder-decoder architecture. In the encoder section, raw data is input into a lightweight MobileNet v2 backbone network for feature extraction. The resulting feature map is then input into a lightweight, large-scale, dilated spatial pyramid pooling (ASPP) module for further multi-scale feature extraction. This module includes a series of 1×1 convolutional layers, three groups of grouped hybrid convolutional layers with different dilation rates, and a set of cross-shaped attention pooling layers. In the decoder section, the high-dimensional and low-dimensional features obtained from the backbone network are input into a cross-attention wavelet fusion module. Attention modeling is performed on the spatial and channel dimensions, and the two parts of information are fused. The resulting feature map is then fused with the decoder output and processed by a full-dimensional dynamic convolution post-processing module. Downsampling is then used to restore the data to its original size, resulting in the final prediction mask.
[0007] Furthermore, the grouped hybrid convolutional layers perform grouped hybrid convolutions as follows:
[0008] Assume the number of input channels is M and the number of output channels is N.
[0009] (1) 5×5 grouped convolution: The input feature map is divided into M groups, and a layer-by-layer convolution of size 5×5×1 is used for each channel.
[0010] (2) 3×3 layer-by-layer dilated convolution: After group convolution, perform 3×3×1 layer-by-layer dilated convolution in parallel for each channel.
[0011] (3) Pointwise convolution: The feature maps of all channels are concatenated along the channel dimension, and 1×1×N pointwise convolution is applied to aggregate the information of different channels and adjust the number of channels.
[0012] Furthermore, the specific process of the cross-shaped attention pooling layer is as follows:
[0013] Given a two-dimensional tensor Pooling operations are performed using two mutually perpendicular strip pooling kernels along either the horizontal or vertical spatial dimension, with the horizontal SP output... for:
[0014]
[0015] Vertical SP output for:
[0016]
[0017] Horizontal and vertical bar pooling kernels capture row-wide and column-wide features, respectively, with sizes of H×1 and W×1. After one-dimensional convolution and expend operations, they are summed in place, restoring the feature map size to H×W. The generated tensor, after expansion and fusion, has attention to the narrow and long target in both horizontal and vertical directions. It is then multiplied by the original feature map to redistribute the feature weights.
[0018] Furthermore, the cross-attention wavelet fusion module uses discrete wavelet transform to select high-frequency components in different directions to construct new feature maps, which are then concatenated with the original low-frequency components. The high-level feature map extracts channel information through an efficient channel attention mechanism to enhance high-dimensional feature representation, given the input... After global average pooling without dimensionality reduction, it becomes To perform the convolution operation, the size is further adjusted to... After undergoing an adaptive one-dimensional convolution with kernel size k, there exists a non-linear mapping ψ between k and the channel dimension C:
[0019]
[0020] In the formula, τ odd Let represent the odd number closest to τ, and let γ and b be linear parameters, set to 2 and 1 respectively.
[0021] The low-dimensional features and high-dimensional features are multiplied by their ECA weights after the above operations, and then concatenated with the original high-dimensional features along the channel dimension. After adjusting the number of channels through a 1×1 convolution and upsampling, the final output is obtained.
[0022] Furthermore, the dynamic convolution post-processing module introduces a learnable dynamic convolution module in one branch. This module dynamically adjusts the spatial dimension, channel dimension, shape, and size of the convolution kernel based on the features of the input data to adapt to different input data. Its mathematical expression is as follows:
[0023]
[0024] in This represents the attention scalar of the convolution kernel. These represent three newly introduced attention scalars, calculated along the input channel dimension and output channel dimension of the convolution kernel Wi kernel space, respectively.
[0025] In another branch, a spatial attention mechanism weighted by global feature information is used. First, global max pooling and global average pooling are used to aggregate the information of the feature maps, and then the information is added in pairs. Then, 3×3 convolution is used to aggregate the features to obtain the spatial feature weights of this branch. Then, the weights are multiplied by the corresponding pixels of the input feature map to obtain the output result. The output of the module is the result of the feature maps of the two branches being added in pairs, and then the channel information is adjusted by 1×1 convolution.
[0026] The present invention provides a semantic segmentation method for a lightweight semantic segmentation network for power grid inspection, comprising the following steps:
[0027] Step 1: Construct a semantic segmentation dataset for power grid inspection scenarios. This dataset focuses on common narrow and elongated features and various backgrounds in power systems. The dataset is derived from open-source aerial photography data and high-resolution images collected by power grid companies during actual inspections, containing a total of 1426 images. Target objects are classified into categories such as transmission lines, wooden transmission poles, and reinforced concrete poles, and pixel-level segmentation masks are manually annotated.
[0028] Step 2: Initialize the weights of the MobileNet v2 backbone network to pre-trained weights from the ImageNet dataset using transfer learning techniques; the training process employs a frozen backbone strategy: lock the backbone network parameters for the first 50 training epochs to maintain the stability of the pre-trained weights, avoid destroying the existing feature structure in the early stages of training, and accelerate inference speed; after 50 epochs of frozen training, unfreeze the backbone network to allow it to participate in the weight update of the entire network. A low learning rate is used in this stage to ensure that the backbone network can gradually adapt to the features of the new data.
[0029] Step 3: To address the issue of imbalanced data categories during power grid inspections, a loss function combining Focal Loss and Dice coefficient fine-tuning was adopted. The mathematical expression of this loss function is as follows:
[0030]
[0031] In the formula, the balance factor α controls the imbalance between positive and negative samples, the modulation coefficient γ controls the imbalance between easy and difficult samples, p is the label, and q is the prediction probability.
[0032] The Dice coefficient is defined as:
[0033]
[0034] Where X and Y represent the actual result and the predicted result, respectively.
[0035] Step 4: The algorithm is evaluated using five-fold cross-validation. The dataset is divided into five subsets. In each round of training, a different subset is selected as the validation set, and the rest are used as the training set. This process is repeated for five rounds. Evaluation metrics are recorded for each round of training, and the average of the five training rounds is calculated as the overall performance of the model. The entire training process is based on the PyTorch framework, and the input image is adjusted to 512×512 pixels. Data augmentation techniques include translation, flipping, Gaussian blur, and color gamut transformation. During training, the batch size used in the frozen backbone stage is 24, which is reduced to 12 in the unfrozen stage. The learning rate optimization strategy uses cosine annealing to gradually reduce the learning rate.
[0036] The beneficial technical effects of this invention are as follows:
[0037] First, the lightweight backbone network MobileNet v2 of this invention significantly reduces the number of model parameters and computational complexity, enabling efficient deployment on resource-constrained UAV equipment and meeting the strict computational resource limitations of actual inspection tasks. Second, the lightweight large-scale hollow spatial pyramid pooling module proposed in this invention enhances the model's ability to model narrow and long targets in power grid inspection scenarios, especially suitable for identifying slender targets such as transmission lines in complex backgrounds. Through grouped hybrid convolution and cross-attention pooling, the model's feature extraction capability in complex scenarios is effectively improved, reducing false positives and false negatives. Cross-attention wavelet fusion makes the information fusion between high- and low-level features more effective, preserving not only the spatial details of low-level features but also enhancing the expressive power of high-level features, significantly improving the model's multi-scale processing capability and segmentation accuracy. The full-dimensional dynamic convolution post-processing module in the decoder further improves the detail recovery of features, ensuring that the details of edges and small targets are preserved in the predicted output, improving the overall segmentation effect. Compared with mainstream semantic segmentation algorithms, this invention performs exceptionally well in accurately segmenting key targets in power systems, providing a more feasible solution for automated power grid inspection. Attached Figure Description
[0038] Figure 1 This is a schematic diagram of the lightweight semantic segmentation network structure of the present invention.
[0039] Figure 2 This is a schematic diagram of the grouped hybrid convolution process.
[0040] Figure 3 This is a diagram of the cross-shaped attention pooling layer network structure.
[0041] Figure 4 This is a network structure diagram of the cross-attention wavelet fusion module.
[0042] Figure 5 This is the network structure diagram of the dynamic convolution post-processing module.
[0043] Figure 6 These are the performance metrics obtained through cross-validation. Detailed Implementation
[0044] The present invention will be further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0045] This invention presents a lightweight semantic segmentation network for power grid inspection, specifically designed for semantic segmentation tasks in power grid inspection. Its architecture is as follows: Figure 1 As shown, an encoder-decoder architecture is adopted. In the encoder part, the raw data is input into the lightweight MobileNet v2 backbone network for feature extraction. The resulting feature map is input into the lightweight large-scale ASPP module for further multi-scale feature extraction of the high-dimensional feature map. This module includes a series of 1×1 convolutional layers, three groups of grouped hybrid convolutional layers with different dilation rates, and a set of cross-shaped attention pooling layers. In the decoder part, the high-dimensional and low-dimensional features obtained from the backbone network are respectively input into the cross-attention wavelet fusion module, which performs attention modeling on the spatial and channel dimensions and fuses the two parts of information. The resulting feature map is fused with the decoder output and then passed through the full-dimensional dynamic convolution post-processing module. The data is then restored to the original data size through downsampling to obtain the final prediction mask.
[0046] The principle of the grouped hybrid convolution process is as follows: Figure 2 As shown, assuming the number of input channels is M and the number of output channels is N, the specific steps of grouped hybrid convolution are as follows:
[0047] (1) 5×5 grouped convolution: The input feature map is divided into M groups, and a layer-by-layer convolution of size 5×5×1 is used for each channel to extract local features.
[0048] (2) 3×3 layer-by-layer dilated convolution: After group convolution, perform 3×3×1 layer-by-layer dilated convolution in parallel for each channel.
[0049] (3) Pointwise convolution: The feature maps of all channels are concatenated along the channel dimension, and 1×1×N pointwise convolution is applied to aggregate the information of different channels and adjust the number of channels.
[0050] like Figure 3The diagram shows a cross-shaped attention pooling layer structure. To compensate for feature loss caused by parallel dilated convolution, the original ASPP module compensates for global features using parallel global average pooling. This method averages and weights all pixels, inevitably introducing interference from irrelevant information. Long-range modeling methods, including dilated convolution and global average pooling, capture feature information within a square window, lacking the ability to model anisotropic contexts and effectively extracting narrow, elongated features during inspection. Therefore, a cross-shaped attention pooling layer was designed to replace global average pooling.
[0051] Given a two-dimensional tensor Pooling operations are performed using two mutually perpendicular strip pooling kernels along either the horizontal or vertical spatial dimension, with the horizontal SP output... for:
[0052]
[0053] Vertical SP output for:
[0054]
[0055] Horizontal and vertical bar pooling kernels capture row-wide and column-wide features, respectively, with sizes of H×1 and W×1. After one-dimensional convolution and expend operations, they are summed in place, restoring the feature map size to H×W. The generated tensor, after expansion and fusion, has attention to the narrow and long target in both horizontal and vertical directions. It is then multiplied by the original feature map to redistribute the feature weights.
[0056] like Figure 4 The diagram shows the structure of the cross-attention wavelet fusion module. It uses discrete wavelet transform to select high-frequency components from different directions to construct new feature maps, which are then concatenated with the original low-frequency components. The high-level feature map extracts channel information through an efficient channel attention mechanism to enhance high-dimensional feature representation. Given an input... After global average pooling without dimensionality reduction, it becomes To perform the convolution operation, the size is further adjusted to... After undergoing an adaptive one-dimensional convolution with kernel size k, there exists a non-linear mapping ψ between k and the channel dimension C:
[0057]
[0058] In the formula, τ odd Let represent the odd number closest to τ, and let γ and b be linear parameters, set to 2 and 1 respectively.
[0059] The low-dimensional features and high-dimensional features are multiplied by their ECA weights after the above operations, and then concatenated with the original high-dimensional features along the channel dimension. After adjusting the number of channels through a 1×1 convolution and upsampling, the final output is obtained.
[0060] like Figure 5 The diagram shows the structure of the dynamic convolution post-processing module. One branch introduces a learnable dynamic convolution module that dynamically adjusts the spatial dimension, channel dimension, shape, and size of the convolution kernel based on the features of the input data to adapt to different input data. Its mathematical expression is as follows:
[0061]
[0062] in This represents the attention scalar of the convolution kernel. These represent three newly introduced attention scalars, calculated along the input channel dimension and output channel dimension of the convolution kernel Wi kernel space, respectively.
[0063] In another branch, a spatial attention mechanism weighted by global feature information is used. First, global max pooling and global average pooling are used to aggregate the information of the feature maps, and then the information is added in pairs. Then, 3×3 convolution is used to aggregate the features to obtain the spatial feature weights of this branch. Then, the weights are multiplied by the corresponding pixels of the input feature map to obtain the output result. The output of the module is the result of the feature maps of the two branches being added in pairs, and then the channel information is adjusted by 1×1 convolution.
[0064] This invention discloses a semantic segmentation method for a lightweight semantic segmentation network used in power grid inspection. In the encoder stage, a MobileNet V2 backbone network is first used to extract features from the raw data. Then, the ASPP module is reconstructed into a lightweight, large-scale ASPP module. The high-dimensional feature maps are processed through parallel grouped hybrid convolution and cross-attention pooling to enhance the modeling ability for narrow and long targets while expanding the receptive field. In the decoder stage, cross-stage cross-attention wavelet fusion is introduced to combine low-level spatial information with high-level channel information. Through spatial attention mechanisms and Haar wavelet transform, high- and low-dimensional features are effectively fused, preserving detailed features and increasing the model's ability to process multi-scale features. This feature map is stacked with the multi-scale features output by the encoder. A full-dimensional dynamic convolution post-processing module is used to adaptively adjust the parameters of the convolution kernel in multiple dimensions. Combined with a globally weighted spatial attention mechanism, the model's feature representation and detail recovery capabilities are effectively improved. Data resolution is restored through bilinear interpolation to obtain a segmentation mask.
[0065] Specifically, the following steps are included:
[0066] Step 1: Construct a semantic segmentation dataset for power grid inspection scenarios. This dataset focuses on common narrow and elongated features and various backgrounds in power systems. The dataset is derived from open-source aerial photography data and high-resolution images collected by power grid companies during actual inspections, containing a total of 1426 images. Target objects are classified into categories such as transmission lines, wooden transmission poles, and reinforced concrete poles, and pixel-level segmentation masks are manually annotated.
[0067] Step 2: Initialize the weights of the MobileNet v2 backbone network to pre-trained weights from the ImageNet dataset using transfer learning techniques; the training process employs a frozen backbone strategy: lock the backbone network parameters for the first 50 training epochs to maintain the stability of the pre-trained weights, avoid destroying the existing feature structure in the early stages of training, and accelerate inference speed; after 50 epochs of frozen training, unfreeze the backbone network to allow it to participate in the weight update of the entire network. A low learning rate is used in this stage to ensure that the backbone network can gradually adapt to the features of the new data.
[0068] Step 3: To address the issue of imbalanced data categories during power grid inspections, a loss function combining Focal Loss and Dice coefficient fine-tuning was adopted. The mathematical expression of this loss function is as follows:
[0069]
[0070] In the formula, the balance factor α controls the imbalance between positive and negative samples, the modulation coefficient γ controls the imbalance between easy and difficult samples, p is the label, and q is the prediction probability.
[0071] The Dice coefficient is defined as:
[0072]
[0073] Where X and Y represent the actual result and the predicted result, respectively.
[0074] Focal Loss suppresses loss on common classes and imposes a greater penalty on unpredictable samples, thus mitigating the problem of imbalanced positive and negative samples. The Dice coefficient optimizes for region overlap in the model's segmentation results, ensuring reasonable segmentation performance even with very few samples. This loss function not only handles class imbalance but also reduces oscillations caused by error variations during training.
[0075] Step 4: The algorithm is evaluated using five-fold cross-validation. The dataset is divided into five subsets. In each training round, a different subset is selected as the validation set, and the rest are used as the training set. This process is repeated five times to ensure that every sample appears as a validation dataset, improving the model's generalization ability. Evaluation metrics are recorded for each training round, and the average of the five training rounds is calculated as the overall model performance. The entire training process is based on the PyTorch framework, with the input image adjusted to 512×512 pixels. Data augmentation techniques include translation, flipping, Gaussian blur, and color gamut transformation to improve the model's adaptability in different scenes. During training, the batch size used in the frozen backbone stage is 24, which is reduced to 12 in the unfrozen stage to balance memory consumption and performance improvement. The learning rate optimization strategy uses cosine annealing, gradually reducing the learning rate so that the model adjusts its pace as it approaches convergence, improving stability.
[0076] Model testing primarily uses metrics such as mIoU (mean intersection-to-union ratio) and mPA (mean pixel precision) to evaluate segmentation accuracy. Experimental results are as follows: Figure 6 As shown, five-fold cross-validation demonstrates that the model performs well in both accuracy and complexity, especially in the segmentation of narrow and long targets.
[0077] This invention improves the encoding / decoding structure of DeepLab v3+ and designs a lightweight feature extraction and fusion strategy, resulting in significant performance and advantages for the model in power grid inspection tasks. First, the lightweight backbone network MobileNet v2 significantly reduces the model's parameter count and computational complexity, enabling efficient deployment on resource-constrained UAVs and meeting the strict computational resource limitations of actual inspection tasks. Second, the proposed lightweight large-scale hollow spatial pyramid pooling module enhances the model's ability to model narrow and elongated targets in power grid inspection scenarios, particularly suitable for identifying slender targets such as transmission lines in complex backgrounds. Through grouped hybrid convolution and cross-attention pooling, the model's feature extraction capability in complex scenarios is effectively improved, reducing false positives and false negatives. Cross-attention wavelet fusion makes the information fusion between high- and low-level features more effective, preserving not only the spatial details of low-level features but also enhancing the expressive power of high-level features, significantly improving the model's multi-scale processing capability and segmentation accuracy. The full-dimensional dynamic convolution post-processing module in the decoder further improves the recovery of feature details, ensuring that details of edges and small targets are preserved in the predicted output, thus improving the overall segmentation effect. Compared with mainstream semantic segmentation algorithms, this invention performs exceptionally well in accurately segmenting key targets in power systems, providing a more feasible solution for automated power grid inspection.
Claims
1. A lightweight semantic segmentation network for power grid inspection, characterized in that: An encoder-decoder architecture is adopted. In the encoder part, the raw data is input into a lightweight MobileNet v2 backbone network for feature extraction. The resulting high-dimensional feature map is input into a lightweight, large-scale dilated spatial pyramid pooling (ASPP) module for further multi-scale feature extraction. This module includes a series of 1×1 convolutional layers, three groups of grouped hybrid convolutional layers with different dilation rates, and a set of cross-shaped attention pooling layers. In the decoder part, the original high-dimensional and low-dimensional features obtained from the backbone network are input into a cross-attention wavelet fusion module, which performs attention modeling on the spatial and channel dimensions and fuses the two parts of information. The resulting feature map is fused with the encoder output and then processed by a full-dimensional dynamic convolution post-processing module. The data is then upsampled to restore the original data size to obtain the final prediction mask. The cross-attention wavelet fusion module selects high-frequency components in different directions to construct a new feature map by using a discrete wavelet transform, and splices the new feature map with an original low-frequency component; the high-level feature map extracts channel information by an efficient channel attention mechanism to enhance high-dimensional feature expression, and given input , after global average pooling without dimension reduction, becomes , in order to perform convolution operation, the size is further adjusted to , and after adaptive one-dimensional convolution with a kernel size of k, k and the channel dimension exist a nonlinear mapping : (3) wherein represents the odd number closest to and are linear parameter terms, set to 2 and 1, respectively; The low-dimensional features and high-dimensional features are multiplied by their ECA weights after the above operations, and then concatenated with the original high-dimensional features along the channel dimension. After adjusting the number of channels through a 1×1 convolution and upsampling, the final output is obtained.
2. The lightweight semantic segmentation network for power grid inspection according to claim 1, characterized in that: The specific steps for performing grouped hybrid convolution in the grouped hybrid convolutional layer are as follows: Assume the number of input channels is M and the number of output channels is N; (1) 5×5 grouped convolution: The input feature map is divided into M groups, and a layer-by-layer convolution of size 5×5×1 is used for each channel; (2) 3×3 layer-by-layer dilated convolution: After group convolution, 3×3×1 layer-by-layer dilated convolution is performed in parallel for each channel; (3) Pointwise convolution: The feature maps of all channels are spliced together along the channel dimension, and 1×1×N pointwise convolution is applied to aggregate the information of different channels and adjust the number of channels.
3. The lightweight semantic segmentation network for power grid inspection according to claim 1, characterized in that: The specific process of the cross-shaped attention pooling layer is as follows: Given a two-dimensional tensor Pooling operations are performed using two mutually perpendicular strip pooling kernels along either the horizontal or vertical spatial dimension, with the horizontal SP output... for: (1) Vertical SP output for: (2) Horizontal and vertical bar pooling kernels capture row-wide and column-wide features, respectively, with sizes of H×1 and W×1. After one-dimensional convolution and expand operations, they are summed in place, restoring the feature map size to H×W. The generated tensor, after expansion and fusion, has attention to the narrow and long target in both horizontal and vertical directions. It is then multiplied by the original feature map to redistribute the feature weights.
4. A lightweight semantic segmentation network for power grid inspection according to claim 1, characterized in that: The dynamic convolution post-processing module introduces a learnable dynamic convolution module in one branch. This module dynamically adjusts the spatial dimension, channel dimension, shape, and size of the convolution kernel based on the features of the input data to adapt to different input data. Its mathematical expression is as follows: (4) in This represents the attention scalar of the convolution kernel. , , These represent three newly introduced attention scalars, calculated along the input channel dimension and output channel dimension of the convolution kernel Wi kernel space, respectively; In another branch, a spatial attention mechanism weighted by global feature information is used. First, global max pooling and global average pooling are used to aggregate the information of the feature maps, and then the information is added in pairs. Then, 3×3 convolution is used to aggregate the features to obtain the spatial feature weights of this branch. Then, the weights are multiplied by the corresponding pixels of the input feature map to obtain the output result. The output of the module is the result of the feature maps of the two branches being added in pairs, and then the channel information is adjusted by 1×1 convolution.
5. The semantic segmentation method for a lightweight semantic segmentation network for power grid inspection as described in claim 1, characterized in that, Includes the following steps: Step 1: Construct a semantic segmentation dataset for power grid inspection scenarios. This dataset focuses on common narrow and long features and various backgrounds in power systems. The dataset comes from open-source aerial photography data and high-resolution images collected by power grid companies during actual inspections, and contains a total of 1426 images. The target objects are classified into categories such as transmission lines, wooden transmission poles, and reinforced concrete poles, and pixel-level segmentation masks are manually annotated. Step 2: Initialize the weights of the backbone network MobileNet v2 with pre-trained weights from the ImageNet dataset using transfer learning techniques; The training process employs a frozen backbone strategy: the backbone network parameters are locked during the first 50 training rounds to maintain the stability of the pre-trained weights, avoid destroying the existing feature structure in the early stages of training, and speed up inference. After 50 rounds of frozen training, the backbone network is unfrozen to participate in the weight update of the entire network. A low learning rate is used in this stage to ensure that the backbone network can gradually adapt to the features of the new data. Step 3: To address the issue of imbalanced data categories during power grid inspections, a loss function combining Focal Loss and Dice coefficient fine-tuning was adopted. The mathematical expression of this loss function is as follows: (5) In the formula, the balance factor Controlling the imbalance between positive and negative samples, modulation coefficients To control the imbalance between easy and difficult samples, p is the label and q is the predicted probability; The Dice coefficient is defined as: (6) in and These represent the actual result and the predicted result, respectively. Step 4: The algorithm is evaluated using five-fold cross-validation. The dataset is divided into five subsets. In each round of training, a different subset is selected as the validation set, and the rest are used as the training set. This process is repeated for five rounds. Evaluation metrics are recorded for each round of training, and the average of the five training rounds is calculated as the overall performance of the model. The entire training process is based on the PyTorch framework, and the input image is adjusted to 512×512 pixels. Data augmentation techniques include translation, flipping, Gaussian blur, and color gamut transformation. During training, the batch size used in the frozen backbone phase of the model is 24, which is reduced to 12 in the unfrozen phase; the learning rate optimization strategy adopts cosine annealing to gradually reduce the learning rate.