Power device defect detection method and apparatus, and computer device, readable storage medium and program product

By employing drone photography and adaptive weight adjustment, the accuracy problem of detecting minute defects in power equipment was solved, improving the localization and classification accuracy of the detection model, especially in power equipment defect detection under complex backgrounds.

WO2026242679A1PCT designated stage Publication Date: 2026-11-26GUANGZHOU POWER SUPPLY BUREAU GUANGDONG POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/089792
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-23
Filing Date
2026-04-10
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Existing computer vision technologies struggle to accurately detect minute defects on the surface of power equipment, such as cracks, corrosion, and scratches, especially in terms of positioning accuracy and defect detection against complex backgrounds.

Method used

Images of power equipment were captured by drones. Through image enhancement and annotation, a training sample set was constructed. The YOLO v8 model was used for defect detection. The total loss of the model was adjusted by adaptive weights, and the localization loss, classification loss, bounding box regression loss and defect region loss were optimized. The weights were dynamically adjusted to improve the detection accuracy.

Benefits of technology

It significantly improves the positioning accuracy and micro-defect detection capability of power equipment defects, especially in the detection of small-area defects on the equipment surface, and optimizes the classification accuracy of bounding boxes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026089792_26112026_PF_FP_ABST
    Figure CN2026089792_26112026_PF_FP_ABST
Patent Text Reader

Abstract

A power device defect detection method and apparatus, and a computer device, a computer-readable storage medium and a computer program product. The method comprises: using an unmanned aerial vehicle to photograph a power device to obtain a set of originally captured images, and performing annotation and image enhancement processing, so as to obtain a training sample set; inputting the training sample set into a defect detection model to be trained, so as to obtain a defect detection result; determining a positioning loss, a classification loss, a bounding box regression loss and a defect region loss between the defect detection result and defect annotation information; determining an adaptive weight; on the basis of the adaptive weight, the positioning loss, the classification loss, the bounding box regression loss and the defect region loss, determining a total model loss; and on the basis of the total model loss, performing parameter adjustment on the defect detection model to be trained, so as to obtain a trained defect detection model for performing defect detection on a power device.
Need to check novelty before this filing date? Find Prior Art

Description

Methods, apparatus, computer equipment, readable storage media and program products for detecting defects in power equipment

[0001] Related applications

[0002] This application claims priority to Chinese patent application filed on May 23, 2025, with application number 202510669211.2, entitled "Method, Apparatus, Computer Equipment, Readable Storage Medium and Program Product for Detecting Defects in Power Equipment", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of electrical technology, and in particular to a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for detecting defects in power equipment. Background Technology

[0004] With the construction of smart grids and the increasing demand for automated inspection of power equipment, traditional manual inspection methods are gradually failing to meet the requirements of efficiency and accuracy. In recent years, computer vision technology has been widely used in image recognition and defect detection of power equipment. However, due to the complex appearance of power equipment, cluttered backgrounds, and diverse defect types, traditional image processing methods still face many challenges in terms of positioning accuracy and defect detection.

[0005] Minor defects on the surface of equipment, such as cracks, corrosion, and scratches, are usually low-contrast local areas, which existing models struggle to detect accurately. Summary of the Invention

[0006] According to various embodiments of this application, a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for detecting defects in power equipment are provided.

[0007] In a first aspect, this application provides a method for detecting defects in power equipment, including:

[0008] The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0009] Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0010] The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

[0011] In one embodiment, determining the adaptive weights includes:

[0012] Obtain the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, the weights of the localization loss calculated in the previous training iteration, the gradient of the classification loss calculated in the previous training iteration, the weights of the classification loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, the weights of the bounding box regression loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weights of the defect region loss calculated in the previous training iteration. Based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, and the weights of the localization loss calculated in the previous training iteration, determine the weights of the current localization loss. The current classification loss weight is determined based on the gradient of the current localization loss, the gradient of the classification loss calculated in the previous training iteration, and the weight of the classification loss calculated in the previous training iteration. The current bounding box regression loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, and the weight of the bounding box regression loss calculated in the previous training iteration. The current defect region loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weight of the defect region loss calculated in the previous training iteration. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights.

