Two-stage insulator defect detection method based on aerial image

By adopting two-stage detection method and image preprocessing technology in insulator defect detection, the problems of complex background, obstruction and blurred image and low brightness are solved, and more efficient and accurate insulator defect detection is achieved.

CN119515802APending Publication Date: 2025-02-25THE INST OF AUTOMATION HEILONGJIANG ACADEMY OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411550411.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing insulator defect detection technology faces the problems of complex background, blurred occlusion, and low brightness, resulting in low detection efficiency and poor accuracy.

Method used

The two-stage insulator defect detection method based on aerial images is adopted. First, the lightweight YOLOv5 is used to detect the insulator, and the image quality is improved through gamma correction and image sharpening processing, and finally, the defect identification network is used to determine the defect.

Benefits of technology

Through two-stage design and image preprocessing technology, the background interference and occlusion impact are effectively reduced, and the accuracy and efficiency of insulator defect detection are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119515802A_ABST
    Figure CN119515802A_ABST
Patent Text Reader

Abstract

The invention discloses a two-stage insulator defect detection method based on an aerial image, and provides a two-stage insulator defect detection framework composed of an insulator detection network and an insulator defect identification network, and the insulator detection network is used for carrying out regression on the position and the size of an insulator. And the defect identification network is responsible for judging whether the insulator falls off a cap, rusts and fractures or not. According to the method, a two-stage design is adopted, so that the influence of a complex background on defect detection can be eliminated, the negative influence caused by shielding to a certain degree is avoided, and in order to relieve motion blur and low brightness of an insulator image, the sharpness and the brightness of the image are improved by adopting non-sharp masking and automatic gamma correction; and then the improved image is used as the input of the insulator defect identification network to judge whether the insulator is damaged, and the method has robustness to environmental noise so as to improve the accuracy of the defect identification network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of insulator defect detection, and in particular to a two-stage insulator defect detection method based on aerial images. Background Art

[0002] The normal operation of the electrical system is important for the development of society and human life. The power transmission system consists of electric towers, transmission lines, insulators, etc. Insulators are responsible for providing electrical insulation and mechanical support for transmission lines. Long-term exposure to the natural environment will lead to the corruption of electrical insulators, such as cap drop, rust, breakage, etc., which is a great threat to the power system. The unstable operation or even fall of the power system will cause huge economic losses. Therefore, the State Grid Corporation needs to arrange personnel to conduct regular defect inspections to detect whether electrical components such as insulators are normal. However, manual inspection requires not only professional knowledge, but also sufficient human resources, which is costly and inefficient. Transmission lines may be located in mountainous areas, rivers, and forests, making it difficult to identify defects. With the development of drones, defect identification methods based on drones have received widespread attention. Compared with manual methods, defect detection of transmission lines will be safer, more convenient, and more efficient. Optical images captured by drones play an important role in defect detection of insulators. It is non-trivial to process defect identification of insulators using traditional image processing methods and hand-crafted image features. With the development of computer vision and deep learning, object detection has made unprecedented progress, which brings hope to the automatic identification of insulator defects.

[0003] Insulator inspection and defect detection face three major challenges: 1) complex background; 2) occlusion; 3) blurred images and low brightness. First, transmission lines may be located in rivers, mountains, farms, forests, snowfields, cities, etc. The environment in these areas is relatively complex, which will cause great interference to insulator inspection and defect detection. Secondly, insulators and their defects may be hidden by other objects or themselves. Finally, since the optical image of the insulator is captured by a drone flying along the transmission line, motion blur is inevitable on the image. The captured image may show low brightness due to insufficient brightness or automatic exposure. In summary, the above factors make insulator inspection and defect detection extremely challenging. Summary of the invention

[0004] The object of the present invention is to provide a two-stage insulator defect detection method based on aerial images to solve the problems raised in the above background technology.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] The two-stage insulator defect detection method based on aerial images includes the following steps:

