An unmanned aerial vehicle insulator string defect detection method
By constructing an improved YOLOv5 convolutional layer defect detection model, the problems of low efficiency and poor robustness of traditional detection methods were solved, enabling end-to-end insulator string defect detection by UAVs, improving the automation and intelligence of power line inspection, and reducing the failure rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGMEN MINGHAO IND GRP CO LTD
- Filing Date
- 2025-06-12
- Publication Date
- 2026-05-01
AI Technical Summary
Traditional insulator string defect detection relies on manual inspection, which is inefficient and poses safety hazards. Image processing-based methods have poor robustness and are difficult to cope with complex background interference and small defects. Deep learning models have high computational complexity and are difficult to operate efficiently in UAV power line inspection.
A defect detection model based on YOLOv5 convolutional layers is constructed, including a grouping and dimensionality-upgrading module, a multi-scale attention module, and a lightweight dual-path collaborative detection head. The computational efficiency is optimized through adaptive grouping convolution, background interference is suppressed through multi-scale feature extraction, and computational overhead is reduced through lightweight inference.
This technology enables end-to-end defect detection of insulator strings using drones, improving automation and intelligence levels, reducing the failure rate, saving manpower and material costs, and ensuring the safe and stable operation of the power grid.
Smart Images

Figure CN120807402B_ABST
Abstract
Description
A defect detection method for insulator strings using unmanned aerial vehicles (UAVs) Technical Field
[0001] This application relates to the field of unmanned aerial vehicle (UAV) power equipment inspection, and more particularly to a method for defect detection of insulator strings by UAVs. Background Technology
[0002] Unmanned aerial vehicle (UAV) power line inspection, with its advantages of efficiency, safety, and flexibility, has been widely used in high-voltage transmission lines and complex terrain scenarios. my country's power system is massive, with a total transmission line length exceeding 1.8 million kilometers, of which the proportion of high-voltage transmission lines is increasing year by year. Insulator strings, as a key component of transmission lines, directly affect the stability and security of the power grid. In recent years, hundreds of fault cases have been caused by insulator string defects (such as broken ceramic tiles and corroded steel caps), resulting in direct economic losses exceeding 100 million yuan. These defects can lead to decreased insulation performance, leakage and short-circuit risks, and in severe cases, even large-scale power outages. Therefore, the defect detection of insulator strings has attracted much attention, and how to efficiently and accurately detect defects has become crucial to ensuring the safe operation of the power grid.
[0003] Traditional insulator string defect detection mainly relies on manual inspection, which is inefficient, costly, and poses safety hazards. Image processing-based methods have poor robustness and struggle to handle complex background interference. While deep learning technology has made significant progress in defect detection, its ability to identify complex background interference and minute defects in high-altitude images remains insufficient. Especially in drone-based power line inspections, insulator strings are often obstructed by tower hardware, conductors, and other objects, resulting in complex image backgrounds and making it difficult to accurately extract defect features. Furthermore, drones need to process large amounts of image data in real time during inspections, and traditional deep learning models have high computational complexity and large memory consumption, making them difficult to run efficiently on resource-constrained embedded devices. Summary of the Invention
[0004] The main objective of this application is to propose a method for detecting defects in insulator strings using a drone. This method can improve the end-to-end defect detection capability of drones for insulator strings, significantly enhance the automation and intelligence level of drone power inspection, reduce the failure rate of power systems, save manpower and material costs, and provide strong support for the safe and stable operation of the power grid.
[0005] To achieve the above objectives, a first aspect of this application proposes a method for defect detection of insulator strings using a UAV, comprising:
[0006] Acquire target images of insulator strings captured by drones, and a defect detection model built based on improved YOLOv5 convolutional layers;
[0007] The defect detection model is used to detect defects in the target image, and the defect detection results of the insulator string are obtained.
[0008] The process of constructing the defect detection model includes the following steps:
[0009] Acquire multiple sample images, which are images of insulator strings marked with defects;
[0010] An improved YOLOv5 convolutional layer-based network architecture is initialized. The network architecture includes a grouping and dimensionality-upgrading module for convolutional processing of the target image, a multi-scale attention module for extracting defect features from the target image, and a dual-path collaborative detection head for defect inference of the target image. The grouping and dimensionality-upgrading module is communicatively connected to the multi-scale attention module, and the multi-scale attention module is communicatively connected to the dual-path collaborative detection head.
[0011] The network architecture is trained based on multiple sample images to obtain a defect detection model.
[0012] Furthermore, in some embodiments, the network architecture is iteratively trained based on multiple sample images to obtain a defect detection model, including the following steps:
[0013] The sample image is input into the grouping and dimensionality-upgrading module for feature expansion to obtain the first feature image;
[0014] The first feature image is input into the multi-scale attention module for multi-scale feature extraction to obtain the second feature image;
[0015] The second feature image is input into the dual-path collaborative detection head for defect prediction, resulting in a defect prediction image.
[0016] The defect prediction image is paired with the sample image to obtain the difference data between the sample image and the defect prediction image.
[0017] Based on the loss function, gradient difference is calculated on the differential data to obtain the gradient loss value of the current iteration;
[0018] Based on the gradient loss value, the parameters of the multi-layer network architecture are updated through backpropagation using an iterative optimizer;
[0019] If the parameters of the multi-layer network architecture meet the preset training requirements, the iterative training of the network architecture is terminated, and the defect detection model is obtained.
[0020] Furthermore, in some embodiments, the group dimensionality enhancement module includes a dual-channel extended architecture and a group convolution module, with the dual-channel extended architecture and the group convolution module being communicatively connected.
[0021] The sample image is input into the grouping and dimensionality-upgrading module for feature expansion to obtain the first feature image, including the following steps:
[0022] The sample image is input into the input layer of the network architecture for feature extraction to obtain a second feature image, which includes multiple feature channels;
[0023] The second feature image is input into the dual-channel expansion architecture to perform feature expansion, resulting in a third feature image. The third feature image has more feature channels than the second feature image.
[0024] The third feature image is input into the group convolution module for feature compression to obtain the first feature image. The number of feature channels in the first feature image is less than the number of feature channels in the third feature image.
[0025] Furthermore, in some embodiments, the dual-channel expansion architecture includes an expansion path and a compensation path. The expansion path includes a first convolutional layer and a multilayer perceptron, and the compensation path includes a second convolutional layer and a feature decoupler. The expansion path and the compensation path are related and run in parallel.
[0026] The process of inputting the second feature image into a dual-channel expansion architecture for feature expansion to obtain the third feature image includes the following steps:
[0027] The second feature image is input into the first convolutional layer for convolution operation, and the first feature image after convolution is extended by the multilayer perceptron in the form of feature channel combination to obtain the fourth feature image. The fourth feature image includes the first feature channel used to express the fusion of local texture features and global structural features of the sample image.
[0028] The second feature image is input into the second convolutional layer for convolution operation, and the first feature image after convolution is expanded by feature decoupling in the form of feature channel decomposition to obtain the fifth feature image. The fifth feature image includes the second feature channel used to express the edge detail features of the sample image.
[0029] The third feature image is obtained by concatenating the fourth and fifth feature images along their channel dimensions.
[0030] Furthermore, in some embodiments, the third feature image is input into a group convolution module for feature compression to obtain a first feature image, including:
[0031] The third feature image is grouped into multiple channel groups, and each channel group contains multiple feature channels.
[0032] Convolution operation is performed on all channel groups of the third feature image to obtain the first feature image set corresponding to the third feature image. The first feature image set includes multiple feature sub-images, and the feature sub-images are mapped to the channel groups.
[0033] The first feature image is obtained by stitching together all feature sub-images within the first feature image set.
[0034] Furthermore, in some embodiments, all feature channels of the third feature image are grouped to obtain a grouped third feature image, including:
[0035] The number of preset feature channels for the pre-set output of the grouped dimensionality upgrade module is obtained, and the number of first feature channels of the third feature image is determined.
[0036] The greatest common divisor between the number of the first feature channels and the preset number of feature channels is determined as the number of dynamic groups of the third feature image;
[0037] The third feature image is obtained by dividing all feature channels of the third feature image into groups according to the dynamic grouping number.
[0038] Furthermore, in some embodiments, the multi-scale attention module includes a multi-scale pooling layer and a pooling attention mechanism layer, the multi-scale pooling layer and the pooling attention mechanism layer are communicatively connected, the multi-scale pooling layer includes a spatial pyramid pooling layer, a multi-scale group convolutional layer and an upsampling layer, the spatial pyramid pooling layer and the multi-scale group convolutional layer are communicatively connected, and the multi-scale group convolutional layer and the upsampling layer are communicatively connected.
[0039] The process of inputting the first feature image into a multi-scale attention module for multi-scale feature extraction to obtain the second feature image includes the following steps:
[0040] The first feature image is input into the spatial pyramid pooling layer for multi-scale feature extraction, resulting in multiple sixth feature images. The spatial scales of two sixth feature images may be the same or different.
[0041] Based on multi-scale group convolutional layers, multiple sixth feature images at the same spatial scale are compressed by group convolution to obtain multiple seventh feature images with different spatial scales.
[0042] By using an upsampling layer, multiple seventh feature images are concatenated to obtain a multi-scale fused eighth feature image;
[0043] The eighth feature image is input into the pooling attention mechanism layer for feature enhancement, resulting in a second feature image used to highlight the features of the defect region.
[0044] Furthermore, in some embodiments, the multi-scale attention module further includes a pooling attention mechanism layer, which includes a channel attention module and a spatial attention module. The channel attention module is communicatively connected to the output layer of the multi-scale pooling layer, and the spatial attention module is communicatively connected to the channel attention module. The channel attention module includes a fully connected layer, and the spatial attention module includes a convolutional layer. Both the convolutional layer and the fully connected layer are provided with a Sigmoid activation function.
[0045] The process involves inputting the eighth feature image into the pooling attention mechanism layer for feature enhancement to obtain a second feature image used to highlight the features of the defect region, including the following steps:
[0046] The channel attention module is used to perform global average pooling on the eighth feature image to obtain the channel description vector of the eighth feature image.
[0047] By using the Sigmoid activation function in the fully connected layer, the channel description vectors are weighted respectively to obtain the channel attention weights corresponding to the eighth feature image;
[0048] By using a fully connected layer, the channel attention weights are multiplied with each feature channel in the eighth feature image to obtain the channel-weighted ninth feature image.
[0049] The ninth feature image is fed into the spatial attention module to perform max pooling and average pooling respectively, resulting in the tenth feature image of the max pooling spatial description and the eleventh feature image of the average pooling spatial description.
[0050] Spatial attention weights are obtained by calculating the spatial description weights between the 10th and 11th feature images using the Sigmoid activation function in the fully connected layer.
[0051] The second feature image is obtained by multiplying the spatial attention weights with each feature channel of the ninth feature image through a convolutional layer.
[0052] Furthermore, in some embodiments, the dual-path collaborative detection head includes a multi-branch block, a positioning branch, and a classification branch, with the multi-branch block communicatively connected to the positioning branch and the classification branch, respectively.
[0053] The second feature image is input into the dual-path collaborative detection head for defect prediction, resulting in a defect prediction image, including the following steps:
[0054] The second feature image is input into the diversified branch block for feature enhancement to obtain the twelfth feature image;
[0055] By using the classification branch, the type probability of the defect features in the twelfth feature image is calculated to obtain the defect type probability distribution map;
[0056] By locating the branch, the defect features of the twelfth feature image are mapped to coordinates to obtain a defect location distribution map;
[0057] The output layer of the dual-path collaborative detection head combines the defect type probability distribution map and the defect location distribution map to obtain a defect prediction image.
[0058] Furthermore, in some embodiments, the multi-branch block includes a first convolutional branch, a second convolutional branch, a third convolutional branch, a fourth convolutional branch, and a branch connection layer. The first convolutional branch includes a 1×1 first convolutional kernel, the second convolutional branch includes a 1×1 second convolutional kernel and a K×K third convolutional kernel, the second convolutional kernel and the third convolutional kernel are communicatively connected, the third convolutional branch includes a 1×K fourth convolutional kernel, and the fourth convolutional branch includes a K×1 fifth convolutional kernel.
[0059] Furthermore, the second feature image is input into the diversified branch block for feature enhancement to obtain the twelfth feature image, including the following steps:
[0060] The second feature image is input into the first convolutional branch so that the first convolutional kernel performs average pooling on the second feature image to obtain a context feature image that expresses global context information.
[0061] The second feature image is input into the second convolution branch so that the second and third convolution kernels can capture the spatial correlation of the second feature image to obtain the thirteenth feature image used to express local spatial correlation.
[0062] The second feature image is input into the third convolution branch so that the fourth convolution kernel can capture the spatial correlation of the second feature image to obtain the fourteenth feature image used to express the orientation sensitivity.
[0063] The second feature image is input into the fourth convolution branch so that the fifth convolution kernel can capture the spatial correlation of the second feature image to obtain the fifteenth feature image used to express the orientation sensitivity.
[0064] By using a branch connection layer, the context feature image, the thirteenth feature image, and the fourteenth feature image are connected to obtain the twelfth feature image.
[0065] Furthermore, after obtaining the defect detection model, the following steps are included:
[0066] Based on the zero-padding and parameter stacking method, the first, second, third and fourth convolutional branches are merged in a reparameterized form to obtain the fifth convolutional branch, which includes a K×K sixth convolutional kernel.
[0067] Furthermore, in some embodiments, the localization branch includes a detection box convolutional layer, a DFL loss layer, and a CIOU loss layer. The detection box convolutional layer is communicatively connected to the DFL loss layer, and the DFL loss layer is communicatively connected to the CIOU loss layer. The DFL module is equipped with a cross-entropy loss function. Through the localization branch, the defect features of the twelfth feature image are mapped to coordinates to obtain a defect location distribution map, including the following steps:
[0068] By using a detection box convolutional layer, the twelfth feature image is channel-adjusted to obtain the first defect location image with bounding box attributes;
[0069] By using the DFL loss layer, the bounding box coordinates in the first defect location image are discretized and then regressed to optimize, thus obtaining the second defect location image.
[0070] By using the CIOU loss layer, the overlapping areas, center point distance, and aspect ratio of the second defect location image are weighted and adjusted to obtain the defect location distribution map.
[0071] Furthermore, in some embodiments, the classification branch includes a classification convolutional layer and a CLS loss layer, which are communicatively connected. The classification convolutional layer is equipped with a binary cross-entropy loss function. Through the classification branch, the type probability of the defect features in the twelfth feature image is calculated to obtain a defect type probability distribution map, including the following steps:
[0072] By compressing the feature channels of the classification convolutional layer, the defect features of the twelfth feature image are type-mapped to obtain the first defect type image;
[0073] By using the CLS loss layer, multi-type probability prediction and focus loss are performed on each anchor point in the first defect type image to obtain the second defect type image.
[0074] By using the channel attention mechanism of the classification branch, the feature channels of the second defect type image are weighted to obtain the defect type probability distribution map.
[0075] The embodiments of the first aspect of this application have the following beneficial effects: by expanding the features of the insulator string through the grouped dimensionality-upgrading group convolution module of the defect detection model, the number of model parameters can be reduced while improving the high-dimensional feature extraction capability of the insulator string, realizing rapid detection and localization of defects such as insulator cracks and contamination; and by extracting features of the insulator string through the multi-scale attention module, the insulator target in the complex background can be accurately distinguished without increasing the computational burden, effectively suppressing the interference of complex background and enhancing the robustness of defect detection; and by performing inference through the lightweight dual-path collaborative detection head, the additional computational overhead in the inference stage can be avoided while enhancing feature diversity, thereby realizing end-to-end insulator string defect detection by UAV, greatly improving the automation and intelligence level of UAV power inspection, reducing the failure rate of the power system, saving manpower and material costs, and providing a strong guarantee for the safe and stable operation of the power grid. Attached Figure Description
[0076] Figure 1 is an optional flowchart of a UAV-based defect detection method for insulator strings provided in an embodiment of this application;
[0077] Figure 2 is an optional flowchart of the construction process of the defect detection model provided in the embodiments of this application;
[0078] Figure 3 is an optional flowchart of step S203 in Figure 2 provided in an embodiment of this application;
[0079] Figure 4 is an optional structural diagram of a sample image training defect detection model provided in an embodiment of this application;
[0080] Figure 5 is an optional flowchart of step S301 in Figure 3 provided in an embodiment of this application;
[0081] Figure 6 is an optional flowchart of step S502 in Figure 5 provided in an embodiment of this application;
[0082] Figure 7 is an optional structural diagram of the dual-channel extended architecture provided in an embodiment of this application;
[0083] Figure 8 is an optional flowchart of step S603 in Figure 5 provided in an embodiment of this application;
[0084] Figure 9 is an optional schematic diagram comparing feature compression between a group convolutional module and a regular convolutional module provided in an embodiment of this application;
[0085] Figure 10 is an optional flowchart of step S801 in Figure 7 provided in an embodiment of this application;
[0086] Figure 11 is an optional flowchart of step S302 in Figure 3 provided in an embodiment of this application;
[0087] Figure 12 is an optional structural diagram of the multi-scale attention module provided in an embodiment of this application;
[0088] Figure 13 is an optional flowchart of step S1104 in Figure 11 provided in an embodiment of this application;
[0089] Figure 14 is an optional structural diagram of the pool attention mechanism layer provided in an embodiment of this application;
[0090] Figure 15 is an optional flowchart of step S303 in Figure 3 provided in an embodiment of this application;
[0091] Figure 16 is an optional structural diagram of the dual-path collaborative detection head provided in an embodiment of this application;
[0092] Figure 17 is an optional flowchart of step S1501 in Figure 15 provided in an embodiment of this application;
[0093] Figure 18 is an optional flowchart of step S1502 in Figure 15 provided in an embodiment of this application;
[0094] Figure 19 is an optional flowchart of step S1503 in Figure 15 provided in an embodiment of this application;
[0095] Figure 20 is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0096] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0097] In the description of this application, it should be understood that the orientation descriptions, such as up, down, front, back, left, right, etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.
[0098] It should also be noted that in the description of this application, "several" means one or more, "multiple" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. If the terms "first" and "second" are used, they are only for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.
[0099] 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 herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0100] In the description of this application, the terms "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0101] Traditional insulator string defect detection mainly relies on manual inspection, which is inefficient, costly, and poses safety hazards. Image processing-based methods have poor robustness and struggle to handle complex background interference. While deep learning technology has made significant progress in defect detection, its ability to identify complex background interference and minute defects in high-altitude images remains insufficient. Especially in drone-based power line inspections, insulator strings are often obstructed by tower hardware, conductors, and other objects, resulting in complex image backgrounds and making it difficult to accurately extract defect features. Furthermore, drones need to process large amounts of image data in real time during inspections, and traditional deep learning models have high computational complexity and large memory consumption, making them difficult to run efficiently on resource-constrained embedded devices.
[0102] To address these issues, this application proposes a UAV-based defect detection method for insulator strings. First, by constructing a grouping-level dimensionality-upgrading module in the defect detection model, the computational efficiency and memory usage of the neural network are optimized, enabling efficient operation on embedded devices. This module replaces fully connected convolutional kernels with adaptive grouping convolutions, significantly reducing parameter size while maintaining cross-channel feature interaction capabilities, thus reducing computational complexity and memory usage while ensuring detection accuracy. Second, to address the issues of complex background interference and the detection of minute defects, a multi-scale attention module is constructed in the defect detection model to extract features from the insulator strings. This module accurately distinguishes insulator targets in complex backgrounds without increasing computational burden, effectively suppressing complex background interference and enhancing the robustness of defect detection. Furthermore, a lightweight dual-path collaborative detection head is constructed for inference, enhancing feature diversity while avoiding additional computational overhead in the inference stage. This achieves end-to-end insulator string defect detection by UAVs, significantly improving the automation and intelligence level of UAV power grid inspection, reducing the power system failure rate, saving manpower and material costs, and providing strong support for the safe and stable operation of the power grid.
[0103] This application provides a method for defect detection of insulator strings using a UAV, which is specifically illustrated through the following embodiments.
[0104] Firstly, referring to FIG1, FIG1 is an optional flowchart of a method for detecting defects in insulator strings by a UAV provided in an embodiment of this application. The method may include, but is not limited to, steps S101 to S102.
[0105] Step S101: Obtain the target image of the insulator string taken by the UAV, and the defect detection model built based on the improved YOLOv5 convolutional layer.
[0106] Before acquiring target images of insulator strings from drones, the process begins by determining the drone's flight path based on the starting location of the area to be inspected. This clarifies the drone's origin and destination, ensuring the geographic information of the task area and the inspection target are clearly defined. The backend server then generates an inspection path covering the edge of the target area based on preset task parameters and regional map information. By utilizing drones to collect images of insulator strings, a closed-loop preprocessing process—from path planning to data acquisition—is established, providing standardized input conditions for subsequent insulator defect analysis.
[0107] After the drone arrives at the inspection area, it collects images of the insulator strings and performs image preprocessing. First, based on the pre-planned flight path, the drone's attitude and altitude are adjusted to ensure the camera can capture images of the insulator strings at the optimal angle and distance. The image data collected by the camera is transmitted in real-time to the terminal display via 5G communication and simultaneously stored in the drone's local storage device for subsequent processing. To improve the accuracy and efficiency of defect detection, the collected images undergo a series of preprocessing steps. Specifically, because images captured by the drone in complex environments may be affected by changes in lighting, fog, backlighting, etc., resulting in noise in the images, it is necessary to perform denoising processing using methods such as Gaussian filtering or median filtering to remove random noise while retaining the key features of the insulator strings. To ensure the consistency of the model input, the pixel values of the images are normalized to a uniform range to eliminate differences in pixel values under different lighting conditions. Simultaneously, according to the input requirements of the defect detection model, the images are uniformly adjusted to 1920 pixels. 1080p resolution is used as input to accommodate the model's computational needs. During preprocessing, image data augmentation is performed, including random rotation, flipping, and scaling, to simulate image changes under different shooting conditions, thereby improving the model's robustness. These preprocessing steps optimize the acquired insulator string images into a format suitable for the defect detection model, providing high-quality input data for subsequent insulator string defect detection. The optimized images more clearly present defect features such as cracks and contamination in the insulator strings, significantly improving detection accuracy and efficiency.
[0108] Step S102: Using the defect detection model, perform defect detection on the target image to obtain the defect detection results of the insulator string.
[0109] In one possible embodiment, after performing defect detection on target images of insulator strings collected by a drone, the defect detection model will automatically identify typical fault types such as surface contamination, skirt damage, and steel cap corrosion, and generate a visualized defect detection result map containing information on defect location, shape, and contour. The output detection result map will be presented in color, with each color corresponding to a specific anomaly category, facilitating the rapid differentiation of problem areas of different natures. The contour outlines also visually reflect the distribution range and appearance characteristics. When on-site maintenance personnel receive the processed images, they can quickly filter out key areas of concern based on the color classification system and, combined with their professional experience, classify the impact of various anomalies. Based on this visualized analysis, targeted handling plans will be developed to ensure that different situations are addressed appropriately, effectively improving the accuracy and efficiency of facility maintenance.
[0110] Referring to Figure 2, which is an optional flowchart of the construction process of the defect detection model provided in the embodiment of this application, the construction process may include, but is not limited to, steps S201 to S203.
[0111] Step S201: Obtain multiple sample images, which are images of insulator strings marked with defects.
[0112] Step S202: Initialize the improved network architecture based on YOLOv5 convolutional layers.
[0113] The network architecture includes a grouping and dimensionality-upgrading module for convolutional processing of the target image, a multi-scale attention module for extracting defect features from the target image, and a dual-path collaborative detection head for defect inference of the target image. The grouping and dimensionality-upgrading module is communicatively connected to the multi-scale attention module, and the multi-scale attention module is communicatively connected to the dual-path collaborative detection head.
[0114] Step S203: Train the network architecture based on multiple sample images to obtain a defect detection model.
[0115] It should be noted that by constructing a grouping and dimensionality-upgrading module in the network architecture, the computational efficiency and memory usage of the neural network are optimized, enabling it to run efficiently on embedded devices. This module replaces fully connected convolutional kernels with adaptive grouping convolutions, significantly reducing the parameter scale while maintaining cross-channel feature interaction capabilities, thus reducing computational complexity and memory usage while ensuring detection accuracy. Secondly, to address the problems of detecting complex background interference and minor defects, a multi-scale attention module is constructed in the network architecture. This multi-scale attention module enhances the model's response strength to minor defects through hierarchical spatial compression and multi-level feature fusion, while suppressing background interference, reducing the false detection rate, and significantly improving the robustness of defect recognition.
[0116] Referring to FIG3, FIG3 is an optional flowchart of step S203 in FIG2 provided in an embodiment of the present application. The process of the method may include, but is not limited to, steps S301 to S307.
[0117] Step S301: Input the sample image into the grouping and dimensionality-upgrading module for feature expansion to obtain the first feature image.
[0118] Step S302: Input the first feature image into the multi-scale attention module for multi-scale feature extraction to obtain the second feature image.
[0119] Step S303: Input the second feature image into the dual-path collaborative detection head for defect prediction to obtain the defect prediction image.
[0120] Step S304: Pair the defect prediction image with the sample image to obtain the difference data between the sample image and the defect prediction image.
[0121] Step S305: Based on the loss function, perform gradient difference calculation on the difference data to obtain the gradient loss value of the current iteration.
[0122] Step S306: Based on the gradient loss value, the parameters of the multi-layer network architecture are updated by backpropagation through the iterative optimizer.
[0123] Step S307: If the multi-layer network parameters of the network architecture meet the preset training requirements, then terminate the iterative training of the network architecture and obtain the defect detection model.
[0124] It should be noted that, referring to Figure 4, which is an optional structural diagram of the sample image training defect detection model provided in this application embodiment, a grouping dimensionality-upgrading module is constructed in the defect detection model to optimize the computational efficiency and memory usage of the neural network, enabling it to run efficiently on embedded devices. This grouping dimensionality-upgrading module replaces the fully connected convolutional kernel with adaptive grouping convolution, significantly reducing the parameter scale while maintaining cross-channel feature interaction capabilities, thus reducing computational complexity and memory usage while ensuring detection accuracy. Secondly, for the problems of complex background interference and small defect detection, a multi-scale attention module is also constructed in the defect detection model to extract features from insulator strings. This can accurately distinguish insulator targets in complex backgrounds without increasing computational burden, effectively suppressing complex background interference and enhancing the robustness of defect detection. Furthermore, a lightweight dual-path collaborative detection head is constructed in the model for inference, which can enhance feature diversity while avoiding additional computational overhead in the inference stage. This achieves end-to-end insulator string defect detection by UAVs, significantly improving the automation and intelligence level of UAV power line inspection, reducing the power system failure rate, saving manpower and material costs, and providing strong protection for the safe and stable operation of the power grid.
[0125] Furthermore, the group dimensionality enhancement module includes a dual-channel extended architecture and a group convolution module. The dual-channel extended architecture and the group convolution module are communicatively connected. Referring to FIG5, FIG5 is an optional flowchart of step S301 in FIG3 provided in the embodiment of this application. The method may include, but is not limited to, steps S501 to S503.
[0126] Step S501: Input the sample image into the input layer of the network architecture for feature extraction to obtain the second feature image.
[0127] The second feature image includes multiple feature channels.
[0128] Step S502: Input the second feature image into the dual-channel expansion architecture to perform feature expansion and obtain the third feature image.
[0129] Step S503: Input the third feature image into the group convolution module for feature compression to obtain the first feature image. The number of feature channels in the first feature image is less than the number of feature channels in the third feature image.
[0130] Further, referring to Figures 6 and 7, Figure 6 is an optional flowchart of step S502 in Figure 5 provided in the embodiment of this application, and Figure 7 is an optional structural diagram of the dual-channel expansion architecture provided in the embodiment of this application. The dual-channel expansion architecture includes an expansion path and a compensation path. The expansion path includes a first convolutional layer and a multilayer perceptron, and the compensation path includes a second convolutional layer and a feature decoupler. The expansion path and the compensation path are related and run in parallel. The method may include, but is not limited to, steps S601 to S603.
[0131] Step S601: Input the second feature image into the first convolutional layer for convolution operation, and perform feature expansion on the convolutional first feature image by combining feature channels through a multilayer perceptron to obtain the fourth feature image.
[0132] The fourth feature image includes a first feature channel that is used to express the fusion of local texture features and global structural features of the sample image.
[0133] Step S602: Input the second feature image into the second convolutional layer for convolution operation, and perform feature expansion on the convolutional first feature image by feature channel decomposition through a feature decoupler to obtain the fifth feature image.
[0134] The fifth feature image includes a second feature channel used to express the edge detail features of the sample image.
[0135] Step S603: Concatenate the fourth feature image and the fifth feature image along the channel dimension to obtain the third feature image.
[0136] In steps S601 to S603, based on the working conditions of UAV power line inspection, a dual-channel expansion architecture is proposed to further improve the accuracy of insulator string defect detection. This architecture adopts a collaborative mechanism of parallel expansion path and compensation path. In the expansion path, the multilayer perceptron fuses the local texture features and global structural features of the first feature image by combining feature channels; simultaneously, in the compensation path, the feature decoupler expands the edge detail features of the second feature image by decomposing feature channels, thereby suppressing interference from complex backgrounds and significantly improving the detection performance of insulator strings in UAV power line inspection.
[0137] In one embodiment, the dual-channel expansion architecture is shown in Figure 7. The first convolutional layer of the expansion path uses a 3×3 convolutional kernel to expand the channels to 1.5 times the original size, constructing a wide channel space to fuse the local texture and global structural features of the insulator string (first feature image), enhancing its adaptability to multi-scale targets from an aerial perspective. Meanwhile, the compensation path uses a feature decoupler to suppress interference from complex backgrounds such as high-voltage towers and vegetation, enhancing the preservation of edge details of the insulator string (first feature image) in foggy or backlit scenarios. This dual-channel architecture balances computational efficiency and feature representation capability by optimizing the channel expansion coefficients, and is compatible with the multimodal feature extraction requirements of metal heating points in nighttime infrared images.
[0138] The expansion path performs a dimensionality increase operation (i.e., feature expansion) as follows:
[0139] (1)
[0140] in This represents the number of feature channels after expansion. The kernel is 3×3, and α is the channel expansion coefficient. This indicates the number of feature channels in the intermediate layer. This indicates the number of input channels in the intermediate layer.
[0141] Further, referring to Figures 8 and 9, Figure 8 is an optional flowchart of step S603 in Figure 5 provided in the embodiment of this application, and Figure 9 is an optional schematic diagram of feature compression comparison between the group convolution module and the ordinary convolution module provided in the embodiment of this application. The method may include, but is not limited to, steps S801 to S803.
[0142] Step S801: Group all feature channels of the third feature image to obtain the grouped third feature image. The grouped third feature image includes multiple channel groups, and each channel group includes multiple feature channels.
[0143] Step S802: Perform convolution operation on all channel groups of the third feature image to obtain the first feature image set corresponding to the third feature image. The first feature image set includes multiple feature sub-images, and the feature sub-images are mapped to the channel groups.
[0144] Step S803: Perform image stitching on all feature sub-images within the first feature image set to obtain the first feature image.
[0145] In steps S801 to S803, this embodiment uses the standard convolutional layer in YOLOv5 as a foundation and employs a group convolution module to adapt to the computational limitations of embedded UAV devices. Group convolution involves grouping the third feature image of the input layer and then performing convolution on each channel group using different convolution kernels. As shown in Figure 9, the group convolution module divides the feature channels of the third feature image of the input layer into several channel groups. Each channel group independently performs convolution operations to obtain the first feature image set corresponding to the third feature image. Finally, the feature sub-images of each channel group are stitched together to obtain the first feature image. This design significantly reduces the computational cost and parameter count to N times that of ordinary convolution, where N = 1 / number of channel groups, thereby significantly reducing memory usage and computational resource consumption, making it particularly suitable for resource-constrained scenarios such as UAV inspection. Simultaneously, the grouping mechanism forces different channel groups to learn diverse feature patterns. Using group convolution reduces the computational cost of convolution and increases the model's accuracy.
[0146] Referring to FIG10, FIG10 is an optional flowchart of step S801 in FIG7 provided in an embodiment of the present application. The method may include, but is not limited to, steps S1001 to S1003.
[0147] Step S1001: Obtain the preset number of feature channels for the grouped dimensionality upgrade module output, and determine the number of first feature channels for the third feature image.
[0148] Step S1002: Determine the greatest common divisor between the number of first feature channels and the preset number of feature channels as the number of dynamic groups of the third feature image.
[0149] Step S1003: Divide all feature channels of the third feature image into average groups according to the dynamic grouping number to obtain the grouped third feature image.
[0150] In steps S1001 to S1003, this embodiment of the application significantly improves the real-time performance and lightweight deployment capability of insulator string defect identification in UAV power line inspection using an adaptive grouping convolution method. This step involves dynamically increasing the number of groups. ,in, Indicates the number of groups. The number of preset feature channels for the output image is pre-set for the grouping and dimensionality enhancement module. The first feature channel of the third feature image is denoted as gcd, which represents the greatest common divisor between the number of the first feature channels and the preset number of feature channels.
[0151] To achieve efficient fusion of cross-scale features in the complex background of power transmission lines, the parameter scale in the group convolution module is as follows:
[0152] (2)
[0153] in, The size of the grouped convolutional kernel is 1 / g smaller than that of traditional convolution. Through the adaptive channel grouping strategy in steps S801 to S803, the model can dynamically capture subtle defects such as dirt deposits and missing parts between insulator sheets, maintaining stable detection performance under varying illumination and occlusion interference. Furthermore, it offers the following optimizations compared to traditional convolution:
[0154] 1. Memory usage optimization: Based on the grouping parameter sharing mechanism, the model weight file size is reduced to: (in This represents the new value after adjustment. (Using the baseline value), the model weight file size can be reduced and stored in the limited storage space of the UAV's onboard equipment.
[0155] 2. Improved computational performance: Introducing... - Joint evaluation indicators, with Indicates memory access cost, The number of floating-point operations. The number of tensors or the batch size.
[0156] (3)
[0157] In steps S1001 to S1003, this method can effectively improve the detection frame rate of defects such as insulator cracks and contamination by optimizing memory usage and improving computing performance.
[0158] Furthermore, in one possible embodiment, referring to Figures 11 and 12, Figure 11 is an optional flowchart of step S302 in Figure 3 provided in the embodiment of this application, and Figure 12 is an optional structural diagram of a multi-scale attention module provided in the embodiment of this application. The multi-scale attention module includes a multi-scale pooling layer and a pooling attention mechanism layer. The multi-scale pooling layer and the pooling attention mechanism layer are communicatively connected. The multi-scale pooling layer includes a spatial pyramid pooling layer, a multi-scale group convolutional layer, and an upsampling layer. The spatial pyramid pooling layer and the multi-scale group convolutional layer are communicatively connected, and the multi-scale group convolutional layer and the upsampling layer are communicatively connected. The method may include, but is not limited to, steps S1101 to S1104.
[0159] Step S1101: Input the first feature image into the spatial pyramid pooling layer for multi-scale feature extraction to obtain multiple sixth feature images.
[0160] Among them, the spatial scales of the two sixth feature images are the same or different.
[0161] Step S1102: Based on the multi-scale group convolutional layer, perform group convolutional compression on multiple sixth feature images at the same spatial scale to obtain multiple seventh feature images with different spatial scales.
[0162] Step S1103: Through the upsampling layer, multiple seventh feature images are channel-stitched to obtain the eighth feature image after multi-scale fusion.
[0163] Step S1104: Input the eighth feature image into the pooling attention mechanism layer for feature enhancement to obtain a second feature image for highlighting the features of the defect region.
[0164] In steps S1101 to S1103, as shown in Figure 12, based on the efficient feature representation extracted by the grouping and dimensionality-upgrading module, a multi-scale attention module is also constructed in the model to further enhance the model's ability to perceive multi-scale defects in insulator strings. This module innovatively integrates a multi-scale pooling layer and a pooling attention mechanism layer. The first feature image obtained by expanding the insulator string image acquired by the UAV through the grouping and dimensionality-upgrading module is F∈R. H×W×C Where H and W are the height and width of the first feature image, respectively, and C is the number of feature channels of the first feature image. In the multi-scale pooling layer, the first feature image is pooled using pooling kernels of different scales in the spatial pyramid pooling layer to generate multiple sixth feature images. Then, based on the multi-scale group convolutional layer, the multiple sixth feature images at the same spatial scale are compressed by group convolution to obtain multiple seventh feature images with different spatial scales. Finally, the seventh feature images at different scales are restored to their original size in the upsampling layer and their channels are stitched together to obtain the second feature image used to highlight the features of the defect region. The calculation formula for the second feature image is shown below.
[0165] (4);
[0166] in, ∈R H×W×3C This is the second feature image after multi-scale fusion.
[0167] Furthermore, in one possible embodiment, referring to Figures 12, 13, and 14, Figure 13 is an optional flowchart of step S1104 in Figure 11 provided in the embodiment of this application, and Figure 14 is an optional structural diagram of the pooling attention mechanism layer provided in the embodiment of this application. The multi-scale attention module further includes a pooling attention mechanism layer, which includes a channel attention module and a spatial attention module. The channel attention module is communicatively connected to the output layer of the multi-scale pooling layer, and the spatial attention module is communicatively connected to the channel attention module. The channel attention module includes a fully connected layer, and the spatial attention module includes a convolutional layer. Both the convolutional layer and the fully connected layer are provided with a Sigmoid activation function. The method may include, but is not limited to, steps S1301 to S1306.
[0168] Step S1301: Perform global average pooling on the eighth feature image through the channel attention module to obtain the channel description vector of the eighth feature image.
[0169] Step S1302: Calculate the channel attention weights corresponding to the eighth feature image by using the Sigmoid activation function in the fully connected layer to weigh the channel description vectors.
[0170] Step S1303: Through a fully connected layer, the channel attention weights are multiplied with each feature channel in the eighth feature image to obtain the channel-weighted ninth feature image.
[0171] Step S1304: Feed the ninth feature image to the spatial attention module to perform max pooling and average pooling respectively, to obtain the tenth feature image of the max pooling spatial description and the eleventh feature image of the average pooling spatial description.
[0172] Step S1305: Calculate the spatial description weights between the tenth and eleventh feature images using the Sigmoid activation function in the fully connected layer to obtain the spatial attention weights.
[0173] Step S1306: Through a convolutional layer, the spatial attention weights are multiplied with each feature channel of the ninth feature image to obtain the second feature image.
[0174] In steps S1301 to S1306, based on the feature fusion of the multi-scale pooling layer, weights are dynamically allocated through a pooling attention mechanism layer to further highlight the defect region. The pooling attention mechanism layer includes a channel attention module and a spatial attention module. First, the channel attention module is executed to process the second feature image fused from the multi-scale pooling layer. e Perform global average pooling (GAP) to obtain the channel description vector z∈R.3C The channel attention weights α=σ(FC(z)) of the eighth feature image are generated through a fully connected layer and a sigmoid activation function, and then compared with the second feature image. The ninth feature image is obtained by multiplying each feature channel. ∈R H×W×3C Among them, the ninth feature image The calculation is as follows:
[0175] (5)
[0176] (6)
[0177] Next, the channel-weighted ninth feature image is processed through the spatial attention module. Perform max pooling and average pooling along the channel dimension respectively to obtain the tenth feature image F, which describes the max pooling space. max ∈R H×W×1 And the eleventh feature image F describing the average pooling space. avg ∈R H×W× After concatenating the two spatial description maps, spatial attention weights between them are generated using a fully connected layer and a sigmoid function. Then, the spatial attention weights are combined with the channel-weighted ninth feature image. Multiplying them together yields the final second feature image F. final ∈R H×W×3C Among them, the tenth feature image F max Eleventh Feature Image F avg Second feature image F final The calculation formula is as follows.
[0178] (7)
[0179] (8)
[0180] (9)
[0181] Furthermore, in one possible embodiment, referring to Figures 15 and 16, Figure 15 is an optional flowchart of step S303 in Figure 3 provided in an embodiment of this application, and Figure 16 is an optional structural diagram of a dual-path collaborative detection head provided in an embodiment of this application. The dual-path collaborative detection head includes a multi-path branch block, a positioning branch, and a classification branch, with the multi-path branch block communicatively connected to the positioning branch and the classification branch, respectively. This method may include, but is not limited to, steps S1501 to S1504.
[0182] Step S1501: Input the second feature image into the diversified branch block for feature enhancement to obtain the twelfth feature image.
[0183] Step S1502: Through the classification branch, calculate the type probability of the defect features of the twelfth feature image to obtain the defect type probability distribution map.
[0184] Step S1503: By locating the branch, the defect features of the twelfth feature image are mapped to coordinates to obtain the defect location distribution map.
[0185] Step S1504: Combine the defect type probability distribution map and the defect location distribution map of the output layer of the dual-path collaborative detection head to obtain the defect prediction image.
[0186] In steps S1501 to S1504, the dual-path collaborative detection head adopts a hierarchical feature processing strategy, uses diversified branch blocks to extract shared features of the second feature image to obtain the twelfth feature image, and then performs defect prediction on the twelfth feature image through classification branch and localization branch to obtain the defect type probability distribution map and the defect location distribution map. Finally, the two maps are combined to obtain the defect prediction image.
[0187] In the defect detection stage of the insulator string in the classification branch, the model employs a multi-stage detection framework based on deep learning to refine the input features. Firstly, the classification branch introduces a Softmax function to generate a high-precision initial probability distribution map of defect types. For the probability distribution map, the dual-path collaborative detection head also implements a dynamic threshold segmentation strategy, which converts continuous probability values into a binary defect mask by setting a threshold θ, thus obtaining the defect type probability distribution map after the defect mask is applied. Among them, the probability distribution diagram of the initial defect type Defect type probability distribution diagram The calculation process is as follows.
[0188] (10)
[0189] (11)
[0190] In the defect localization stage of the insulator string, the model maps image coordinates to the geographic coordinate system through a coordinate transformation matrix, achieving precise location of the defect. Simultaneously, the model outputs the defect detection results for each location on the insulator string, achieving accurate matching between defects and their locations, significantly reducing labor costs. The entire processing flow has undergone deep algorithmic optimization, ensuring detection accuracy while meeting the real-time requirements of UAV inspection.
[0191] It should be noted that by separating the classification and localization tasks through the dual-path collaborative detection head, the dual-path collaborative detection head can significantly improve the classification and localization accuracy of targets in complex backgrounds while reducing parameter redundancy.
[0192] Furthermore, in one possible embodiment, referring again to FIG16, the multi-branch block includes a first convolutional branch, a second convolutional branch, a third convolutional branch, a fourth convolutional branch, and a branch connection layer. The first convolutional branch includes a 1×1 first convolutional kernel, the second convolutional branch includes a 1×1 second convolutional kernel and a K×K third convolutional kernel, the second convolutional kernel and the third convolutional kernel are communicatively connected, the third convolutional branch includes a 1×K fourth convolutional kernel, and the fourth convolutional branch includes a K×1 fifth convolutional kernel. Referring to FIG17, FIG17 is an optional flowchart of step S1501 in FIG15 provided in the embodiment of this application. The method may include, but is not limited to, steps S1701 to S1705.
[0193] Step S1701: Input the second feature image into the first convolution branch so that the first convolution kernel performs average pooling on the second feature image to obtain a context feature image for expressing global context information.
[0194] Step S1702: Input the second feature image into the second convolution branch so that the second convolution kernel and the third convolution kernel can capture the spatial correlation of the second feature image to obtain the thirteenth feature image used to express local spatial correlation.
[0195] Step S1703: Input the second feature image into the third convolution branch so that the fourth convolution kernel can capture the spatial correlation of the second feature image to obtain the fourteenth feature image used to express the orientation sensitivity.
[0196] Step S1704: Input the second feature image into the fourth convolution branch so that the fifth convolution kernel can capture the spatial correlation of the second feature image to obtain the fifteenth feature image used to express the orientation sensitivity.
[0197] Step S1705: Connect the first context feature image, the thirteenth feature image, and the fourteenth feature image through the branch connection layer to obtain the twelfth feature image.
[0198] In steps S1701 to S1705, the core modules of the dual-path collaborative detection head include a multi-branch block, a localization branch, and a classification branch. During the training phase, the dual-path collaborative detection head first extracts multi-scale shared features from the second feature image through the multi-branch block to obtain the twelfth feature image.
[0199] It should be noted that after obtaining the defect detection model, the following steps are included: Based on the zero-padding and parameter stacking method, the first, second, third, and fourth convolutional branches are merged in a reparameterized form to obtain the fifth convolutional branch. The fifth convolutional branch includes a K×K sixth convolutional kernel, achieving efficient computation during the inference stage. This design expands the feature representation space during training through branch diversity, and then uses reparameterization to convert the multi-branch structure into a single convolutional operation, thus maintaining lightweight operation during inference. This enhances feature diversity while avoiding additional computational overhead during the inference stage, solving the pain point of computational redundancy in traditional multi-branch structures.
[0200] Furthermore, in one possible embodiment, referring again to FIG16, the classification branch includes a classification convolutional layer and a CLS loss layer. The classification convolutional layer and the CLS loss layer are communicatively connected. The classification convolutional layer is provided with a binary cross-entropy loss function. Referring to FIG18, FIG18 is an optional flowchart of step S1502 in FIG15 provided in the embodiment of this application. The method may include, but is not limited to, steps S1801 to S1803.
[0201] Step S1801: By compressing the feature channels of the classification convolutional layer, the defect features of the twelfth feature image are mapped to a type to obtain the first defect type image.
[0202] Step S1802: Using the CLS loss layer, perform multi-type probability prediction and focus loss on each anchor point in the first defect type image to obtain the second defect type image.
[0203] Step S1803: Through the channel attention mechanism of the classification branch, the feature channels of the second defect type image are weighted to obtain the defect type probability distribution map.
[0204] In steps S1801 to S1803, the classification branch includes a classification convolutional layer and a CLS loss layer. For the twelfth feature image after feature enhancement of the multi-variable branch blocks, the classification convolutional layer performs type mapping on the defect features of the twelfth feature image through compressed feature channels using a 1×1 convolutional kernel, generating a first defect type image with category-related feature mapping. Then, the CLS loss layer uses a binary cross-entropy loss function to perform multi-class probability prediction for each anchor point in the first defect type image, and combines a focus loss mechanism to alleviate the class imbalance problem, obtaining a second defect type image. To adapt to the singleness of image features, the classification branch also introduces a channel attention mechanism, dynamically weighting the features of different channels in the second defect type image to enhance the expressive power of key information.
[0205] Furthermore, in one possible embodiment, referring again to FIG16, the localization branch includes a detection box convolutional layer, a DFL loss layer, and a CIOU loss layer. The detection box convolutional layer is communicatively connected to the DFL loss layer, and the DFL loss layer is communicatively connected to the CIOU loss layer. The DFL module is provided with a cross-entropy loss function. Referring to FIG19, FIG19 is an optional flowchart of step S1503 in FIG15 provided in the embodiment of this application. The method may include, but is not limited to, steps S1901 to S1903.
[0206] Step S1901: Through the detection box convolutional layer, the twelfth feature image is channel-adjusted to obtain the first defect location image with bounding box attributes.
[0207] Step S1902: Using the DFL loss layer, the bounding box coordinates in the first defect location image are discretized and optimized by regression to obtain the second defect location image.
[0208] Step S1903: Using the CIOU loss layer, the overlapping areas, center point distance, and aspect ratio of the second defect location image are weighted and adjusted to obtain the defect location distribution map.
[0209] In steps S1901 to S1903, firstly, for the twelfth feature image after feature enhancement of the diversified branch block, the detection box convolutional layer adjusts the channels of the twelfth feature image to generate a first defect location image with initial bounding box predictions. Then, the DFL loss layer performs regression optimization on the bounding box coordinate values in the first defect location image through discretized distribution prediction, transforming its continuous bounding box coordinate values into a probability distribution of 16 reference values, and using the cross-entropy loss function to guide the network to focus on the prediction region near the true value, obtaining a second defect location image with optimized true coordinates. Finally, the CIOU loss layer dynamically adjusts the weights of the overlapping region, center point distance, and aspect ratio of the second defect location image through the CIOU loss function, thereby improving the bounding box regression accuracy in the defect location distribution map. This localization branch, through multi-level feature fusion and geometric constraints, can significantly improve the robustness of localization of blurred or small targets in the image.
[0210] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned method for detecting defects in insulator strings using a drone. This electronic device can be any smart terminal, including mobile phones, tablets, and in-vehicle computers.
[0211] Please refer to Figure 20, which is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application. The electronic device includes:
[0212] The processor 2001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the UAV-based defect detection method for insulator strings provided in the embodiments of this application.
[0213] The memory 2002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 2002 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 2002 and is called and executed by the processor 2001 to execute the UAV-based defect detection method for insulator strings provided in the embodiments of this application.
[0214] Input / output interface 2003 is used to implement information input and output;
[0215] The communication interface 2004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0216] Bus 2005 transmits information between various components of the device (e.g., processor 2001, memory 2002, input / output interface 2003, and communication interface 2004);
[0217] The processor 2001, memory 2002, input / output interface 2003 and communication interface 2004 are connected to each other within the device via bus 2005.
[0218] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, provides a method for detecting defects in insulator strings using a drone.
[0219] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0220] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0221] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0222] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0223] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0224] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0225] It should be understood that in this application, "at least one (item)" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0226] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0227] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0228] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0229] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0230] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A defect detection method for insulator strings using a UAV, characterized in that, This includes: acquiring target images of insulator strings captured by drones, and a defect detection model built based on improved YOLOv5 convolutional layers; The defect detection model is used to detect defects in the target image to obtain the defect detection result of the insulator string. The construction process of the defect detection model includes the following steps: acquiring multiple sample images, which are images of insulator strings marked with defects; initializing a network architecture based on YOLOv5 convolutional layers, the network architecture including a grouping and dimensionality-upgrading module for convolutional processing of the target image, a multi-scale attention module for extracting defect features from the target image, and a dual-path collaborative detection head for defect inference of the target image. The grouping and dimensionality-upgrading module is communicatively connected to the multi-scale attention module, and the multi-scale attention module is communicatively connected to the dual-path collaborative detection head. The grouping and dimensionality-upgrading module includes a dual-channel extended architecture and a group convolutional module, the dual-channel extended architecture being communicatively connected to the group convolutional module. The dual-path collaborative detection head includes a multi-variable branch block, a localization branch, and a classification branch, the multi-variable branch block being communicatively connected to the localization branch and the classification branch, respectively; and training the network architecture based on the multiple sample images to obtain the defect detection model.
2. The defect detection method according to claim 1, characterized in that, The step of iteratively training the network architecture based on multiple sample images to obtain the defect detection model includes the following steps: inputting the sample images into the grouping and dimensionality-upgrading module for feature expansion to obtain a first feature image; inputting the first feature image into the multi-scale attention module for multi-scale feature extraction to obtain a second feature image; inputting the second feature image into the dual-path collaborative detection head for defect prediction to obtain a defect prediction image; pairing the defect prediction image with the sample images to obtain difference data between the sample images and the defect prediction images; calculating the gradient difference based on the loss function to obtain the gradient loss value for the current iteration; updating the multi-layer network parameters of the network architecture through backpropagation using an iterative optimizer based on the gradient loss value; and terminating the iterative training of the network architecture if the multi-layer network parameters meet preset training requirements to obtain the defect detection model.
3. The defect detection method according to claim 2, characterized in that, The step of inputting the sample image into the grouped dimensionality expansion module for feature expansion to obtain a first feature image includes the following steps: inputting the sample image into the input layer of the network architecture for feature extraction to obtain a second feature image, the second feature image including multiple feature channels; inputting the second feature image into the dual-channel expansion architecture for feature expansion to obtain a third feature image, the third feature image having more feature channels than the second feature image; inputting the third feature image into the grouped convolution module for feature compression to obtain the first feature image, the first feature image having fewer feature channels than the third feature image.
4. The defect detection method according to claim 3, characterized in that, The dual-channel expansion architecture includes an expansion path and a compensation path. The expansion path includes a first convolutional layer and a multilayer perceptron, and the compensation path includes a second convolutional layer and a feature decoupler. The expansion path and the compensation path are related and run in parallel. The step of inputting the second feature image into the dual-channel expansion architecture for feature expansion to obtain a third feature image includes the following steps: inputting the second feature image into the first convolutional layer for convolution, and then using the multilayer perceptron to expand the convolutional first feature image by combining feature channels to obtain a fourth feature image. The fourth feature image includes a first feature channel for expressing the fusion of local texture features and global structural features of the sample image. The second feature image is then input into the second convolutional layer for convolution, and the feature decoupler further expands the convolutional first feature image by decomposing feature channels to obtain a fifth feature image. The fifth feature image includes a second feature channel for expressing the edge detail features of the sample image. Finally, the fourth feature image and the fifth feature image are concatenated by channel dimension to obtain the third feature image.
5. The defect detection method according to claim 3, characterized in that, The step of inputting the third feature image into the group convolution module for feature compression to obtain the first feature image includes: grouping all feature channels of the third feature image to obtain a grouped third feature image, wherein the grouped third feature image includes multiple channel groups and each channel group includes multiple feature channels; performing convolution operations on all channel groups of the third feature image to obtain a first feature image set corresponding to the third feature image, wherein the first feature image set includes multiple feature sub-images and the feature sub-images are mapped to the channel groups; and performing image stitching on all feature sub-images in the first feature image set to obtain the first feature image.
6. The defect detection method according to claim 5, characterized in that, The step of grouping all feature channels of the third feature image to obtain the grouped third feature image includes: obtaining the preset number of feature channels output by the grouping and dimensionality-upgrading module, and determining the first number of feature channels of the third feature image; determining the greatest common divisor between the first number of feature channels and the preset number of feature channels as the dynamic grouping number of the third feature image; and grouping all feature channels of the third feature image equally according to the dynamic grouping number to obtain the grouped third feature image.
7. The defect detection method according to claim 2, characterized in that, The multi-scale attention module includes a multi-scale pooling layer and a pooling attention mechanism layer. The multi-scale pooling layer is communicatively connected to the pooling attention mechanism layer. The multi-scale pooling layer includes a spatial pyramid pooling layer, a multi-scale group convolutional layer, and an upsampling layer. The spatial pyramid pooling layer is communicatively connected to the multi-scale group convolutional layer, and the multi-scale group convolutional layer is communicatively connected to the upsampling layer. The step of inputting the first feature image into the multi-scale attention module for multi-scale feature extraction to obtain a second feature image includes the following steps: inputting the first feature image into the spatial pyramid pooling layer for multi-scale feature extraction to obtain multiple sixth feature images, where the spatial scales of two sixth feature images are the same or different; performing group convolution compression on the multiple sixth feature images at the same spatial scale based on the multi-scale group convolutional layer to obtain multiple seventh feature images with different spatial scales; performing channel concatenation on the multiple seventh feature images through the upsampling layer to obtain a multi-scale fused eighth feature image; and inputting the eighth feature image into the pooling attention mechanism layer for feature enhancement to obtain the second feature image used to highlight the features of the defect region.
8. The defect detection method according to claim 7, characterized in that, The multi-scale attention module further includes a pooling attention mechanism layer, which includes a channel attention module and a spatial attention module. The channel attention module is communicatively connected to the output layer of the multi-scale pooling layer, and the spatial attention module is communicatively connected to the channel attention module. The channel attention module includes a fully connected layer, and the spatial attention module includes a convolutional layer. Both the convolutional layer and the fully connected layer have a Sigmoid activation function. The step of inputting the eighth feature image into the pooling attention mechanism layer for feature enhancement to obtain a second feature image for highlighting defect region features includes the following steps: performing global average pooling on the eighth feature image through the channel attention module to obtain the channel description vector of the eighth feature image; and performing Sigmoid activation in the fully connected layer... The active function calculates the weights of the channel description vectors to obtain the channel attention weights corresponding to the eighth feature image. The channel attention weights are multiplied by each feature channel in the eighth feature image through the fully connected layer to obtain the channel-weighted ninth feature image. The ninth feature image is then fed to the spatial attention module for max pooling and average pooling to obtain the max-pooled spatial description tenth feature image and the average-pooled spatial description eleventh feature image. The spatial description weights between the tenth and eleventh feature images are calculated using the sigmoid activation function in the fully connected layer to obtain the spatial attention weights. Finally, the spatial attention weights are multiplied by each feature channel of the ninth feature image through the convolutional layer to obtain the second feature image.
9. The defect detection method according to claim 2, characterized in that, The step of inputting the second feature image into the dual-path collaborative detection head for defect prediction to obtain a defect prediction image includes the following steps: inputting the second feature image into the multi-source branch block for feature enhancement to obtain a twelfth feature image; calculating the type probability of the defect features in the twelfth feature image through the classification branch to obtain a defect type probability distribution map; mapping the coordinates of the defect features in the twelfth feature image through the localization branch to obtain a defect location distribution map; and combining the defect type probability distribution map and the defect location distribution map in the output layer of the dual-path collaborative detection head to obtain the defect prediction image.
10. The defect detection method according to claim 9, characterized in that, The diversified branch block includes a first convolutional branch, a second convolutional branch, a third convolutional branch, a fourth convolutional branch, and a branch connection layer. The first convolutional branch includes a 1×1 first convolutional kernel, the second convolutional branch includes a 1×1 second convolutional kernel and a K×K third convolutional kernel, the second convolutional kernel and the third convolutional kernel are communicatively connected, the third convolutional branch includes a 1×K fourth convolutional kernel, and the fourth convolutional branch includes a K×1 fifth convolutional kernel. Furthermore, the step of inputting the second feature image into the diversified branch block for feature enhancement to obtain the twelfth feature image includes the following steps: inputting the second feature image into the first convolutional branch, so that the first convolutional kernel performs average pooling on the second feature image to obtain a context feature image for expressing global context information; inputting the second feature image into the second convolutional branch, so that the second convolutional kernel and the third convolutional kernel perform spatial correlation capture on the second feature image to obtain a thirteenth feature image for expressing local spatial correlation; inputting the second feature image into the third convolutional branch, so that the fourth convolutional kernel performs spatial correlation capture on the second feature image to obtain a thirteenth feature image for expressing local spatial correlation. The fourteenth feature image expressing direction sensitivity is obtained; the second feature image is input into the fourth convolutional branch so that the fifth convolutional kernel performs spatial correlation capture on the second feature image to obtain the fifteenth feature image for expressing direction sensitivity; the context feature image, the thirteenth feature image, and the fourteenth feature image are connected through the branch connection layer to obtain the twelfth feature image; and after obtaining the defect detection model, the following steps are included: based on the zero-padding and parameter superposition method, the first convolutional branch, the second convolutional branch, the third convolutional branch, and the fourth convolutional branch are merged in a reparameterized form to obtain the fifth convolutional branch, which includes a K×K sixth convolutional kernel.
Citation Information
Patent Citations
Insulator defect image detection method based on improved YOLOv5 network
CN115861263A
Lightweight insulator defect detection method based on improved YOLOv7-tiny
CN117392102A