[0013] In one embodiment, determining the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training samples includes:

[0014] Obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; determine the localization loss, bounding box regression loss, and defect region loss based on the bounding box output and the true bounding box; determine the classification loss based on the category output and the true category.

[0015] In one embodiment, determining the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss includes:

[0016] Obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, determine the weighted sum of the localization loss, the classification loss, the bounding box regression loss, and the defect region loss to obtain the total model loss.

[0017] In one embodiment, the annotation of each original image in the original image set includes:

[0018] For each original image in the original image set, bounding boxes are marked on the transformer and defect areas in the original image, and a category is marked for each marked bounding box, where the category is transformer or defect type.

[0019] In one embodiment, the image enhancement processing for each original captured image includes:

[0020] Each original captured image is subjected to at least one of the following processing methods: random rotation, scaling, and adding noise.

[0021] Secondly, this application also provides a power equipment defect detection device, comprising:

[0022] The acquisition module is used to use a drone to photograph power equipment to obtain a set of original images, to annotate each original image in the set of original images to obtain defect annotation information corresponding to each original image, and to perform image enhancement processing on each original image to obtain a device sample image corresponding to each original image; the device sample image and defect annotation information corresponding to each original image are used as a set of training samples, and multiple sets of training samples constitute a training sample set.

[0023] The training module is used to obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss and the defect region loss.

[0024] The detection module is used to adjust the parameters of the defect detection model to be trained based on the total model loss, and to continue training the defect detection model with adjusted parameters based on the training sample set until the calculated total model loss reaches a preset condition, thereby obtaining a trained defect detection model; the trained defect detection model is used to detect defects in power equipment.

[0025] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0026] The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0027] Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0028] The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

[0029] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0030] The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0031] Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0032] The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

[0033] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0034] The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0035] Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0036] The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

[0037] Details of one or more embodiments of the present invention are set forth in the following drawings and description. Other features, objects, and advantages of the invention will become apparent from the specification, drawings, and claims. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 is a flowchart illustrating a method for detecting defects in power equipment in one embodiment;

[0040] Figure 2 is a detailed flowchart of a power equipment defect detection method in one embodiment;

[0041] Figure 3 is a structural block diagram of a power equipment defect detection device in one embodiment;

[0042] Figure 4 is an internal structure diagram of a computer device in one embodiment. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0044] 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.

[0045] In one embodiment, as shown in Figure 1, a method for detecting defects in power equipment is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0046] Step 102: Use a drone to photograph the power equipment to obtain a set of original images. Label each original image in the set to obtain defect labeling information corresponding to each original image. Perform image enhancement processing on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0047] Optionally, photographing power equipment includes capturing images of equipment such as transmission lines and transformers. The resulting raw image set can be RGB images or infrared images.

[0048] Image enhancement is an image processing technique designed to improve the visual quality of an image or highlight specific information within it to meet the needs of different application scenarios.

[0049] For example, a drone is used to photograph equipment such as power transmission lines and transformers along a preset flight path to obtain a set of original images including RGB and infrared images. Each original image in the set is labeled using LabelImg to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples, and multiple sets of training samples constitute a training sample set.

[0050] LabelImg is a commonly used image annotation software.

[0051] Step 104: Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0052] Optionally, the defect detection model can be YOLO v8, with the initial defect detection model being a YOLO v8 pre-trained model on the COCO dataset. The localization loss can be Smooth L1 loss; the classification loss can be cross-entropy loss; the bounding box regression loss can be IOU loss; and the defect region loss can be Dice coefficient loss.

[0053] The adaptive weights include the weights for each loss.

[0054] Step 106: Adjust the parameters of the defect detection model to be trained based on the total model loss, and continue to train the defect detection model with adjusted parameters based on the training sample set until the calculated total model loss reaches the preset condition, thereby obtaining a trained defect detection model; the trained defect detection model is used to detect defects in power equipment.

[0055] The preset condition for the total model loss to reach the target value is when the total model loss calculated at the current time is not less than the total model loss calculated at the previous training time.

[0056] Optionally, the preset condition can be that the total loss of the current model is not less than the total loss of the previous training round.