[0007] Lightweight YOLOv5 is used to detect insulators, which reduces the number of parameters, improves the running speed, and deploys the model on embedded or mobile devices;

[0008] YOLOv5 consists of three parts: backbone module, neck module and head module. The convolution block and C3 block sequentially form the backbone module. The convolution block consists of convolution, batch normalization, and sigmoid linear unit function. The C3 block locally fuses features from different layers to obtain detailed feature maps. The neck module organizes feature pyramids to fuse semantic features and enhances the feature representation ability of the network. The feature maps from the early network are connected with the new downsampled features in the neck module, which allows us to obtain both fine-grained information from the early feature maps and meaningful semantic information from the new feature maps. In order to improve the detection accuracy of the model, SPPF is applied in the neck module. The feature maps from the convolution are pooled through MaxPooling layers of different sizes and then connected. The head module is the final prediction module for generating detection results. In order to achieve high accuracy, three different head networks are used to predict bounding boxes at three different scales. Three bounding boxes for each grid cell are predicted in the formula of corresponding coordinates (x, y), confidence, and classification scores. The offset relative to the upper left corner of the grid cell (Δ x , Δ y ), and the size of the bounding box relative to the prior:

[0009] Δ x =(2·σ(t x )-0.5)

[0010] Δ y =(2·σ(t y )-0.5)

[0011] x=c x +Δ x

[0012] y=c y +Δ y

[0013] w=p w ·(2·σ(t w )) 2

[0014] h=p h ·(2·σ(t h )) 2

[0015] Where σ is the sigmoid linear unit function, (c x , c y) represents the coordinate of the upper left corner of the grid cell, (w, h) represents the size of the bounding box, (p w , p h ) represents the prior size of a specific object;

[0016] The location of the bounding box is supervised using the complete intersection over joint loss:

[0017]

[0018] CIOU=DIOU-αυ

[0019] L CIOU =1-CIOU

[0020] Where (x lt ,y lt ), (x rb ,y rb ), (x mid ,y mid ) represent the upper left, lower right and center coordinates of the predicted bounding box, respectively. Represent the upper left, lower right and center coordinates of the actual bounding box, S 1 and S 2 are the intersection and union areas of the predicted value and the ground truth bounding box, respectively, ρ is the center distance between the predicted value and the ground truth bounding box, c is the diagonal distance of the minimum bounding box between the predicted value and the ground truth bounding box, υ is the aspect ratio similarity between the predicted value and the ground truth bounding box, and α is the influencing factor related to υ;

[0021] Binary cross entropy loss is used to supervise the generation of confidence scores:

[0022] L conf =-(mlog(p(m))+(1-m)log(1-p(m)))

[0023] Where m represents the ground truth category, p(m) represents the probability of belonging to m, and the classification loss uses the cross entropy loss function:

[0024]

[0025] The overall loss of the insulator detection network is expressed as:

[0026] L=λ CIOU L CIOU +λ conf L conf +λ class L class

[0027] where λ CIOU , conf ,class Weights to balance the contributions of different loss terms;

[0028] Gamma correction: Due to building occlusion, weather conditions and camera auto-exposure, the captured image may show lower or higher brightness, which is a disturbance to insulator defect inspection. It is critical to keep the image brightness within the normal range. Gamma correction was originally developed to compensate for the nonlinear characteristics of cathode ray tubes and is now widely used in modern image processing algorithms:

[0029] I output =α*(I input / 255)γ*255

[0030] Among them I input ,I output Represent the input and output images respectively, α represents the multiplication coefficient. Because the image value is between 0 and 255, the image needs to be multiplied by 1 / 255 before the exponential operation. Gamma correction can offset the nonlinearity through exponential transformation to make the image have the expected brightness. In order to achieve automatic brightness adjustment, the gamma value is calculated as follows:

[0031]

[0032] Among them I mean Represents the average color of the image;

