Sample enhancement and lightweight deep learning model construction method and system in power distribution line defect identification
By employing a lightweight target detection model that combines adaptive contrast stretching and absolute coordinate grid fusion with knowledge distillation technology, the problem of sample scarcity and complex environments in power distribution line defect identification is solved, achieving high-precision and high-efficiency real-time detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ELECTRIC POWER RES INST OF EAST INNER MONGOLIA ELECTRIC POWER
- Filing Date
- 2025-12-26
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies for identifying defects in power distribution lines suffer from problems such as scarce samples, significant interference from complex environments, and high computational complexity of models, making it difficult to achieve high-precision and high-efficiency real-time detection.
A lightweight target detection model is constructed by using adaptive contrast stretching preprocessing and pixel-level absolute coordinate grid fusion. Combined with knowledge distillation method, it is deployed to embedded edge devices for real-time defect identification.
It significantly improves the model's ability to extract defect features under complex lighting conditions, achieving high-precision and high-efficiency identification of power distribution line defects, while reducing the requirements for computing resources and storage space.
Smart Images

Figure CN121788484B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and deep learning technology, and in particular to a method and system for sample augmentation and lightweight deep learning model construction in power distribution line defect identification. Background Technology
[0002] As a crucial component of the power system, the safe and stable operation of power distribution lines is of paramount importance. Traditional manual inspection methods are not only inefficient and costly, but also limited by the subjective experience of inspectors and environmental conditions, making it difficult to achieve round-the-clock, comprehensive defect detection.
[0003] In recent years, with the development of deep learning technology, automated defect recognition methods based on computer vision have become a research hotspot. However, applying deep learning models to power distribution line defect recognition still faces many challenges: First, real power distribution line defect samples are scarce and difficult to collect, leading to easy overfitting during model training; second, complex outdoor environments (such as changes in lighting and background interference) significantly affect image quality, increasing the difficulty of accurate recognition; third, existing high-performance deep learning models typically have high computational complexity and a large number of parameters, making it difficult to directly deploy them on embedded edge devices with limited computing resources and storage space to achieve real-time processing.
[0004] Currently, although some studies have attempted to compress models using techniques such as lightweight network structures or knowledge distillation, these methods often result in a significant decrease in accuracy during the compression process. Furthermore, most methods employ a single detection strategy (such as using only object detection or semantic segmentation), making it difficult to simultaneously balance localization accuracy and recognition efficiency, and thus unable to effectively address the diverse shapes of power distribution line components and the large variations in defect scale.
[0005] Therefore, there is an urgent need for a lightweight deep learning model construction method that can effectively enhance sample features while taking into account both high accuracy and high efficiency, in order to meet the practical engineering needs of real-time and accurate identification of power distribution line defects. Summary of the Invention
[0006] The present invention aims to solve the above-mentioned technical problems and provide a lightweight deep learning model construction method and system that can effectively enhance sample features while taking into account both high accuracy and high efficiency.
[0007] In a first aspect, embodiments of this application provide a method for sample augmentation and lightweight deep learning model construction in power distribution line defect identification, the method comprising:
[0008] An adaptive contrast stretching preprocessing is performed on the input power distribution line image to generate a normalized absolute coordinate grid. The coordinate grid is then stitched together with the preprocessed image in the channel dimension to form an enhanced input that incorporates pixel-level position information.
[0009] Based on the enhanced input, a lightweight object detection model is constructed and trained. The model includes a segmentation-based detection branch and a row classification-based detection branch. The two branches share a front-end feature extraction network and fuse information through a feature interaction module to simultaneously output pixel-level segmentation results and row classification prediction results.
[0010] The knowledge distillation method is used to transfer the knowledge of the trained lightweight object detection model to a more streamlined student model, using the model as a teacher model.
[0011] The segmentation results output by the student model are post-processed. The binary segmentation map is used to filter the pixels of the instance embedding feature map. The clustering algorithm is used to cluster the filtered pixels to obtain the independent instance segmentation results of each defect target. The row classification prediction results are then fused to verify and supplement the results.
[0012] The student model, after distillation and compression, is deployed to an embedded edge computing device for real-time defect identification and localization of power distribution line images.
[0013] Secondly, embodiments of this application provide a system for sample augmentation and lightweight deep learning model construction in power distribution line defect identification, applied to the method for sample augmentation and lightweight deep learning model construction in power distribution line defect identification as described in the first aspect, the system comprising:
[0014] The image preprocessing unit is configured to perform adaptive contrast stretching preprocessing on the input power distribution line image, generate a normalized absolute coordinate grid, and stitch the coordinate grid with the preprocessed image in the channel dimension to form an enhanced input that integrates pixel-level position information.
[0015] The model building and training unit is configured to build and train a lightweight object detection model based on the enhanced input; the model includes a segmentation-based detection branch and a row classification-based detection branch, the two branches share a front-end feature extraction network, and information is fused through a feature interaction module to simultaneously output pixel-level segmentation results and row classification prediction results;
[0016] The knowledge distillation compression unit is configured to use a knowledge distillation method to transfer the knowledge of the trained lightweight object detection model as a teacher model to a more streamlined student model.
[0017] The post-processing unit is configured to post-process the segmentation results output by the student model, filter the instance embedding feature map using the binary segmentation map, cluster the filtered pixels using a clustering algorithm to obtain the independent instance segmentation results for each defect target, and fuse the row classification prediction results for result verification and supplementation.
[0018] The deployment unit is configured to deploy the distilled and compressed student model to an embedded edge computing device for real-time defect identification and localization of power distribution line images.
[0019] Thirdly, embodiments of this application provide an electronic device, including:
[0020] processor;
[0021] Memory used to store processor-executable instructions;
[0022] The processor is configured to implement the sample augmentation and lightweight deep learning model construction method for power distribution line defect identification as described in the first aspect when executing the instructions.
[0023] Fourthly, embodiments of this application provide a computer-readable storage medium storing a program that instructs a device to execute the sample augmentation and lightweight deep learning model construction method for power distribution line defect identification as described in the first aspect.
[0024] This invention discloses a method and system for sample augmentation and lightweight deep learning model construction in power distribution line defect identification. The method includes: performing adaptive contrast stretching preprocessing on the input image and stitching normalized coordinate grids to enhance input information; constructing a lightweight detection model with two branches, one based on segmentation and the other on row classification, where the two branches share a partial feature extraction network and are fused through a feature interaction module to simultaneously output pixel-level segmentation results and row classification prediction results; employing a feature-response distillation method based on channel attention to transfer knowledge to a more streamlined student model; using a binary segmentation map to filter instance embedded features and performing mean-shift clustering to obtain independent instance segmentation results, which are then fused with row classification predictions for verification and supplementation; finally, deploying the compressed model to an embedded device to achieve real-time defect identification and localization. This invention effectively improves the detection accuracy and efficiency of the model in embedded environments.
[0025] Beneficial effects:
[0026] 1. Significantly improves model perception and localization accuracy: By integrating adaptive contrast stretching preprocessing with pixel-level absolute coordinate grids, the information richness of the input image is enhanced, effectively improving the model's ability to extract defect features under complex lighting conditions, and providing accurate prior information for target localization.
[0027] 2. Achieves an excellent balance between accuracy and efficiency: The innovative dual-branch (segmentation branch and row classification branch) fusion model architecture combines the precision of pixel-level analysis with the efficiency of row classification prediction. The design of sharing features and interactive fusion between the two branches significantly reduces the number of model parameters and computational complexity while ensuring high accuracy.
[0028] 3. Significantly improves model deployment and operation efficiency: By adopting knowledge distillation technology based on channel attention, the knowledge of the teacher model is successfully compressed into a lighter student model. Without losing performance, the model’s demand for computing resources and storage space is significantly reduced, enabling it to be efficiently deployed on embedded edge devices with limited computing power.
[0029] 4. Enhanced robustness and reliability of detection results: In the post-processing stage, by fusing pixel-level instance segmentation results and row classification predictions, and setting verification and supplementation rules, the prediction results of the two branches can be mutually corrected, effectively reducing missed detections and false detections, and finally outputting more reliable and comprehensive defect identification and location results. Attached Figure Description
[0030] Figure 1 This is a schematic diagram of the sample augmentation and lightweight deep learning model construction method for power distribution line defect identification provided in an embodiment of this application.
[0031] Figure 2 The system architecture diagram for sample augmentation and lightweight deep learning model construction in power distribution line defect identification provided in this application is shown.
[0032] Figure 3 A schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them.
[0034] It should be noted that in the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the specification of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application.
[0035] It should be noted that in the embodiments of this application, the terms "first," "second," etc., are used only for descriptive purposes and should not be construed as indicating or implying relative importance, nor as indicating or implying order. Features defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of the embodiments of this application, terms such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiments or designs described as exemplary or for example in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present related concepts in a specific manner.
[0036] Based on the embodiments described in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0037] Example 1
[0038] Figure 1 This is a schematic diagram illustrating the process of sample augmentation and lightweight deep learning model construction method for power distribution line defect identification according to an embodiment of this application. Figure 1 As shown, a method for sample augmentation and lightweight deep learning model construction in power distribution line defect identification includes:
[0039] S1. Adaptive contrast stretching preprocessing is performed on the input power distribution line image, and a normalized absolute coordinate grid is generated. This coordinate grid is then stitched with the preprocessed image along the channel dimension to form an enhanced input that incorporates pixel-level positional information. Input preprocessing enhances the quality of the input image and injects spatial positional information. Adaptive contrast stretching improves the image's visibility under complex lighting conditions and enhances the contrast of defect features. By generating and stitching the absolute coordinate grid, the model is provided with absolute positional information for each pixel, thereby significantly improving the model's geometric perception and spatial localization capabilities for defect targets.
[0040] Specifically, in this embodiment, the adaptive contrast stretching preprocessing in step S1 includes the following steps:
[0041] For any pixel to be processed in the input image, first determine a local neighborhood window centered on it, and then calculate the expected value of all pixel grayscale values within that window. with standard deviation The mathematical expectation The calculation formula is: ,in, Represents the number within the neighborhood window grayscale value of each pixel. This represents the total number of pixels within the window.
[0042] Determine the local neighborhood window and calculate the expectation. with standard deviation This is used for local statistical perception. For each pixel in the image to be processed, the gray-level distribution of its surrounding local region (neighborhood window) is analyzed. Mathematical expectation. This reflects the average brightness level of the area, with a standard deviation of [missing value]. This reflects the contrast or noise intensity of the region. This step aims to dynamically and adaptively acquire local features of the image, providing a basis for subsequent enhancement and avoiding uneven results for different regions from global processing.
[0043] Subsequently, based on the aforementioned mathematical expectation and standard deviation A nonlinear transformation function is constructed to calculate the enhanced output grayscale value of the pixel to be processed. The expression for the nonlinear transformation function is:
[0044] ;
[0045] in, This is the original input grayscale value of the pixel to be processed. This is a positive coefficient used to regulate the global enhancement intensity.
[0046] based on and Construct a nonlinear transformation function for adaptive nonlinear contrast mapping. Utilize the local statistics calculated in the previous step ( Using δ as parameters, a nonlinear transformation function of the sigmoid form is constructed. The core function of this function is to adaptively stretch or compress the grayscale value of a pixel based on the characteristics of the local region it belongs to. (Standard deviation) The steepness of the transformation curve at that point (contrast enhancement intensity) is automatically adjusted, achieving a smart effect of strong enhancement in areas with rich detail and weak enhancement in flat areas.
[0047] Calculate the output grayscale value Perform pixel-level enhancement transformation. This transforms the original input grayscale value of the pixel... Substituting the above nonlinear transformation function, the enhanced output value is calculated. This computational process ultimately achieves the goals of enhancing local image contrast, suppressing uniform background noise, and highlighting potential defect features, providing subsequent deep learning models with higher-quality and more distinctive input images.
[0048] The three steps described above constitute a complete and adaptive image preprocessing operator: Step 1 (Analysis): Observe the neighbor information of each pixel. Step 2 (Modeling): Determine the rules (transformation function) for modifying the pixel value based on the neighbor information. Step 3 (Execution): Apply the rules to calculate the new, enhanced value of the pixel. Through a nonlinear transformation based on local statistical properties, the visual quality and feature separability of the image are adaptively improved, thereby providing higher-quality input for subsequent defect detection models and fundamentally improving the model's performance under complex lighting and background conditions.
[0049] Specifically, in step S1, a normalized absolute coordinate grid is generated, and the coordinate grid is concatenated with the preprocessed image along the channel dimension. The specific implementation method is as follows:
[0050] First, based on the height H and width W of the input image, an X-axis coordinate matrix is generated. and a Y-axis coordinate matrix ;in, The value of each element is the column index of its corresponding column. The value of each element is its row index. This generates the X-axis coordinate matrix. and Y-axis coordinate matrix This is used to construct absolute positional encoding. Based on the width W and height H of the input image, two matrices with the same dimensions as the image are created. Each element of the matrix stores the column index (i.e., the x-coordinate) of its column. Each element of the matrix stores the row index (i.e., the y-coordinate) of its row. The purpose of this step is to explicitly represent the absolute spatial location of each pixel in the image in matrix form, providing geometric information for the model.
[0051] Subsequently, on the matrix and Normalization is performed, linearly transforming the coordinate values to the interval [-1, 1]; the calculation formula for the normalization process is as follows:
[0052] ,
[0053] .
[0054] For coordinate matrix and Normalization is performed to standardize and unify the coordinate values. The original coordinate index values (typically ranging from [0, W-1] to [0, H-1]) are mapped to the interval [-1, 1] through a linear transformation. The core purpose of normalization is to eliminate the influence of the specific image size (resolution), enabling the model to handle input images of different sizes. Simultaneously, it ensures that the coordinate data and the preprocessed image pixel values are within a similar numerical range, which is beneficial for stable model training and rapid convergence.
[0055] Finally, the normalized coordinate matrix and As two independent channels, they are concatenated with the preprocessed image tensor along the channel dimension to form the enhanced input tensor that fuses pixel-level positional information. The normalized coordinate matrix is concatenated with the image tensor along the channel dimension to fuse pixel value information and positional information. Specifically, the normalized position matrix ( and As two independent channels, these are concatenated with the contrast-stretched preprocessed image (typically a 3-channel RGB or a 1-channel grayscale image) along the channel dimension. This step ultimately generates an enhanced input tensor that integrates appearance features (texture, color) and spatial features (absolute position). Its function is to explicitly inject positional priors into the neural network, greatly enhancing the model's understanding of the target's geometry and spatial layout, thereby improving the accuracy of defect localization.
[0056] These three steps implement a complete workflow from generating location information to standardization and image fusion: Step 1 (Generation): Create two matrices containing the absolute position of each pixel. Step 2 (Normalization): Standardize the location data to a fixed range, making it applicable to different inputs and easy for the model to process. Step 3 (Synthesis): Fuse the location information as an additional channel with the image data to form an enriched model input. This provides the deep learning model with pixel-level absolute position prior knowledge, enabling the model not only to see the texture and color features of the image but also to know the specific location of each feature point in the image, thus significantly improving the model's performance in target localization and geometric shape perception. This is crucial for tasks requiring precise location of defects in power distribution lines.
[0057] S2. Based on the enhanced input from step S1, a lightweight object detection model is constructed. This lightweight model consists of a segmentation-based detection branch and a row classification-based detection branch. The two branches share a portion of the front-end feature extraction network and fuse information through a feature interaction module to simultaneously output pixel-level segmentation results and row classification prediction results. This lightweight model construction results in an efficient and accurate dual-branch fusion detection model. A segmentation-based branch enables precise pixel-level defect localization and instance differentiation, while a row classification-based branch quickly predicts the presence and category of defects in each row of the image. The two branches share front-end features and fuse information through the feature interaction module, thus maintaining a lightweight design while balancing detection accuracy (from the segmentation branch) and speed (from the row classification branch).
[0058] Specifically, in this embodiment, the segmentation-based detection branch in S2 is an encoder-decoder structure, which includes:
[0059] The encoder performs multi-level feature extraction on the input augmented image. Its front end consists of multiple stacked GhostConv convolutional layers, and its back end consists of multiple stacked multi-directional point-by-point product attention modules (GMPPA modules). The encoder is used for multi-level feature extraction and dimensionality reduction. As the front end of the branch, it performs layer-by-layer convolution and downsampling operations on the input augmented image. Its core function is to extract multi-scale abstract features from the input image, from low to high and from fine to coarse. Low-level features contain rich detailed information (such as edges and textures), while high-level features contain strong semantic information (such as object category and component composition). This process compresses the data size and reduces computational cost while extracting features.
[0060] The decoder is used to upsample and fuse the features extracted by the encoder to restore spatial resolution. Its front end consists of multiple GMPPA modules, and its back end consists of multiple bilateral upsampling decoding modules (BI_Trans modules). The decoder is used for upsampling and feature fusion to restore resolution. As a branch of the back end, its function is the opposite of the encoder. Through upsampling operations, it gradually restores the low-resolution high-level feature map output by the encoder to the spatial resolution of the original input image. In this process, it is necessary to effectively fuse features from different levels of the encoder to replenish the detailed information lost during dimensionality reduction while restoring the size, preparing for pixel-level prediction.
[0061] The Multi-Scale Mask High-Low Dimension Fusion (MHLM) module connects the encoder and decoder, fusing high-level semantic features from the encoder output, multi-scale mask information from the decoder, and low-level detail features from previous encoder stages. This module facilitates cross-level and cross-resolution feature aggregation. Specifically, it acts as a feature fusion hub, selectively fusing information from three sources: 1) high-level semantic features from the encoder output; 2) multi-scale mask information from the decoder; and 3) low-level detail features from previous encoder stages. This fusion overcomes the limitations of single-scale features, enhancing the model's ability to perceive defects of different sizes and improving the fineness of segmentation boundaries.
[0062] The output head, connected to the decoder, generates the final prediction output. It produces two prediction maps in parallel: a binary segmentation map to distinguish foreground from background, and an instance embedding feature map to distinguish different instances. The output head generates the final pixel-level prediction output. Connected to the decoder, its function is to map the full-resolution features recovered by the decoder to the final prediction task. It generates two prediction maps in parallel: a binary segmentation map for classifying each pixel as foreground (defect) or background, and an instance embedding feature map to generate a high-dimensional feature vector for each foreground pixel. This ensures that the feature vectors of pixels belonging to the same instance are spatially clustered, separating different instances and providing a basis for subsequent instance segmentation.
[0063] These four components constitute a powerful instance segmentation pipeline: the encoder is the feature extractor, responsible for understanding the image content. The decoder is the resolution restorer, responsible for mapping the understood content back to the original image size. The MHLM module is the information fusion module, responsible for coordinating information from different levels of abstraction, combining their strengths and compensating for their weaknesses. The output head is the predictor, responsible for outputting the model's judgment (whether it is a defect) and classification (which defect it belongs to) for each pixel. Achieving pixel-level defect localization, segmentation, and instance differentiation, providing high-quality binary segmentation results and instance embedding features for subsequent clustering post-processing, is the core component for achieving high-precision defect recognition.
[0064] Specifically, in this embodiment, the row-based detection branch in S2 includes:
[0065] The feature extraction backbone network, based on a lightweight ResNet architecture, is used to extract multi-level feature maps from the input image. An improved channel and spatial attention module (NCPCA module) is embedded in multiple residual blocks to enhance the network's focus on important features in the channel and spatial dimensions. This backbone network is used for multi-level general feature extraction. As the foundation of the branches, its core function is to efficiently extract multi-level feature maps with rich semantic information from the input image. These features form the basis of all subsequent tasks. By embedding attention modules in the residual blocks, it enhances the ability to focus on important features in the channel and spatial dimensions, better capturing key information related to defects and suppressing irrelevant background interference.
[0066] The multi-scale feature fusion module, specifically the Deep Dynamic Connection Pyramid (DSPPM) module, connects its input to the output of the feature extraction backbone network. It fuses multi-level features extracted by the backbone network to enhance the model's ability to perceive multi-scale targets. The DSPPM module aggregates multi-scale contextual information. It receives multi-level features (typically containing different resolutions) extracted by the backbone network, and its core function is to deeply fuse these features at different scales. By aggregating features containing information from different receptive fields, the model's ability to perceive defective targets with large scale variations is greatly enhanced, ensuring that both large and small targets can be effectively detected.
[0067] The row classification prediction head, whose input is connected to the output of the multi-scale feature fusion module, is used to convert the feature map into classification predictions at predefined row anchors. It outputs the probability distribution of whether a target exists and its category at each preset position in each row of the image. This row classification prediction head transforms the detection problem into a classification task at row anchors. This is the core output unit of this branch. Its function is to convert the fused feature map into classification predictions at predefined row anchor positions. Instead of directly predicting bounding boxes, it predicts whether a target exists and its category at each preset position in each row of the image. This method simplifies the target detection problem into a series of row-level classification problems, significantly improving detection speed, and is particularly suitable for defects in power distribution lines with a certain horizontal orientation.
[0068] An auxiliary segmentation head, whose input is connected to the middle or end layers of the feature extraction backbone network, generates an auxiliary semantic segmentation map. This segmentation map undergoes supervised learning using a weighted cross-entropy loss function to optimize the feature extraction process and alleviate the imbalance between positive and negative samples. The auxiliary segmentation head is used to optimize feature learning through an auxiliary task. This module is an auxiliary output unit that generates a pixel-level semantic segmentation map (typically distinguishing only foreground and background). This additional, finer-grained pixel-level supervision signal (using weighted loss to alleviate sample imbalance) forces the feature extraction backbone network to learn features more suitable for the segmentation task, thereby indirectly optimizing and enriching the representational power of the backbone features and improving the performance of the main task (row classification).
[0069] These four components constitute an efficient and accurate row classification and detection pipeline: the backbone network is the feature architect, responsible for extracting high-quality basic features. The fusion module is the scale integrator, responsible for enabling features to have multi-scale perception capabilities. The prediction head is the core decision-maker, outputting the final classification and detection results in an efficient manner. The auxiliary head is the feature optimizer, improving the performance of the main task from the side by assisting in auxiliary tasks. Its overall function is to provide a fast and efficient defect detection and classification method, complementing the segmentation-based branch.
[0070] Specifically, in this embodiment, the lightweight object detection model further includes a decision fusion module, which is used to fuse the pixel-level segmentation result output by the segmentation-based detection branch with the row classification prediction result output by the row classification-based detection branch, and output the final object detection result.
[0071] The execution logic of the decision fusion module includes: if the confidence level of the row classification prediction result at a specific row anchor position is higher than a first preset threshold, then the row classification prediction result is adopted as the final detection result at that position; if the pixel-level segmentation result is determined to be a foreground target in a specific spatial region, and the confidence level of the row classification prediction result in the corresponding region is lower than a second preset threshold, then the pixel-level segmentation result of that region is adopted, and the bounding box of the target is generated as the final detection result through clustering post-processing.
[0072] The rule for adopting high-confidence row classification results prioritizes efficient and reliable classification results. When the confidence level of the class output by the row classification branch at a specific row anchor position is higher than the first preset threshold, this rule directly adopts this result as the final detection result for that position. This rule fully leverages the advantages of the row classification branch—its speed and clear classification confidence. For deficiencies with clear classification and significant features, directly using the row classification results allows for rapid conclusion output, improving system efficiency. The rule for adopting and remediating pixel segmentation results in low-confidence regions utilizes pixel-level accuracy to compensate for the shortcomings of the classification branch. When the prediction confidence of the row classification branch for a certain region is low (below the second preset threshold), but the segmentation branch detects a foreground target in that region, this rule is activated. Its function is to trust the pixel-level perception capability of the segmentation branch, adopt the pixel-level segmentation result for that region, and generate the target's bounding box as the final output through clustering post-processing. The core function of this rule is to correct potential missed detections or false detections due to low confidence in the row classification branch, using the high localization accuracy of the segmentation branch for remediation, thereby significantly improving the system's recall and robustness.
[0073] These two rules define an intelligent decision-making arbitration mechanism: the first rule is the efficiency-first principle: for clear judgments, the result of the fast classifier is trusted. The second rule is the accuracy-compensation principle: when the fast classifier hesitates, a more accurate but slightly slower fine segmenter is activated for verification and compensation. Its overall function is to collaboratively utilize the respective advantages of the two branches (efficiency of row classification and accuracy of segmentation) to achieve intelligent result fusion and arbitration. This module acts like a decision-making brain, dynamically deciding which result to adopt as the final output based on the confidence levels of the two branches, thereby achieving an optimal balance between detection speed and accuracy, ensuring that the final output is both reliable and comprehensive.
[0074] S3. Employing a feature-response distillation method based on channel attention, the complete fusion model trained in step S2 is used as the teacher model, and its knowledge is transferred to a more streamlined student model to further improve model efficiency. Knowledge distillation compression further reduces model size and improves inference speed. The knowledge learned from the powerful but parameter-intensive complete model (teacher model) trained in step S2 is transferred to a simpler model with fewer parameters (student model). This is a model compression technique designed to significantly reduce model size and computational overhead with minimal performance loss, laying the foundation for embedded deployment.
[0075] Specifically, in this embodiment, the segmentation-based detection branch is optimized by minimizing a hybrid objective function; the hybrid objective function Foreground / background separation loss Together with the instance discrimination loss, it constitutes the expression:
[0076] ,
[0077] in, Foreground / background separation loss; For instance discrimination loss, the intra-cluster variance loss is used. Inter-cluster distance loss is used in instance discrimination loss. Mixed objective function. The structure is used for jointly optimizing segmentation and instance discrimination tasks. This function combines the foreground / background separation loss ( ) and instance discrimination loss ( The core function is to serve as a unified multi-task learning framework, simultaneously guiding the model to learn how to distinguish foreground / background and how to correctly cluster foreground pixels into different instances through a single loss function. This ensures that the network can simultaneously optimize pixel-level classification and instance-level grouping during training.
[0078] Wherein, the foreground-background separation loss To focus on Tanversky's losses With Sorenson-Dyes lost Weighted by depth The weighted sum is calculated using the following formula:
[0079] ,
[0080] in, This represents the number of output levels of the decoder; For hierarchical indexes; Representing the The true label of the layer; Representing the The predicted value of the layer; Representing the Depth weights corresponding to layers.
[0081] Foreground / background separation loss Used to accurately guide pixel-level foreground / background classification. This loss is the Focus Tanfsky loss (…). ) and Sorenson-Dyes loss ( The weighted sum of ). (An improved Focal Loss) focuses on pixels that are difficult to classify, thus alleviating the foreground-background class imbalance problem; The function of (Dice Loss) is to optimize the segmentation boundary and improve the overlap between the predicted mask and the ground truth mask in the region. The two together ensure the prediction accuracy of the binary segmentation map.
[0082] The instance discrimination loss is composed of intra-cluster variance loss. and inter-cluster distance loss The summation constitutes the variance loss within the cluster. The calculation formula is:
[0083] ,
[0084] in, This represents the total number of categories of defects in the power distribution lines. Indexed by category; To belong to category The total number of pixels; For pixel index; To belong to category The Feature vector of 1 pixel; For category The mean vector of all pixel feature vectors in the vector; This is a preset intra-cluster distance threshold; express .
[0085] Intra-cluster variance loss This loss is used to reduce the feature distance between pixels within the same instance. The loss calculates the feature vectors of all pixels belonging to the same defect category c and their mean vector. The distance is set, and those exceeding a preset threshold are penalized. The function of this is to drive the model to map pixels within the same instance to a compact cluster in the embedding space, thereby reducing feature differences within instances and facilitating subsequent clustering.
[0086] Inter-cluster distance loss The calculation formula is:
[0087] ,
[0088] in, Indexed by category; For category The mean vector of all pixel feature vectors in the vector; This is the preset inter-cluster distance threshold.
[0089] Inter-cluster distance loss This loss is used to increase the feature distance between pixels of different instances. It calculates the mean vector of different defect categories (c and k). and The distance between them is considered, and penalties are imposed on those whose distance is less than a preset threshold. The category pairs. Their function is to drive the model to map pixels of different instances to different clusters that are far apart in the embedding space, thereby increasing the feature differences between different instances and preventing confusion during clustering.
[0090] The loss function design enables end-to-end instance segmentation learning: Ensure the model can accurately identify all foreground pixels from the background. Ensure that all pixels with the same defect are aligned (highly similar in features). This ensures that different defective targets maintain a distance (with significantly different features). This hybrid objective function indirectly guides the model to learn a good embedding space. In this space, the embedding features of pixels are not only semantically correct (whether they are foreground or background) but also have clearly defined instance attributes (which instance they belong to). This provides high-quality feature input for subsequent unsupervised clustering operations (such as mean shift), which is crucial for ultimately achieving successful instance segmentation.
[0091] S4. For the segmentation results output by the student model, the binary segmentation map is used to filter pixels in the instance embedding feature map, and the mean-shift clustering algorithm is used to cluster the filtered pixels to obtain an independent instance segmentation result for each defect target. Simultaneously, the prediction results from the row classification branch are fused for result verification and supplementation. Through post-instancement processing, the original results output by the model are optimized to generate a final reliable detection result. Foreground pixels are filtered out using the binary map output by the segmentation branch, and then these pixels are grouped using a clustering algorithm to obtain an independent instance mask (instance segmentation) for each defect. At the same time, the prediction results from the row classification branch are fused to verify (avoid false detections) and supplement (avoid missed detections) the instances generated by clustering, greatly improving the robustness and accuracy of the final output result.
[0092] Specifically, in this embodiment, the feature-response distillation method based on channel attention described in step S3 has a loss function composed of both feature distillation loss and response distillation loss; the feature distillation loss ( The response distillation loss is obtained by calculating the difference between the intermediate layer feature maps of the student network and the teacher network after channel attention weighting; The total loss function of the knowledge distillation process is obtained by calculating the KL divergence between the probability distributions of the student network and the teacher network output layers after softening with temperature parameters. )for: ,in, For students' online task loss on real-world labels, Hyperparameters are used to balance the weights of each loss term.
[0093] Total loss function The structure is used to balance knowledge transfer and task performance. This loss function incorporates the student model's task loss on the real labels (…). ), and the response distillation loss of the teacher model ( ) and characteristic distillation losses ( It combines data by weight. Its core function is to serve as a multi-objective optimization framework, ensuring the performance of the student model on its own tasks while forcing it to mimic the output behavior (response) and intermediate feature representation (features) of the teacher model, thereby achieving effective knowledge transfer.
[0094] The characteristic distillation loss ( The specific calculation process includes: for a pair of corresponding teacher layer and student layer feature maps, perform global average pooling operation on them respectively to obtain channel description vectors;
[0095] The channel description vector is input into an attention network consisting of two fully connected layers to generate channel attention weights; the generated channel attention weights are then used to weight the feature maps of the original teacher layer and student layer.
[0096] The mean squared error (MSE) between the weighted feature maps of the teacher layer and the student layer is calculated and used as the feature distillation loss for that layer pair.
[0097] Characteristic distillation loss The calculation of this loss is used to force students to imitate the teacher's feature representations. This loss is obtained by calculating the mean squared error (MSE) of the intermediate layer feature maps of the student and teacher networks after channel attention weighting. Its function is to guide the student network to learn the semantically rich feature patterns extracted by the teacher network. The purpose of introducing channel attention weights is to focus on imitating the feature channels that are important to the task, achieving more efficient and targeted feature knowledge transfer.
[0098] The response distillation loss ( The specific calculation process includes: using the temperature parameter τ to soften the logits of the teacher network and the student network to obtain the probability distribution of softening;
[0099] The formula for calculating the softening probability distribution is: ,in, For logical output values;
[0100] The KL divergence between the softening probability distributions of the teacher network and the student network is calculated as the response distillation loss.
[0101] Response to distillation loss The calculation of this loss is used to force students to imitate the teacher's output decisions. This loss softens the probability distributions of the teacher's and students' logits through a temperature parameter τ, and calculates the KL divergence between them. Its function is to make the final output probability distribution of the student network as close as possible to the teacher's network. The temperature parameter τ controls the degree of softening; τ>1 produces a smoother probability distribution rich in hidden knowledge, revealing the similarity between categories and enabling students to learn the teacher's more abstract decision-making logic.
[0102] The student network is a simplified version of the teacher network structure, achieved by reducing network depth and width or using more lightweight convolutional modules. The student model serves as a carrier for knowledge transfer, enabling model compression. The student model is a simplified version of the teacher model, implemented by reducing network depth and width or using more lightweight convolutional modules. Its function is to serve as a replacement model with fewer parameters and lower computational cost. By reproducing the knowledge of the complex teacher model within a simplified structure, a significant reduction in model size and computational overhead is ultimately achieved with minimal performance loss.
[0103] The distillation method described above is a systematic model compression technique, in which, Responsible for transferring procedural knowledge (how to extract features). Responsible for transferring outcome-based knowledge (how to make decisions). Ensure no loss of basic performance. The student structure is a compressed implementation. The rich knowledge (feature representations and decision logic) contained in the large teacher model is efficiently and selectively transferred to a lightweight student model, thereby obtaining a fast and compact model more suitable for embedded deployment while maintaining model accuracy to the maximum extent.
[0104] S5. Deploy the final student model, after distillation and compression in step S3, to an embedded edge computing device for real-time defect identification and localization of power distribution line images. This embedded deployment applies the algorithm to real-world engineering scenarios. The final model, optimized and compressed through the aforementioned steps, is deployed to embedded edge devices with limited computing resources (such as drones, inspection robots, and monitoring equipment) to achieve real-time, on-site analysis of power distribution line defects, completing the closed loop from technical solution to practical application.
[0105] Specifically, in this embodiment, the process of deploying the model to the embedded edge computing device in step S5 includes: converting the student model into an inference engine format supported by the embedded device; accelerating the model inference process using the hardware acceleration interface provided by the device; deploying a lightweight image acquisition and preprocessing module on the device to receive and process the input power distribution line images; and outputting the model recognition and positioning results through the device's data transmission interface.
[0106] This invention enhances the model's feature extraction capability and localization accuracy in complex environments through adaptive contrast stretching and coordinate grid fusion; the dual-branch fusion model architecture combines the precision of pixel-level analysis with the efficiency of row classification prediction, achieving a balance between accuracy and efficiency; the knowledge distillation technique based on channel attention significantly reduces model complexity while ensuring accuracy; and the dual-branch result fusion in the post-processing stage effectively reduces missed detections and false detections, improving the reliability of detection results.
[0107] Example 2
[0108] like Figure 2 As shown, this application provides a system architecture diagram for sample augmentation and lightweight deep learning model construction in power distribution line defect identification. It is applied to the sample augmentation and lightweight deep learning model construction system for power distribution line defect identification as described in Embodiment 1, including an image preprocessing unit 11, a model construction and training unit 12, a knowledge distillation and compression unit 13, a post-processing unit 14, and a deployment unit 15.
[0109] The image preprocessing unit 11 is configured to perform adaptive contrast stretching preprocessing on the input power distribution line image, generate a normalized absolute coordinate grid, and stitch the coordinate grid with the preprocessed image in the channel dimension to form an enhanced input that integrates pixel-level position information.
[0110] The model building and training unit 12 is configured to build and train a lightweight object detection model based on the enhanced input. The model includes a segmentation-based detection branch and a row classification-based detection branch. The two branches share a front-end feature extraction network and fuse information through a feature interaction module to simultaneously output pixel-level segmentation results and row classification prediction results.
[0111] The knowledge distillation compression unit 13 is configured to use a knowledge distillation method to transfer the knowledge of the trained lightweight object detection model to a more streamlined student model, using the model as a teacher model.
[0112] The post-processing unit 14 is configured to post-process the segmentation results output by the student model, filter the instance embedding feature map using the binary segmentation map, cluster the filtered pixels using a clustering algorithm to obtain the independent instance segmentation results for each defect target, and fuse the row classification prediction results for result verification and supplementation.
[0113] Deployment unit 15 is configured to deploy the distilled and compressed student model to an embedded edge computing device for real-time defect identification and localization of power distribution line images.
[0114] Figure 3 This is an electronic device provided in one embodiment of this application. For example... Figure 3 As shown, the electronic device includes at least the following components: processor 101 and memory 100, communication interface 103, and bus 102.
[0115] In this embodiment of the application, memory 100 is used to store executable instructions of processor 101, which, when configured to execute instructions, implements the method as described in the first aspect.
[0116] In embodiments of this application, a computer-readable storage medium includes instructions that instruct a device to perform the method as described in the first aspect. For example, the instructions instruct the device to perform... Figure 1 The method is shown in the process steps.
[0117] In one embodiment of this application, the program operating in the electronic device may be a program that controls a central processing unit (CPU) or similar device to achieve the functions of the above-described embodiments of the present invention (a program that enables the computer to function). Information processed by these systems is then temporarily stored in random access memory (RAM) during processing, and subsequently stored in various ROMs such as read-only memory (FlashROM) and hard disk drives (HDDs), and read, corrected, and written by the CPU as needed.
[0118] It should be noted that a portion of the electronic device described above can also be implemented using a computer. In this case, the program for implementing the control function can be recorded on a computer-readable recording medium, and the program recorded on the recording medium can be read into the computer and executed.
[0119] It should be noted that the computer mentioned here refers to a computer built into an electronic device, employing hardware including an operating system and peripheral devices. Furthermore, computer-readable recording media refers to removable media such as floppy disks, magneto-optical disks, ROMs, and CD-ROMs, as well as storage systems such as hard drives built into the computer.
[0120] Furthermore, computer-readable recording media can include: media that dynamically stores programs for short periods of time, such as communication lines used when transmitting programs via networks like the Internet or communication lines like telephone lines; and media that store programs for fixed periods of time, such as volatile memory inside a computer that serves as a server or client in this case. In addition, the aforementioned program can be a program used to implement the above-mentioned functions, or it can be a program that can implement the above-mentioned functions by combining them with programs already recorded in the computer.
[0121] Furthermore, the electronic device in the above embodiments can also be implemented as an assembly (system group) composed of multiple systems. Each system constituting the system group can possess some or all of the functions or functional blocks of the electronic device in the above embodiments. As a system group, it is sufficient to have all the functions or functional blocks of the electronic device.
[0122] Those skilled in the art should recognize that the above embodiments are only used to illustrate this application and are not intended to limit this application. Any appropriate changes and variations made to the above embodiments within the essential spirit and scope of this application fall within the scope of protection claimed in this application.
Claims
1. A method for sample enhancement and lightweight deep learning model construction in power distribution line defect identification, characterized in that, Includes the following steps: An adaptive contrast stretching preprocessing is performed on the input power distribution line image to generate a normalized absolute coordinate grid. The coordinate grid is then stitched together with the preprocessed image in the channel dimension to form an enhanced input that incorporates pixel-level position information. Based on the enhanced input, a lightweight object detection model is constructed and trained. The model includes a segmentation-based detection branch and a row classification-based detection branch. The two branches share a front-end feature extraction network and fuse information through a feature interaction module to simultaneously output pixel-level segmentation results and row classification prediction results. The segmentation-based detection branch is an encoder-decoder structure, including: An encoder is used to extract multi-level features from an input enhanced image; The decoder is used to upsample and fuse the features extracted by the encoder to restore spatial resolution; The multi-scale mask high-low dimension fusion module is connected between the encoder and the decoder. It is used to fuse the high-level semantic features output by the encoder, the multi-scale mask information provided by the decoder, and the low-level detail features from the previous stage of the encoder. The output head, connected to the end of the decoder, is used to generate two prediction maps in parallel: one is a binary segmentation map to distinguish between the foreground and the background, and the other is an instance embedding feature map to distinguish between different instances. The knowledge distillation method is used to transfer the knowledge of the trained lightweight object detection model to a more streamlined student model, using the model as a teacher model. The segmentation results output by the student model are post-processed. The binary segmentation map is used to filter the pixels of the instance embedding feature map. The clustering algorithm is used to cluster the filtered pixels to obtain the independent instance segmentation results of each defect target. The row classification prediction results are then fused to verify and supplement the results. The student model, after distillation and compression, is deployed to an embedded edge computing device for real-time defect identification and localization of power distribution line images.
2. The sample enhancement and lightweight deep learning model construction method in power distribution line defect identification according to claim 1, characterized in that, The adaptive contrast stretching preprocessing includes: For each pixel to be processed in the input image, a local neighborhood window centered on it is determined, and the expected value of all pixel grayscale values within that window is calculated. with standard deviation ; Based on the mathematical expectation and standard deviation The enhanced output grayscale value of the pixel to be processed is calculated using a nonlinear transformation function. ; The nonlinear transformation function is: ; wherein, is the original input gray value of the pixel to be processed, is a positive coefficient for regulating the global enhancement intensity.
3. The sample enhancement and lightweight deep learning model construction method in power distribution line defect identification according to claim 1 or 2, characterized in that, The process of generating a normalized absolute coordinate grid and stitching it with the preprocessed image includes: Generate the X-axis coordinate matrix based on the height H and width W of the input image. and Y-axis coordinate matrix ,in The value of each element is its column index. The value of each element in the array is its row index. For the coordinate matrix and Normalization is performed to linearly transform the coordinate values to the interval [-1, 1]. The normalized coordinate matrix and As two independent channels, the pre-processed image tensor is spliced in the channel dimension to form the enhanced input tensor fused with pixel-level position information.
4. The sample enhancement and lightweight deep learning model construction method in power distribution line defect identification according to claim 1, characterized in that, The row-based classification-based detection branch includes: A feature extraction backbone network is used to extract multi-level feature maps from the input image; A multi-scale feature fusion module is connected to the output of the feature extraction backbone network and is used to fuse the extracted multi-level features to enhance the multi-scale target perception capability. The row classification prediction head is connected to the output of the multi-scale feature fusion module and is used to convert the feature map into a classification prediction on the row anchor, outputting the probability distribution of whether a target and its category exist at a preset row position in the image; An auxiliary segmentation head, connected to the output of the feature extraction backbone network, is used to generate an auxiliary semantic segmentation map to optimize the feature extraction process and alleviate the problem of imbalance between positive and negative samples.
5. The method for sample augmentation and lightweight deep learning model construction in power distribution line defect identification according to claim 1, characterized in that, The method further includes fusing the pixel-level segmentation result output by the segmentation-based detection branch with the row classification prediction result output by the row classification-based detection branch through a decision fusion module, and outputting the final target detection result. The execution logic of the decision fusion module includes: If the confidence level of the row classification prediction result at a certain row anchor position is higher than the first preset threshold, then the row classification prediction result is adopted as the final detection result at that position. If the pixel-level segmentation result is determined to be a foreground target in a certain spatial region, and the confidence level of the row classification prediction result in the corresponding region is lower than the second preset threshold, then the pixel-level segmentation result of that region is adopted, and the bounding box of the target is generated as the final detection result through clustering post-processing.
6. The method for sample augmentation and lightweight deep learning model construction in power distribution line defect identification according to claim 1 or 5, characterized in that, The segmentation-based detection branch minimizes the mixture objective function. To optimize, the hybrid objective function is composed of foreground / background separation loss. Together with the instance discrimination loss, it constitutes the expression: , in, Foreground / background separation loss; For instance discrimination loss, the intra-cluster variance loss is used. Inter-cluster distance loss is used to identify instances in the discrimination loss. The foreground-background separation loss To focus on Tanversky's losses With Sorenson-Dyes lost Weighted by depth The weighted sum is calculated using the following formula: , in, This represents the number of output levels of the decoder; For hierarchical indexes; Representing the The true label of the layer; Representing the The predicted value of the layer; Representing the The depth weights corresponding to the layers; the intra-cluster variance loss The formula for calculating the intra-cluster variance loss is: , in, This represents the total number of categories of defects in the power distribution lines. Indexed by category; To belong to category The total number of pixels; For pixel index; To belong to category The Feature vector of 1 pixel; For category The mean vector of all pixel feature vectors in the vector; This is a preset intra-cluster distance threshold; express ; The inter-cluster distance loss The calculation formula is: , in, Indexed by category; For category The mean vector of all pixel feature vectors in the vector; This is the preset inter-cluster distance threshold.
7. The sample enhancement and lightweight deep learning model construction method in power distribution line defect identification according to claim 1, characterized in that, The feature-response distillation method based on channel attention has a total loss function. Loss due to mission Characteristic distillation losses and response distillation loss Together they form the expression: , in, The task loss of the student model on the real labels; Hyperparameters are used to balance the weights of each loss term; the characteristic distillation loss is calculated by the process: For a pair of corresponding teacher and student layer feature maps, calculate their mean squared error after channel attention weighting as the feature distillation loss of that layer. The response distillation loss This is calculated by the process: Using a temperature parameter τ on the logical outputs of the teacher and student networks Softening is performed to obtain a softened probability distribution The formula is: , wherein, is the logic output value; τ is a temperature parameter, used to control the degree of softening of the probability distribution; Calculate the KL divergence between the softening probability distributions of the teacher network and the student network as the response distillation loss; The structure of the student model is a simplified version of the structure of the teacher model. 8.The method of claim 1, wherein the method is characterized by, The process of using a binary segmentation map to perform pixel filtering on the instance embedding feature map includes: Setting a confidence threshold ; Iterate through each pixel position in the binary segmentation image. If the predicted value at that pixel position is greater than... If the pixel is determined to be a foreground target, its embedding vector at the corresponding position in the instance embedding feature map is retained. If the predicted value at that pixel location is less than or equal to If the pixel is not found to be part of the background, it will be removed from subsequent clustering processes. The mean-shift clustering algorithm is used to cluster the filtered pixels, and its kernel function is... Using the Gaussian kernel function, it is expressed as: , wherein, is a vector in the feature space; is a bandwidth parameter of the algorithm, controlling the size of the clustering kernel window; The rules for validating and supplementing the prediction results of the fusion row classification branch include: Validation rule: For each cluster generated by clustering, if at least one row of classification prediction results indicates that the target location falls within the bounding box region of that cluster, and its class confidence is higher than the validation threshold. If so, the detection result of that cluster is confirmed as valid; Supplementary rule: For row classification prediction results with a confidence level higher than the supplementary threshold If the target's indicated location does not fall within the bounding box region of any existing cluster, a supplementary detection bounding box is generated centered on its indicated location, based on the preset default target size.
9. A system for sample augmentation and lightweight deep learning model construction in power distribution line defect identification, applied to the method for sample augmentation and lightweight deep learning model construction in power distribution line defect identification as described in any one of claims 1 to 8, characterized in that, The system includes: The image preprocessing unit is configured to perform adaptive contrast stretching preprocessing on the input power distribution line image, generate a normalized absolute coordinate grid, and stitch the coordinate grid with the preprocessed image in the channel dimension to form an enhanced input that integrates pixel-level position information. The model building and training unit is configured to build and train a lightweight object detection model based on the enhanced input; the model includes a segmentation-based detection branch and a row classification-based detection branch, the two branches share a front-end feature extraction network, and information is fused through a feature interaction module to simultaneously output pixel-level segmentation results and row classification prediction results; The knowledge distillation compression unit is configured to use a knowledge distillation method to transfer the knowledge of the trained lightweight object detection model as a teacher model to a more streamlined student model. The post-processing unit is configured to post-process the segmentation results output by the student model, filter the instance embedding feature map using the binary segmentation map, cluster the filtered pixels using a clustering algorithm to obtain the independent instance segmentation results for each defect target, and fuse the row classification prediction results for result verification and supplementation. The deployment unit is configured to deploy the distilled and compressed student model to an embedded edge computing device for real-time defect identification and localization of power distribution line images.