[0057] The aforementioned power equipment defect detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product utilize a drone to photograph power equipment, obtaining a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a corresponding equipment sample image. The equipment sample image and defect labeling information corresponding to each original image serve as a set of training samples, and multiple sets of training samples constitute a training sample set. Any set of training samples is obtained from the training sample set, and the equipment sample image from the current training sample is input into the defect detection model to be trained. The method involves obtaining defect detection results; determining the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection results and the defect annotation information in the current training samples; determining adaptive weights; determining the total model loss based on the adaptive weights, localization loss, classification loss, bounding box regression loss, and defect region loss; adjusting the parameters of the defect detection model to be trained based on the total model loss; and continuing to train the parameter-adjusted defect detection model based on the training sample set until the calculated total model loss reaches a preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment. This method can more accurately detect defect regions in transformers.

[0058] In one exemplary embodiment, determining the adaptive weights includes:

[0059] Obtain the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, the weights of the localization loss calculated in the previous training iteration, the gradient of the classification loss calculated in the previous training iteration, the weights of the classification loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, the weights of the bounding box regression loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weights of the defect region loss calculated in the previous training iteration. Based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, and the weights of the localization loss calculated in the previous training iteration, determine the weights of the current localization loss. The current classification loss weight is determined based on the gradient of the current localization loss, the gradient of the classification loss calculated in the previous training iteration, and the weight of the classification loss calculated in the previous training iteration. The current bounding box regression loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, and the weight of the bounding box regression loss calculated in the previous training iteration. The current defect region loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weight of the defect region loss calculated in the previous training iteration. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights.

[0060] In this context, "previous training" refers to the model undergoing multiple training rounds during iterative training. The steps are the same for each training round, but the model's parameters are updated in real time.

[0061] For example, the gradients of the total model loss calculated in the previous training iteration, the gradients of the localization loss calculated in the previous training iteration, the weights of the localization loss calculated in the previous training iteration, the gradients of the classification loss calculated in the previous training iteration, the weights of the classification loss calculated in the previous training iteration, the gradients of the bounding box regression loss calculated in the previous training iteration, the weights of the bounding box regression loss calculated in the previous training iteration, the gradients of the defect region loss calculated in the previous training iteration, and the weights of the defect region loss calculated in the previous training iteration are obtained; based on the gradients of the total model loss calculated in the previous training iteration, the gradients of the classification loss calculated in the previous training iteration, and the weights of the classification loss calculated in the previous training iteration... The following steps are taken to determine the weights of the current classification loss, the current bounding box regression loss, and the current defect region loss: First, the weights of the current localization loss, classification loss, bounding box regression loss, and defect region loss are determined. Second, the weights of the current localization loss, classification loss, and defect region loss together constitute the adaptive weights. The formulas for calculating the weights of these different losses are as follows:

[0062] Where i represents different losses, It is the weight of the current i loss. These are the weights of the loss calculated in the previous training iteration. It is the gradient of the total model loss calculated in the previous training iteration. It is the gradient of the loss i calculated in the previous training, and α is the step size, which controls the rate of weight adjustment.

[0063] In this embodiment, different weights for the loss are calculated, and the weights can be dynamically adjusted according to the needs of different tasks to ensure that the model performs well in both localization and defect detection.

[0064] In an exemplary embodiment, determining the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training samples includes:

[0065] Obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; determine the localization loss, bounding box regression loss, and defect region loss based on the bounding box output and the true bounding box; determine the classification loss based on the category output and the true category.

[0066] For example, obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; calculate the localization loss L based on the bounding box output and the true bounding box. loc The formula is as follows:

[0067] Where, x i These are the actual coordinates of the i-th pixel within the true bounding box. These are the predicted coordinates in the bounding box output, and N is the number of pixels in the bounding box output.

[0068] The bounding box regression loss L is calculated based on the bounding box output and the ground truth bounding box. bbox The calculation formula is as follows:

[0069] Among them, A pred It is the bounding box region in the bounding box output, A true These are the bounding box regions within the true bounding box, where ∩ represents the intersection and ∪ represents the union. The defect region loss L is calculated based on the bounding box output and the true bounding box. defect The calculation formula is as follows:

[0070] Where, p i It is the defect region in the bounding box output, d i Let be the defect region within the true bounding box, i be the number of pixels in the bounding box output, and N be the number of pixels in the bounding box output. Based on the output class and the true class, the classification loss is calculated using the following formula:

[0071] Among them, y i These are labels for the real category. is the predicted class probability, and N is the number of all classes.

[0072] In this embodiment, by calculating the positioning loss and bounding box regression loss, the positioning accuracy of power equipment can be significantly improved, while the defect area loss enhances the detection capability of small defects, especially in the detection of small-scale defects on the equipment surface, and the classification loss optimizes the classification accuracy of all bounding boxes.

[0073] In an exemplary embodiment, determining the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss includes:

[0074] Obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, determine the weighted sum of the localization loss, the classification loss, the bounding box regression loss, and the defect region loss to obtain the total model loss.

[0075] For example, obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, calculate the weighted sum of the localization loss, classification loss, bounding box regression loss, and defect region loss to obtain the total model loss, calculated using the following formula: L total =λ1L loc +λ2L cls +λ3L bbox +λ4L defect

[0076] Where λ1 is the weight of the localization loss, L loc λ² is the localization loss, λ² is the weight of the classification loss, and L is the localization loss. cls λ3 is the classification loss, λ3 is the weight of the bounding box regression loss, and L is the weight of the bounding box regression loss. bbox The bounding box regression loss is λ4, which is the weight of the defect region loss. defect It refers to the loss in the defective area.

[0077] In this embodiment, the total model loss is obtained by calculating the weighted sum of the localization loss, classification loss, bounding box regression loss, and defect region loss through dynamically adjusted adaptive loss, which can conveniently control the direction of model optimization.

[0078] In an exemplary embodiment, the annotation of each original image in the original image set includes:

[0079] For each original image in the original image set, bounding boxes are marked on the transformer and defect areas in the original image, and a category is marked for each marked bounding box, where the category is transformer or defect type.

[0080] Optionally, the defect types can be: cracks, corrosion, scratches, etc.

[0081] For example, for each original image in the original image set, the transformer and defect areas on the original image are labeled with bounding boxes, and each labeled bounding box is labeled with a category, which is a transformer or defect type, including defects such as cracks, corrosion, and scratches.

[0082] In this embodiment, by labeling the data with transformer and defect areas, the model can effectively learn the characteristics of the defects.

[0083] In one exemplary embodiment, the image enhancement processing for each original captured image includes:

[0084] Each original captured image is subjected to at least one of the following processing methods: random rotation, scaling, and adding noise.

[0085] Optionally, image enhancement can also include grayscale processing and filtering.

[0086] For example, each original captured image is sequentially subjected to random rotation, scaling, noise addition, grayscale processing, and filtering.

[0087] In this embodiment, by performing different image enhancement processes on the image data, a variety of images can be obtained, which is beneficial for the network to learn the features of various images.

[0088] In an exemplary embodiment, suppose there is an image of a power device. After model detection, the following data is obtained: the true bounding box of the power device: [x1,x2,x3,x4] = [30,50,100,150], the predicted bounding box [x_1,x_2,x_3,x_4] = [30,50,100,150], the category label: "transformer", the predicted category probability: 0.9, and the Dice coefficient of the defect region: 0.8. The process of calculating the total model loss is as follows: First, calculate the localization loss, classification loss, bounding box regression loss, and defect region loss. 1. Calculate the localization loss L loc L loc =SmoothL1(30-32)+SmoothL1(30-32)+SmoothL1(30-32)+SmoothL1(30-32) L loc =0.5×2 2 +0.5×2 2 +0.5×2 2 +0.5×2 2 =4

[0089] 2. Calculate the classification loss L cls L cls = -log(0.9) = 0.105

[0090] 3. Calculate the bounding box regression loss L bbox :

[0091] 4. Calculate the loss in the defect area:

[0092] Then, calculate the total model loss L. total (Set λ1=1, λ2=1, λ3=1, λ4=2): L total = 1×4 + 1×0.105 + 1×0.1 + 2×0.2 = 4.505