[0033] Image sharpening: Since images of insulators captured by flying drones may cause motion blur to the images, thus affecting the accuracy of the defect recognition network, it is necessary to use sharpening methods to improve the clarity of the images. Classic image sharpening methods, such as Laplace sharpening, perform Laplace transform on the image to improve edge details:

[0034]

[0035] The second-order partial differential Laplace transform of the image is expressed as:

[0036]

[0037] Obviously, the Laplace transform on the image can be organized into a kernel function, [0, 1, 0], [1, -4, 1], [0, 1, 0]. The formula is simple and effective, but the linear high-pass filter is often affected by noise, resulting in unsatisfactory results. Over-enhancement will occur in the edge area of ​​the image, which may introduce more noise to the image and produce unnatural results. To solve this problem, we use a different non-sharp masking method, take the unit kernel, subtract the Gaussian filter kernel, and calculate the kernel:

[0038] K=s*(EG)

[0039] Where E is the unit kernel, G is the Gaussian kernel, and s is the enhancement amplitude. As the kernel size increases, the contrast of the image becomes higher, and due to the nonlinearity and non-sparseness of the kernel function, the image has no obvious noise enhancement.

[0040] As a further solution of the present invention: the detection model needs to be deployed on an embedded or mobile device with insufficient computability. The parameters of ordinary YOLOv5 are too large, and it is impractical to deploy it directly in a production environment. Therefore, in order to save computing resources and not affect the detection accuracy, we proposed a lightweight YOLOv5 and replaced ordinary convolution with depthwise separable convolution in the backbone module. The depthwise separable convolution replaces the vanilla convolution with depthwise convolution and pointwise convolution, which greatly saves the computational complexity. The dimensions of the vanilla convolution kernel, the depthwise convolution kernel, and the pointwise convolution kernel are K×K×M×N, K×K×1×M, and 1×1×M×N, respectively. Obviously, the depthwise separable convolution greatly reduces the spatial complexity.

[0041] Compared with the prior art, the present invention has the following beneficial effects:

[0042] The present invention proposes a two-stage insulator defect detection framework consisting of an insulator detection network and an insulator defect recognition network. The insulator detection network is used to regress the position and size of the insulator, and the defect recognition network is responsible for determining whether the insulator is capped, rusted, or broken. The present invention adopts a two-stage design, which enables us to eliminate the influence of complex background on defect detection and avoid the negative impact caused by a certain degree of occlusion. In order to alleviate the motion blur and low brightness of the insulator image, the present invention uses unsharp masking and automatic gamma correction to improve the clarity and brightness of the image, and then uses the improved image as the input of the insulator defect recognition network to determine whether the insulator is damaged. The two-stage insulator defect detection framework of the present invention decomposes insulator detection into two subtasks, positioning and defect recognition, and is robust to environmental noise to improve the accuracy of the defect recognition network. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 An overview of the framework of the two-stage insulator defect detection method based on aerial images.

[0044] Figure 2 This is the insulator detection network diagram in the two-stage insulator defect detection method based on aerial images.

[0045] Figure 3 Depthwise separable convolutional graph in the two-stage insulator defect detection method based on aerial images.

[0046] Figure 4Original image and preprocessed image in the two-stage insulator defect detection method based on aerial images.

[0047] Figure 5 This is a visual effect diagram of the two-stage insulator defect detection method based on aerial images. DETAILED DESCRIPTION

[0048] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0049] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0050] In addition, in order to better illustrate the present application, numerous specific details are provided in the specific embodiments below. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, and elements well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0051] Embodiment 1

[0052] The two-stage insulator defect detection method based on aerial images includes the following steps:

[0053] The framework of the present invention is summarized as follows Figure 1 As shown in Figure 2, accurate positioning of insulators is the guarantee for defect identification. The detailed structure of the insulator detection network is shown in Figure 2. Figure 2 shown.

[0054] Lightweight YOLOv5 is used to detect insulators, which reduces the number of parameters, improves the running speed, and deploys the model on embedded or mobile devices;