[0093] Therefore, the total loss of the model is 4.505.

[0094] In an exemplary embodiment, a power equipment defect detection method, as shown in Figure 2, includes: using a drone to photograph equipment such as transmission lines and transformers along a preset flight path to obtain a set of original captured images including RGB and infrared images; for each original captured image in the set, using LabelImg to label the transformer and defect areas on the original captured image with bounding boxes, and labeling each bounding box with a category, where the category is either a transformer or a defect type, and the defect type includes: cracks, corrosion, scratches, etc., to obtain defect labeling information corresponding to each original captured image; performing random rotation, scaling, noise addition, grayscale processing, and filtering on each original captured image sequentially to obtain a sample image of the equipment corresponding to each original captured image; the sample image of the equipment and the defect labeling information corresponding to each original captured image are used as a set of training samples, and multiple sets of training samples constitute a training sample set. Any set of training samples is obtained from the training sample set, and the equipment sample image in the current training sample is input into the defect detection model to be trained to obtain the defect detection result; the bounding box output and category output in the defect detection result are obtained; the true bounding box and true category in the defect labeling information are obtained; and the localization loss L is calculated based on the bounding box output and the true bounding box. loc The formula is as follows:

[0095] Where, x i These are the actual coordinates of the i-th pixel within the true bounding box. These are the predicted coordinates in the bounding box output, and N is the number of pixels in the region.

[0096] The bounding box regression loss L is calculated based on the bounding box output and the ground truth bounding box. bbox The calculation formula is as follows:

[0097] Among them, A pred It is the bounding box region in the bounding box output, Atrue These are the bounding box regions within the true bounding box, where ∩ represents the intersection and ∪ represents the union. The defect region loss L is calculated based on the bounding box output and the true bounding box. defect The calculation formula is as follows:

[0098] Where, p i It is the defect region in the bounding box output, d i This represents the defect region within the true bounding box. Based on the output category and the true category, the classification loss is calculated using the following formula:

[0099] Among them, y i These are labels for the real category. This represents the predicted class probability, where N is the number of all classes. The algorithm retrieves the gradients of the total model loss, localization loss, localization loss weights, classification loss, bounding box regression loss, and defect region loss from the previous training iterations. Based on these gradients, the algorithm determines... The weights of the current classification loss, the current bounding box regression loss (based on the gradient of the total model loss, the gradient of the bounding box regression loss, and the weights of the bounding box regression loss from the previous training iteration), and the current defect region loss (based on the gradient of the total model loss, the gradient of the defect region loss, and the weights of the defect region loss from the previous training iteration) are all used to determine the current defect region loss weights. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights. The formulas for calculating the weights of the different losses are as follows:

[0100] Where i represents different losses, It is the weight of the current i loss. These are the weights of the loss calculated in the previous training iteration. It is the gradient of the total model loss calculated in the previous training iteration. This is the gradient of the loss i calculated in the previous training iteration, and α is the adjustment step size, controlling the rate of weight adjustment. Obtain the weights of the current localization loss, current classification loss, current bounding box regression loss, and current defect region loss from the adaptive weights. Based on these weights, calculate the weighted sum of the localization loss, classification loss, bounding box regression loss, and defect region loss to obtain the total model loss. The calculation formula is as follows: L total =λ1L loc +λ2L cls +λ3L bbox +λ4L defect

[0101] Where λ1 is the weight of the localization loss, L loc λ² is the localization loss, λ² is the weight of the classification loss, and L is the localization loss. cls λ3 is the classification loss, λ3 is the weight of the bounding box regression loss, and L is the weight of the bounding box regression loss. bbox The bounding box regression loss is λ4, which is the weight of the defect region loss. defect This refers to the defect region loss. Based on the total model loss, the parameters of the defect detection model to be trained are adjusted. The adjusted defect detection model is then trained again based on the training sample set until the calculated total model loss reaches a preset condition, resulting in a trained defect detection model. The trained defect detection model is used for defect detection in power equipment.

[0102] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0103] In an exemplary embodiment, as shown in FIG3, a power equipment defect detection device is provided, comprising: an acquisition module 301, a training module 302, and a detection module 303, wherein:

[0104] The acquisition module is used to use a drone to photograph power equipment to obtain a set of original images, to annotate each original image in the set of original images to obtain defect annotation information corresponding to each original image, and to perform image enhancement processing on each original image to obtain a device sample image corresponding to each original image; the device sample image and defect annotation information corresponding to each original image are used as a set of training samples, and multiple sets of training samples constitute a training sample set.

[0105] The training module is used to obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss and the defect region loss.

[0106] The detection module is used to adjust the parameters of the defect detection model to be trained based on the total model loss, and to continue training the defect detection model with adjusted parameters based on the training sample set until the calculated total model loss reaches a preset condition, thereby obtaining a trained defect detection model; the trained defect detection model is used to detect defects in power equipment.

[0107] In one embodiment, the training module is further configured to:

[0108] Obtain the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, the weights of the localization loss calculated in the previous training iteration, the gradient of the classification loss calculated in the previous training iteration, the weights of the classification loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, the weights of the bounding box regression loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weights of the defect region loss calculated in the previous training iteration. Based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, and the weights of the localization loss calculated in the previous training iteration, determine the weights of the current localization loss. The current classification loss weight is determined based on the gradient of the current localization loss, the gradient of the classification loss calculated in the previous training iteration, and the weight of the classification loss calculated in the previous training iteration. The current bounding box regression loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, and the weight of the bounding box regression loss calculated in the previous training iteration. The current defect region loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weight of the defect region loss calculated in the previous training iteration. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights.

[0109] In one embodiment, the training module is further configured to:

[0110] Obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; determine the localization loss, bounding box regression loss, and defect region loss based on the bounding box output and the true bounding box; determine the classification loss based on the category output and the true category.

[0111] In one embodiment, the training module is further configured to:

[0112] Obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, determine the weighted sum of the localization loss, the classification loss, the bounding box regression loss, and the defect region loss to obtain the total model loss.

[0113] In one embodiment, the acquisition module is further configured to:

[0114] For each original image in the original image set, bounding boxes are marked on the transformer and defect areas in the original image, and a category is marked for each marked bounding box, where the category is transformer or defect type.

[0115] In one embodiment, the acquisition module is further configured to:

[0116] Each original captured image is subjected to at least one of the following processing methods: random rotation, scaling, and adding noise.

[0117] Each module in the aforementioned power equipment defect detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can call and execute the corresponding operations of each module.

[0118] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram is shown in Figure 4. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores raw captured image data. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for detecting defects in power equipment.

[0119] Those skilled in the art will understand that the structure shown in Figure 4 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or may combine certain components, or may have different component arrangements.

[0120] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0121] The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0122] Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0123] The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

[0124] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0125] Obtain the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, the weights of the localization loss calculated in the previous training iteration, the gradient of the classification loss calculated in the previous training iteration, the weights of the classification loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, the weights of the bounding box regression loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weights of the defect region loss calculated in the previous training iteration. Based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, and the weights of the localization loss calculated in the previous training iteration, determine the weights of the current localization loss. The current classification loss weight is determined based on the gradient of the current localization loss, the gradient of the classification loss calculated in the previous training iteration, and the weight of the classification loss calculated in the previous training iteration. The current bounding box regression loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, and the weight of the bounding box regression loss calculated in the previous training iteration. The current defect region loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weight of the defect region loss calculated in the previous training iteration. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights.

[0126] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0127] Obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; determine the localization loss, bounding box regression loss, and defect region loss based on the bounding box output and the true bounding box; determine the classification loss based on the category output and the true category.

[0128] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0129] Obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, determine the weighted sum of the localization loss, the classification loss, the bounding box regression loss, and the defect region loss to obtain the total model loss.

[0130] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0131] For each original image in the original image set, bounding boxes are marked on the transformer and defect areas in the original image, and a category is marked for each marked bounding box, where the category is transformer or defect type.

[0132] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0133] Each original captured image is subjected to at least one of the following processing methods: random rotation, scaling, and adding noise.

[0134] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0135] The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0136] Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0137] The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

[0138] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0139] Obtain the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, the weights of the localization loss calculated in the previous training iteration, the gradient of the classification loss calculated in the previous training iteration, the weights of the classification loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, the weights of the bounding box regression loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weights of the defect region loss calculated in the previous training iteration. Based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, and the weights of the localization loss calculated in the previous training iteration, determine the weights of the current localization loss. The current classification loss weight is determined based on the gradient of the current localization loss, the gradient of the classification loss calculated in the previous training iteration, and the weight of the classification loss calculated in the previous training iteration. The current bounding box regression loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, and the weight of the bounding box regression loss calculated in the previous training iteration. The current defect region loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weight of the defect region loss calculated in the previous training iteration. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights.

[0140] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0141] Obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; determine the localization loss, bounding box regression loss, and defect region loss based on the bounding box output and the true bounding box; determine the classification loss based on the category output and the true category.

[0142] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0143] Obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, determine the weighted sum of the localization loss, the classification loss, the bounding box regression loss, and the defect region loss to obtain the total model loss.

[0144] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0145] For each original image in the original image set, bounding boxes are marked on the transformer and defect areas in the original image, and a category is marked for each marked bounding box, where the category is transformer or defect type.

[0146] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0147] Each original captured image is subjected to at least one of the following processing methods: random rotation, scaling, and adding noise.

[0148] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0149] The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set.

[0150] Obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss.

[0151] The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

[0152] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0153] Obtain the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, the weights of the localization loss calculated in the previous training iteration, the gradient of the classification loss calculated in the previous training iteration, the weights of the classification loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, the weights of the bounding box regression loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weights of the defect region loss calculated in the previous training iteration. Based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the localization loss calculated in the previous training iteration, and the weights of the localization loss calculated in the previous training iteration, determine the weights of the current localization loss. The current classification loss weight is determined based on the gradient of the current localization loss, the gradient of the classification loss calculated in the previous training iteration, and the weight of the classification loss calculated in the previous training iteration. The current bounding box regression loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the bounding box regression loss calculated in the previous training iteration, and the weight of the bounding box regression loss calculated in the previous training iteration. The current defect region loss weight is determined based on the gradient of the total model loss calculated in the previous training iteration, the gradient of the defect region loss calculated in the previous training iteration, and the weight of the defect region loss calculated in the previous training iteration. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights.

[0154] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0155] Obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; determine the localization loss, bounding box regression loss, and defect region loss based on the bounding box output and the true bounding box; determine the classification loss based on the category output and the true category.

[0156] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0157] Obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, determine the weighted sum of the localization loss, the classification loss, the bounding box regression loss, and the defect region loss to obtain the total model loss.

[0158] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0159] For each original image in the original image set, bounding boxes are marked on the transformer and defect areas in the original image, and a category is marked for each marked bounding box, where the category is transformer or defect type.

[0160] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0161] Each original captured image is subjected to at least one of the following processing methods: random rotation, scaling, and adding noise.

[0162] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0163] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0164] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

[0165] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0166] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A power equipment defect detection method characterized by, The method includes: The power equipment is photographed using a drone to obtain a set of original images. Each original image in the set is labeled to obtain defect labeling information corresponding to each original image. Image enhancement processing is performed on each original image to obtain a sample image of the equipment corresponding to each original image. The sample image of the equipment and the defect labeling information corresponding to each original image are used as a set of training samples. Multiple sets of training samples constitute a training sample set. Obtain any set of training samples from the training sample set, input the device sample image from the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine the adaptive weights; determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss; determining the adaptive weights includes: determining the weights of different losses, and determining the adaptive weights based on the weights of different losses; the different losses include: localization loss, classification loss, bounding box regression loss, and defect region loss; the formulas for calculating the weights of the different losses are as follows: where i represents different losses, is a weight of the current i loss, is the weight of the i-th loss calculated from the previous training, is the gradient of the total loss of the model calculated in the previous training, It is the gradient of the loss i calculated in the previous training, and α is the step size, which controls the rate of weight adjustment; The parameters of the defect detection model to be trained are adjusted based on the total model loss. The defect detection model with adjusted parameters is then trained again based on the training sample set until the calculated total model loss reaches the preset condition, thus obtaining a trained defect detection model. The trained defect detection model is used to detect defects in power equipment.