[0055] YOLOv5 consists of three parts: backbone module, neck module and head module. The convolution block and C3 block sequentially form the backbone module. The convolution block consists of convolution, batch normalization, and sigmoid linear unit function. The C3 block locally fuses features from different layers to obtain detailed feature maps. The neck module organizes feature pyramids to fuse semantic features and enhances the feature representation ability of the network. The feature maps from the early network are connected with the new downsampled features in the neck module, which allows us to obtain both fine-grained information from the early feature maps and meaningful semantic information from the new feature maps. In order to improve the detection accuracy of the model, SPPF is applied in the neck module. The feature maps from the convolution are pooled through MaxPooling layers of different sizes and then connected. The head module is the final prediction module for generating detection results. In order to achieve high accuracy, three different head networks are used to predict bounding boxes at three different scales. Three bounding boxes for each grid cell are predicted in the formula of corresponding coordinates (x, y), confidence, and classification scores. The offset relative to the upper left corner of the grid cell (Δ x , Δ y ), and the size of the bounding box relative to the prior:

[0056] Δ x =(2·σ(t x )-0.5)

[0057] Δ y =(2·σ(t y )-0.5)

[0058] x=c x +Δ x

[0059] y=c y +Δ y

[0060] w=p w ·(2·σ(t w )) 2

[0061] h=p h ·(2·σ(t h )) 2

[0062] Where σ is the sigmoid linear unit function, (c x , c y ) represents the coordinate of the upper left corner of the grid cell, (w, h) represents the size of the bounding box, (p w , p h ) represents the prior size of a specific object;

[0063] A modified logistic function is used to constrain the offset to fall between -0.5 and 1.5. To prevent gradient explosion and training instability, we use the logistic function instead of the exponential function when calculating the bounding box size.

[0064] The position of the bounding box is supervised using the complete intersection over joint loss:

[0065]

[0066] CIOU=DIOU-αυ

[0067] L CIOU =1-CIOU

[0068] Where (x lt ,y lt ), (x rb ,y rb ), (x mid ,y mid ) represent the upper left, lower right and center coordinates of the predicted bounding box, respectively. Represent the upper left, lower right and center coordinates of the actual bounding box, S 1 and S 2 are the intersection and union areas of the predicted value and the ground truth bounding box, respectively, ρ is the center distance between the predicted value and the ground truth bounding box, c is the diagonal distance of the minimum bounding box between the predicted value and the ground truth bounding box, υ is the aspect ratio similarity between the predicted value and the ground truth bounding box, and α is the influencing factor related to υ;

[0069] Binary cross entropy loss is used to supervise the generation of confidence scores:

[0070] L conf =-(mlog(p(m))+(1-m)log(1-p(m)))

[0071] Where m represents the ground truth category, p(m) represents the probability of belonging to m, and the classification loss uses the cross entropy loss function:

[0072]

[0073] The overall loss of the insulator detection network is expressed as:

[0074] L=λ CIOU L CIOU +λ conf L conf +λ class L class

[0075] where λ CIOU , conf ,class Weights to balance the contributions of different loss terms;

[0076] Due to long-term exposure to the natural environment, the cap of the insulator may rust or be lost, which may be small and difficult to detect. Therefore, the present invention organizes a special defect recognition network to detect the insulator. The defect recognition network is as follows: Figure 4 As shown. We regard the defect recognition of insulators as binary classification. The defect recognition network consists of 4 convolutional layers and 2 fully connected layers, where the activation function is ReLU function except the last layer. In order to ensure that the insulator is covered as much as possible in the cropped image, the present invention adds 30 pixels along the four directions of the bounding box, fills the image with squares with 0, and resizes it to 512×512. The softmax function is applied to the output of the last layer to achieve normalization, and the binary cross entropy loss is used to train the defect recognition network.