2. The method of claim 1, wherein, The determination of adaptive weights includes: Obtain the gradient of the total model loss calculated in the previous training, the gradient of the localization loss calculated in the previous training, the weight of the localization loss calculated in the previous training, the gradient of the classification loss calculated in the previous training, the weight of the classification loss calculated in the previous training, the gradient of the bounding box regression loss calculated in the previous training, the weight of the bounding box regression loss calculated in the previous training, the gradient of the defect region loss calculated in the previous training, and the weight of the defect region loss calculated in the previous training. The weights of the current localization loss are determined based on the gradient of the total model loss calculated in the previous training, the gradient of the localization loss calculated in the previous training, and the weights of the localization loss calculated in the previous training. The weights of the current classification loss are determined based on the gradient of the total model loss calculated in the previous training, the gradient of the classification loss calculated in the previous training, and the weights of the classification loss calculated in the previous training. The weights of the current bounding box regression loss are determined based on the gradient of the total model loss calculated in the previous training, the gradient of the bounding box regression loss calculated in the previous training, and the weights of the bounding box regression loss calculated in the previous training. The weights of the current defect region loss are determined based on the gradient of the total model loss calculated in the previous training, the gradient of the defect region loss calculated in the previous training, and the weights of the defect region loss calculated in the previous training. The weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss together constitute the adaptive weights.

3. The method of claim 1, wherein, The determination of the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample includes: Obtain the bounding box output and category output from the defect detection results; obtain the true bounding box and true category from the defect annotation information; Based on the bounding box output and the actual bounding box, determine the localization loss, bounding box regression loss, and defect region loss; Based on the category output and the true category, determine the classification loss.

4. The method of claim 2, wherein, The determination of the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss includes: Obtain the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss in the adaptive weights; Based on the weights of the current localization loss, the current classification loss, the current bounding box regression loss, and the current defect region loss, a weighted sum of the localization loss, the classification loss, the bounding box regression loss, and the defect region loss is determined to obtain the total model loss.

5. The method of claim 1, wherein, The annotation of each original image in the original image set includes: For each original image in the original image set, bounding boxes are marked on the transformer and defect areas in the original image, and a category is marked for each marked bounding box, where the category is transformer or defect type.

6. The method of claim 1, wherein, The image enhancement processing for each original captured image includes: Each original captured image is subjected to at least one of the following processing methods: random rotation, scaling, and adding noise.

7. An electric power equipment defect detection device characterized by comprising: The device includes: The acquisition module is used to use a drone to photograph power equipment to obtain a set of original images, to annotate each original image in the set of original images to obtain defect annotation information corresponding to each original image, and to perform image enhancement processing on each original image to obtain a device sample image corresponding to each original image; the device sample image and defect annotation information corresponding to each original image are used as a set of training samples, and multiple sets of training samples constitute a training sample set. The training module is used to obtain any set of training samples from the training sample set, input the device sample image in the current training sample into the defect detection model to be trained, and obtain the defect detection result; determine the localization loss, classification loss, bounding box regression loss, and defect region loss between the defect detection result and the defect annotation information in the current training sample; determine adaptive weights; and determine the total model loss based on the adaptive weights, the localization loss, the classification loss, the bounding box regression loss, and the defect region loss; the determination of adaptive weights includes: determining the weights of different losses, and determining adaptive weights based on the weights of different losses; the different losses include: localization loss, classification loss, bounding box regression loss, and defect region loss; the weight calculation formulas for the different losses are as follows: where i represents different losses, is a weight of the current i loss, is the weight of the i-th loss computed from the previous training, is the gradient of the total loss of the model calculated in the previous training, It is the gradient of the loss i calculated in the previous training, and α is the step size, which controls the rate of weight adjustment; The detection module is used to adjust the parameters of the defect detection model to be trained based on the total model loss, and to continue training the defect detection model with adjusted parameters based on the training sample set until the calculated total model loss reaches a preset condition, thereby obtaining a trained defect detection model; the trained defect detection model is used to detect defects in power equipment.

8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.