[0077] However, the accuracy of the defect recognition network is easily affected by low brightness and blur. Therefore, a hybrid method combining traditional image processing with deep learning is proposed. Specifically, in order to cope with the problems of low brightness and image blur, gamma correction and image sharpening strategies are used to preprocess the insulator images before feeding them to the defect recognition network.

[0078] Gamma correction: Due to building occlusion, weather conditions and camera auto-exposure, the captured image may show lower or higher brightness, which is a disturbance to insulator defect inspection. It is critical to keep the image brightness within the normal range. Gamma correction was originally developed to compensate for the nonlinear characteristics of cathode ray tubes and is now widely used in modern image processing algorithms:

[0079] I output =α*(I input / 255) γ *255

[0080] Among them I input ,I output Represent the input and output images respectively, α represents the multiplication coefficient. Because the image value is between 0 and 255, the image needs to be multiplied by 1 / 255 before the exponential operation. Gamma correction can offset the nonlinearity through exponential transformation to make the image have the expected brightness. In order to achieve automatic brightness adjustment, the gamma value is calculated as follows:

[0081]

[0082] Among them I mean Represents the average color of the image;

[0083] Image sharpening: Since images of insulators captured by flying drones may cause motion blur to the images, thus affecting the accuracy of the defect recognition network, it is necessary to use sharpening methods to improve the clarity of the images. Classic image sharpening methods, such as Laplace sharpening, perform Laplace transform on the image to improve edge details:

[0084]

[0085] The second-order partial differential Laplace transform of the image is expressed as:

[0086]

[0087] Obviously, the Laplace transform on the image can be organized into a kernel function, [0, 1, 0], [1, -4, 1], [0, 1, 0]. The formula is simple and effective, but the linear high-pass filter is often affected by noise, resulting in unsatisfactory results. Over-enhancement will occur in the edge area of ​​the image, which may introduce more noise to the image and produce unnatural results. To solve this problem, we use a different non-sharp masking method, take the unit kernel, subtract the Gaussian filter kernel, and calculate the kernel:

[0088] K=s*(EG)

[0089] Where E is the unit kernel, G is the Gaussian kernel, and s is the enhancement amplitude. As the kernel size increases, the contrast of the image becomes higher, and due to the nonlinearity and non-sparseness of the kernel function, the image has no obvious noise enhancement.

[0090] Preferably, the detection model needs to be deployed on embedded or mobile devices with insufficient computational power. The parameters of ordinary YOLOv5 are too large, and it is impractical to deploy it directly in a production environment. Therefore, in order to save computing resources and not affect the detection accuracy, we proposed a lightweight YOLOv5 and replaced ordinary convolution with depthwise separable convolution in the backbone module. Depthwise separable convolution replaces vanilla convolution with depthwise convolution and pointwise convolution, which greatly saves computational complexity. The calculation process is as follows: Figure 3 As shown, the dimensions of the vanilla convolution kernel, depthwise convolution kernel, and pointwise convolution kernel are K×K×M×N, K×K×1×M, and 1×1×M×N, respectively. It is obvious that the depthwise separable convolution greatly reduces the space complexity.

[0091] experiment:

[0092] Dataset

[0093] In order to verify the effectiveness of the framework of the present invention, an outdoor electrical insulator dataset was collected, which consists of 6,000 images captured only from drones flying over transmission lines. The resolution of the images is 5184×3888, which contains one or more insulators and complex backgrounds. However, the negative samples of the outdoor dataset do not cover all damage conditions of the insulator. Therefore, in order to make up for the shortcomings of the outdoor dataset, we constructed an indoor scene to simulate various damage conditions of the insulator, and captured a total of 4,000 images. The total number of images of the outdoor and indoor electrical insulator datasets is 10,000. The present invention uses 9,000 images for training, 800 images for testing, and 200 images for verification. The ratio of negative samples to positive samples is about 1:3. In order to save memory usage, the source images are uniformly padded to squares and resized to 640×640 in all detection experiments. In the defect recognition experiment, the images are cropped according to the detection results and resized to 512×512.

[0094] contrast

[0095] We compare electrical insulator detection with several state-of-the-art object detection methods Faster RCNN, YOLOv5, CenterNet on the collected datasets. The results of these methods are generated from the official implementation. The quantitative results are shown in Table 1. Although the detection accuracy of our method decreases slightly due to the introduction of depthwise separable convolutions, our method achieves the highest speed without significantly reducing the detection accuracy.

[0096]

[0097]

[0098] Table 1: Quantitative comparison

[0099] Based on the detection results of the insulator detection network, the present invention evaluates the performance of the hybrid defect recognition network. The standard for checking the insulator is to determine whether there is loose screws, missing screws, missing caps or rust. The defective insulator is considered to be a binary classification. The performance of the model is evaluated by calculating the prediction accuracy of the model. Only the convolutional network is used to detect insulators. Insulators are sensitive to the natural environment. In order to reduce the impact of the environment and improve the detection accuracy, hybrid detection is used, and gamma correction and unsharp masking are integrated into the defect recognition network. In order to evaluate the performance of gamma correction and unsharp masking, the present invention compares four variants, namely, the original image without preprocessing (Baseline), the original image after gamma correction but without unsharp masking (w / Gamma Correction), the original image with unsharp masking without gamma correction (w / Unsharp Masking), and the original image with gamma correction and unsharp masking (Full). Table 2 shows the quantitative comparison of the ablation study. It is obvious that the detection accuracy is significantly improved with the support of gamma correction and unsharp masking. Some visual results such as Figure 5 The model of the present invention can correctly detect and inspect the insulator.

[0100] accuracy Baseline 88.2% w / GammaCorrection 93.7% w / UnsharpMasking 94.6% Full 97.1%

[0101] Table 2: Quantitative comparison of ablation studies

[0102] This paper proposes a two-stage insulator defect detection framework, which consists of two networks, namely the insulator detection network and the defect recognition network. Based on the proposed framework, an automatic insulator defect detection system is constructed. The two-stage design can reduce the negative impact of the background, and the unsharp masking and gamma correction strategy eliminates the impact of camera motion and sunlight, effectively improving the image quality, so that the defect recognition network achieves a higher detection accuracy.

[0103] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, the embodiments should be considered exemplary and non-restrictive in all respects, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present invention.

[0104] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

Claims

1. A two-stage insulator defect detection method based on aerial images, characterized in that: The following steps are involved: Lightweight YOLOv5 is used to detect insulators, which reduces the number of parameters, improves the running speed, and deploys the model on embedded or mobile devices; YOLOv5 consists of three parts: backbone module, neck module and head module. The convolution block and C3 block sequentially form the backbone module. The convolution block consists of convolution, batch normalization, and sigmoid linear unit function. The C3 block locally fuses features from different layers to obtain detailed feature maps. The neck module organizes feature pyramids to fuse semantic features and enhances the feature representation ability of the network. The feature maps from the early network are connected with the new downsampled features in the neck module, which allows us to obtain both fine-grained information from the early feature maps and meaningful semantic information from the new feature maps. In order to improve the detection accuracy of the model, SPPF is applied in the neck module. The feature maps from the convolution are pooled through MaxPooling layers of different sizes and then connected. The head module is the final prediction module for generating detection results. In order to achieve high accuracy, three different head networks are used to predict bounding boxes at three different scales. Three bounding boxes for each grid cell are predicted in the formula of corresponding coordinates (x, y), confidence, and classification scores. The offset relative to the upper left corner of the grid cell (Δ x , Δ y ), and the size of the bounding box relative to the prior: D x =(2·σ(t x )-0.5) D y =(2·σ(t y )-0.5) x=c x +D x y=c y +D y w=p w ·(2·σ(t w )) 2 h=p h ·(2·σ(t h )) 2 Where σ is the sigmoid linear unit function, (c x , c y ) represents the coordinate of the upper left corner of the grid cell, (w, h) represents the size of the bounding box, (p w , p h ) represents the prior size of a specific object; The location of the bounding box is supervised using the complete intersection over joint loss: CIOU=DIOU-αυ L CIOU =1-CIOU Where (x lt ,y lt ), (x rb ,y rb ), (x mid ,y mid ) represent the upper left, lower right and center coordinates of the predicted bounding box, respectively. denote the upper left, lower right and center coordinates of the actual bounding box, respectively; S1 and S2 are the intersection and union areas of the predicted value and the ground truth bounding box, respectively; ρ is the center distance between the predicted value and the ground truth bounding box; c is the diagonal distance of the minimum bounding box between the predicted value and the ground truth bounding box; υ is the aspect ratio similarity between the predicted value and the ground truth bounding box; α is the influencing factor related to υ; Binary cross entropy loss is used to supervise the generation of confidence scores: L conf =-(mlog(p(m))+(1-m)log(1-p(m))) Where m represents the ground truth category, p(m) represents the probability of belonging to m, and the classification loss uses the cross entropy loss function: The overall loss of the insulator detection network is expressed as: L=λ CIOU L CIOU +λ conf L conf +λ class L class where λ CIOU , conf , class Weights to balance the contributions of different loss terms; Gamma correction: Due to building occlusion, weather conditions and camera auto-exposure, the captured image may show lower or higher brightness, which is a disturbance to insulator defect inspection. It is critical to keep the image brightness within the normal range. Gamma correction was originally developed to compensate for the nonlinear characteristics of cathode ray tubes and is now widely used in modern image processing algorithms: I output =α*(I input / 255) γ *255 Among them I input ,I output Represent the input and output images respectively, α represents the multiplication coefficient. Because the image value is between 0 and 255, the image needs to be multiplied by 1 / 255 before the exponential operation. Gamma correction can offset the nonlinearity through exponential transformation to make the image have the expected brightness. In order to achieve automatic brightness adjustment, the gamma value is calculated as follows: Among them I mean Represents the average color of the image; Image sharpening: Since images of insulators captured by flying drones may cause motion blur to the images, thus affecting the accuracy of the defect recognition network, it is necessary to use sharpening methods to improve the clarity of the images. Classic image sharpening methods, such as Laplace sharpening, perform Laplace transform on the image to improve edge details: The second-order partial differential Laplace transform of the image is expressed as: Obviously, the Laplace transform on the image can be organized into a kernel function, [0, 1, 0], [1, -4, 1], [0, 1, 0]. The formula is simple and effective, but the linear high-pass filter is often affected by noise, resulting in unsatisfactory results. Over-enhancement will occur in the edge area of ​​the image, which may introduce more noise to the image and produce unnatural results. To solve this problem, we use a different non-sharp masking method, take the unit kernel, subtract the Gaussian filter kernel, and calculate the kernel: K=s*(EG) Where E is the unit kernel, G is the Gaussian kernel, and s is the enhancement amplitude. As the kernel size increases, the contrast of the image becomes higher, and due to the nonlinearity and non-sparseness of the kernel function, the image has no obvious noise enhancement.

2. The two-stage insulator defect detection method based on aerial images according to claim 1 is characterized in that: The detection model needs to be deployed on embedded or mobile devices with insufficient computational power. The parameters of ordinary YOLOv5 are too large, and it is impractical to deploy it directly in a production environment. Therefore, in order to save computing resources and not affect the detection accuracy, we proposed a lightweight YOLOv5 and replaced ordinary convolution with depthwise separable convolution in the backbone module. Depthwise separable convolution replaces vanilla convolution with depthwise convolution and pointwise convolution, which greatly saves computational complexity. The dimensions of the vanilla convolution kernel, depthwise convolution kernel, and pointwise convolution kernel are K×K×M×N, K×K×1×M, and 1×1×M×N, respectively. Obviously, depthwise separable convolution greatly reduces the spatial complexity.