Power grid equipment defect detection method based on knowledge distillation
Through knowledge distillation technology, teachers and students networks are built in the detection of defects of power grid equipment, and feature distillation is combined with multiple modules to optimize the student network, solving the problem of low detection accuracy on resource-constrained equipment, and achieving efficient and accurate defect identification.
Patent Information
- Application Number
- CN202510518060.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-15
AI Technical Summary
The existing power grid equipment defect detection methods are difficult to operate in real time on edge devices with resource-constrained resources, and the traditional methods have low detection accuracy, so texture information is easily divided into incorrectly when it is characterized.
Using a knowledge distillation method, a teacher network and a student network are constructed, combined with a structure-guided dual mask decoupling module, a regional attention learning module and a defect detection network module, a feature distillation is performed to optimize the student network to achieve lightweight and high-precision defect recognition.
While maintaining lightweight, it significantly improves the accuracy and robustness of grid equipment defect identification, reduces data transmission delay, and improves the real-time nature of the system.
Smart Images

Figure CN120495187A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of intelligent power grid inspection, and specifically to a method, system, device and storage medium for power grid equipment defect detection based on knowledge distillation. Background Art
[0002] Power line inspection methods have been continuously improving with advancements in technology. In the early stages, power line inspections relied primarily on manual labor, requiring power workers to climb towers for inspections. This was inefficient, and overhead lines often crossed mountains and rivers, increasing the risk factor. Later, helicopter-assisted inspections emerged, improving efficiency to a certain extent, but their main drawbacks were high costs and inaccurate test results. The development of drone aerial photography technology has had a significant impact on power line inspection methods. Compared to traditional methods, drones are more flexible and can acquire high-resolution spectral data, greatly improving the efficiency of spatial data acquisition. Power line inspection methods based on drone data are faster than manual inspections and also offer a certain degree of accuracy.
[0003] Furthermore, traditional inspection technologies rely solely on traditional image processing techniques for target detection. Detectors are configured to detect features such as the target's color, texture, and geometry, extracting the target from a complex background. Modeling is then used to detect defects. Research is also underway to utilize texture information for defect detection. However, using texture information as a feature presents certain challenges. Texture inhomogeneity can lead to incorrect segmentation of target contours, resulting in erroneous defect detection. With the development and rise of artificial intelligence (AI) technology, machine learning methods are gradually gaining traction. Machine learning algorithms analyze data through algorithms, constructing intermediate models, and then using the trained models to predict the results of the data.
[0004] However, while deep learning-based methods have improved detection accuracy, complex models are difficult to run in real time on resource-constrained edge devices. Therefore, it is necessary to further optimize power grid equipment defect detection methods. Summary of the Invention
[0005] An embodiment of the present application provides a power grid equipment defect detection method based on knowledge distillation. By distilling features, the trained student network can achieve high defect recognition accuracy while maintaining its lightweight.
[0006] To achieve the above objectives, this application adopts the following technical solutions:
[0007] In a first aspect, the present application provides a method for detecting defects in power grid equipment based on knowledge distillation, the method comprising:
[0008] Collect the original image, perform image resolution normalization on the original image to obtain the target image, and divide the target image into a training data set and a test data set according to a preset ratio;
[0009] Construct a knowledge distillation model consisting of a teacher network, a student network, a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module;
[0010] The training data set is input into the teacher network and the student network respectively for image feature extraction to obtain the teacher network feature map and the student network feature map;
[0011] Input the teacher network feature map and the student network feature map into the structure-guided dual-mask decoupling module, calculate the deviation between the target feature information and the background feature information in the teacher network feature map and the student network feature map, and obtain the first loss function;
[0012] Input the teacher network feature map and the student network feature map into the regional attention learning module, calculate the regional feature deviation between the teacher network feature map and the student network feature map, and obtain the second loss function;
[0013] Input the teacher network feature map and the student network feature map into the defect detection network module, calculate the deviation of defect detection after the target image is processed by the teacher network and the student network, and obtain the third loss function;
[0014] Based on the first loss function, the second loss function and the third loss function, the student network is optimized, the test data set is input into the optimized student network for detection, and the detection accuracy of the optimized student network is obtained.
[0015] In a second aspect, the present application provides a power grid equipment defect detection system based on knowledge distillation, the system comprising:
[0016] The acquisition and image processing module is used to acquire the original image, perform image resolution standardization on the original image, obtain the target image, and divide the target image into a training data set and a test data set according to a preset ratio;
[0017] Model building module, used to build a knowledge distillation model including a teacher network, a student network, a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module;
[0018] A processing module is used to input the training data set into the teacher network and the student network respectively for image feature extraction to obtain a teacher network feature map and a student network feature map; input the teacher network feature map and the student network feature map into the structure-guided double-mask decoupling module, calculate the deviation between the target feature information and the background feature information in the teacher network feature map and the student network feature map, and obtain a first loss function; input the teacher network feature map and the student network feature map into the regional attention learning module, calculate the regional feature deviation between the teacher network feature map and the student network feature map, and obtain a second loss function; and input the teacher network feature map and the student network feature map into the defect detection network module, calculate the deviation of defect detection after the target image is processed by the teacher network and the student network, and obtain a third loss function;
[0019] The optimization module is used to optimize the student network based on the first loss function, the second loss function and the third loss function, input the test data set into the optimized student network for detection, and obtain the detection accuracy of the optimized student network.
[0020] In a third aspect, a knowledge distillation-based power grid equipment defect detection device is provided, wherein the knowledge distillation-based power grid equipment defect detection device includes a module for executing the method of the first aspect.
[0021] In one possible design, the power grid equipment defect detection apparatus based on knowledge distillation in the third aspect may further include a transceiver. The transceiver may be a transceiver circuit or an interface circuit. The transceiver may be used to enable the power grid equipment defect detection apparatus based on knowledge distillation in the third aspect to communicate with other devices.
[0022] In one possible design, the knowledge distillation-based power grid equipment defect detection apparatus of the third aspect may further include a memory. The memory may be integrated with the processor or provided separately. The memory may be used to store instructions involved in the method of the first aspect.
[0023] In a fourth aspect, a knowledge distillation-based power grid equipment defect detection device is provided. The knowledge distillation-based power grid equipment defect detection device includes: a processor coupled to a memory, the processor configured to execute instructions stored in the memory, so that the knowledge distillation-based power grid equipment defect detection device performs the method of the first aspect.
[0024] In one possible design, the power grid equipment defect detection apparatus based on knowledge distillation in the fourth aspect may further include a transceiver. The transceiver may be a transceiver circuit or an interface circuit. The transceiver may be used to enable the power grid equipment defect detection apparatus based on knowledge distillation in the fourth aspect to communicate with other devices.
[0025] In the fifth aspect, a power grid equipment defect detection device based on knowledge distillation is provided, comprising: a processor and a memory; the memory is used to store instructions, and when the processor executes the instructions, the power grid equipment defect detection device based on knowledge distillation executes the method of the first aspect.
[0026] In one possible design, the power grid equipment defect detection apparatus based on knowledge distillation in the fifth aspect may further include a transceiver. The transceiver may be a transceiver circuit or an interface circuit. The transceiver may be used for the power grid equipment defect detection apparatus based on knowledge distillation in the fifth aspect to communicate with other devices.
[0027] In a sixth aspect, a computer-readable storage medium is provided, which includes a computer program or instruction stored therein. When the computer program or instruction is executed, the power grid equipment defect detection method based on knowledge distillation of the first aspect is executed.
[0028] In an embodiment of this application, knowledge distillation technology is used, along with a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module, to transfer the knowledge of the teacher network to the student network. This allows the student network to achieve high defect recognition accuracy while maintaining its lightweight. Compared to traditional methods, this application forms a progressive distillation mechanism from "feature layer → regional layer → output layer", significantly improving the accuracy and robustness of power grid equipment defect identification, while reducing data transmission delays and improving the real-time performance of the system.
[0029] Other features and advantages of the present application will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 Schematic diagram of the process of the power grid equipment defect detection method based on knowledge distillation provided in the embodiment of the present application Figure 1 ;
[0032] Figure 2 Schematic diagram of the structure-guided dual-mask decoupling module, regional attention learning module, and defect detection network module provided in an embodiment of the present application;
[0033] Figure 3 Schematic diagram of the process of the power grid equipment defect detection method based on knowledge distillation provided in the embodiment of the present application Figure 2 ;
[0034] Figure 4 Schematic diagram of the structure of the power grid equipment defect detection device based on knowledge distillation provided in the embodiment of the present application Figure 1 ;
[0035] Figure 5 Schematic diagram of the structure of the power grid equipment defect detection device based on knowledge distillation provided in the embodiment of the present application Figure 2 . DETAILED DESCRIPTION
[0036] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0037] Figure 1 Schematic diagram of the process of the power grid equipment defect detection method based on knowledge distillation provided in the embodiment of the present application Figure 1 .
[0038] The process of the knowledge distillation-based power grid equipment defect detection method is as follows:
[0039] Step S101 , collecting an original image, performing image resolution normalization processing on the original image to obtain a target image, and dividing the target image into a training data set and a test data set according to a preset ratio.
[0040] The original images may be collected by using visible light images or infrared images of power grid equipment inspected by drones and smart cameras, without any specific limitation. The original images may be a collection of multiple images, and the number of original images is not specifically limited in this application and may be selected based on actual circumstances.
[0041] In addition, the original image is normalized by using cubic convolution interpolation to scale the image to unify the image resolution and reduce the amount of calculation. The specific steps are as follows:
[0042] S1. Determine a scaling factor based on a preset resolution of the target image and a resolution of the original image.
[0043] For example, the target image B is the image obtained by scaling (enlarging or reducing) the source image A. Assuming that the size of the source image A is m×n, after scaling K times, the size of the target image B becomes M×N, satisfying the scaling factor K=M / m=N / n.
[0044] S2. Based on the scaling factor, determine the coordinate position of each pixel in the target image in the original image, and determine 16 neighboring pixels around the corresponding coordinate position in the original image, as well as the value of each of the 16 neighboring pixels.
[0045] Correspondingly, during the image scaling process, the value of each pixel point (X, Y) in B needs to find its corresponding position (x, y) in the source image A through a specific mapping relationship (such as x = X / K, y = Y / K).
[0046] S3. Based on the cubic convolution interpolation formula, calculate the weight of each of the 16 neighboring pixel points, multiply the value of each neighboring pixel point by the corresponding weight and sum them to obtain the value of the target pixel point.
[0047] Correspondingly, the following cubic convolution interpolation formula W(x) is used to calculate the weight of each of the 16 neighboring pixels.
[0048]
[0049] Wherein, a=-0.5, and x is the distance difference between a pixel point in the source image (original image) and the corresponding position of the target pixel point in a specific dimension.
[0050] The value of the target pixel B(X, Y) is the weighted sum of 16 pixels:
[0051] Among them, a ij It is used to represent the value of each of the 16 neighborhood pixels. W(i) represents the weight of the horizontal coordinate, and W(j) represents the weight of the vertical coordinate.
[0052] S4. Repeat steps S1 to S3 until all pixels in the target image are processed to obtain the target image.
[0053] It's important to note that the pixel values of B(X, Y) are ultimately determined using weighted superposition calculated using the bicubic interpolation algorithm. This method comprehensively considers the grayscale values of adjacent pixels and their rates of change, making the magnified image B closer to a high-resolution image and reducing artifacts like aliasing. In short, B is the target image after A has been scaled, whose pixel values are interpolated.
[0054] Step S102: construct a knowledge distillation model including a teacher network, a student network, a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module.
[0055] The specific knowledge distillation model can be referred to Figure 2 I understand, so I won’t elaborate on it here.
[0056] It should be noted that the teacher network is a powerful teacher model that is trained using preprocessed image data so that it can accurately identify various defect types of power grid equipment.
[0057] The student network is a lightweight student model that transfers the knowledge of the teacher model to the student model through knowledge distillation technology, keeping the student model lightweight. At the same time, it optimizes the training of the student model by combining the defect rules of power grid equipment.
[0058] In step S103, the training data set is input into the teacher network and the student network respectively to extract image features, thereby obtaining a teacher network feature map and a student network feature map.
[0059] In step S104, the teacher network feature map and the student network feature map are input into the structure-guided dual-mask decoupling module, and the deviation between the target feature information and the background feature information in the teacher network feature map and the student network feature map is calculated to obtain a first loss function.
[0060] It can be understood that the feature maps of the student network and the teacher network are input into the structure-guided dual-mask decoupling module. In the structure-guided dual-mask decoupling module, by calculating the deviation of the target feature information and the background feature information in the student network and the teacher network, a decoupled feature loss function is designed, so that the network can simultaneously and centrally learn the target information and background information in the image, so that the student network can learn richer feature information.
[0061] The specific implementation is as follows:
[0062] The sample image is manually annotated with a labeling box, and a binary mask M is set for the teacher network feature map and the student network feature map according to the labeling box. The value of M is 1 or 0. When the value of M is 1, it indicates that the teacher network feature map and / or the student network feature map contains target feature information. When the value of M is 0, it indicates that the teacher network feature map and / or the student network feature map contains background feature information.
[0063] Based on the value of M, the structure-guided dual-mask decoupling module introduces a structure-aware dual-mask mechanism, adopts different convolution paths and alignment strategies for target feature information and background feature information, calculates the deviation of target feature information and background feature information in the teacher network feature map and the student network feature map, and obtains the first loss function;
[0064] The first loss function is expressed as:
[0065]
[0066] Among them, H, W, C are the height, width and number of channels of the teacher network feature map and the student network feature map, a o and a b are the adjustment coefficients of target feature information and background feature information respectively; N o and N b are the number of regions containing target feature information and the number of regions containing background feature information in the teacher network feature graph or the student network feature graph, respectively; F s is the student network feature graph, F t is the teacher network feature map; A and B represent the 1×1 convolution operation used to adjust the number of channels, μ is the preset structural consistency adjustment factor; G(F t , F s ) represents the image structure extraction function in the student network feature graph and the teacher network feature graph, in, and represent the pth and qth spatial position feature vectors in the teacher network feature map, respectively. and They represent the pth and qth spatial position feature vectors in the student network feature map respectively, and sim() represents the cosine similarity.
[0067] Step S105: Input the teacher network feature map and the student network feature map into the regional attention learning module, calculate the regional feature deviation between the teacher network feature map and the student network feature map, and obtain the second loss function.
[0068] The response of the weak target information features of the power equipment may be detrimental to the student network learning the characteristics of the teacher network about the target area. Therefore, while using the decoupled feature module, this application also allows the student network to learn the regional features of the teacher network. The regional attention learning module allows the student network to learn the characteristic information of the teacher network region. In the regional feature learning module, a dynamic regional attention weighting mechanism is added to strengthen the distillation contribution of key areas (such as fracture points and corrosion areas).
[0069] Input the teacher network feature map and the student network feature map into the regional attention learning module to obtain the teacher network regional feature map and the student network regional feature map containing classification and regression;
[0070] The second loss function is expressed as:
[0071]
[0072] Among them, N′ represents the total number of regions included in the teacher network region feature map and the student network region feature map, A n represents the significance score of the nth region obtained by the regional attention learning module, where n is a positive integer less than or equal to N′. s ′ represents the teacher network regional feature map, F t ′ represents the student network area feature map, C′ represents F t ′, σ represents the convolution operation that adjusts the number of channels of the teacher network region feature map and the number of channels of the student network region feature map.
[0073] It should be noted that the above-mentioned significance score is obtained by weighted calculation of the regional classification probability and classification edge strength by the regional attention learning module.
[0074] In step S106, the teacher network feature map and the student network feature map are input into the defect detection network module, and the deviation of defect detection is calculated after the target image is processed by the teacher network and the student network to obtain a third loss function.
[0075] Based on a single-stage network, the prior bounding boxes are used to generate region proposals. Each output feature layer predicts multiple detection boxes based on anchors. This network balances detection speed and accuracy. The defect detection network module consists of three parts: a backbone network, an auxiliary feature extraction network, and a detection network.
[0076] In this application, the third loss function includes classification loss and position loss, and the third loss function is expressed as:
[0077]
[0078] Among them, L conf (x, c) is the classification loss, L loc (x, l, g) represents the position loss, N is the number of matched default boxes, x represents the input image prediction value, c represents the category confidence prediction value, l represents the predicted box position information, g represents the actual box position information, and α represents a hyperparameter used to adjust the relative importance of classification loss and position loss.
[0079] In addition, the classification loss is calculated using the Softmax function:
[0080]
[0081] in, is the category probability corresponding to the predicted i-th default box and the manually labeled correct target detection box, is the jth ground-truth box matched by the i-th default box.
[0082] The position loss is calculated using the SmoothL1 loss function:
[0083]
[0084] in, is the regression parameter corresponding to the predicted i-th positive sample, It is the regression parameter of the jth real box matched to the positive sample i.
[0085] It should also be noted that the above steps S102 to S106 can also be understood as:
[0086] The training dataset is input into the knowledge distillation model, where the knowledge distillation model includes a teacher network, a student network, a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module.
[0087] The teacher network and student network are used to extract image features based on the training data set to obtain the teacher network feature map and the student network feature map;
[0088] The dual-mask decoupling module guided by the above structure is used to calculate the deviation between the target feature information and the background feature information in the teacher network feature graph and the student network feature graph based on the teacher network feature graph and the student network feature graph, and obtain the first loss function:
[0089] The regional attention learning module is used to calculate the regional feature deviation between the teacher network feature map and the student network feature map based on the teacher network feature map and the student network feature map to obtain a second loss function;
[0090] The above-mentioned defect detection network module is used to calculate the deviation of defect detection after the target image is processed by the teacher network and the student network based on the teacher network feature map and the student network feature map, and obtain a third loss function.
[0091] Then, step S107 is executed.
[0092] Step S107: Optimize the student network based on the first loss function, the second loss function, and the third loss function, input the test data set into the optimized student network for detection, and obtain the detection accuracy of the optimized student network.
[0093] It can also be said that the student network is optimized by weighted combination of the first loss function, the second loss function and the third loss function, wherein the weight coefficients of the first loss function, the second loss function and the third loss function are adjusted according to the task requirements.
[0094] That is, this application uses the decoupled feature module to perform feature distillation on the backbone network, and the distillation loss function of the backbone network is: Lbackbone =λ0L DF At the same time, the regional attention learning module is used to obtain L ROI , L(x, c, l, g) is obtained in the defect detection network module, so the distillation loss function expression of the entire model is:
[0095] L = λ1L(x, c, l, g) + λ2L backbone +λ3L ROI ,
[0096] Among them, λ0, λ1, λ2 and λ3 are random coefficients, which are adjusted according to task requirements.
[0097] In addition, it should be noted that to optimize the student network, the student network can be pruned and quantized. Pruning is to remove redundant neural network connections or nodes in the student network to reduce the complexity of the model, and quantization is to convert floating-point weights or activation values in the student network into lower-precision integers to reduce storage and computing resource requirements.
[0098] Finally, the performance of the optimized student network is evaluated using a test dataset to ensure its high accuracy and real-time performance in the power grid equipment defect identification task.
[0099] In summary, in the embodiments of the present application, Figure 3 As shown, through knowledge distillation technology and the use of a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module, the knowledge of the teacher network is transferred to the student network, enabling the student network to achieve high defect recognition accuracy while maintaining its lightweight. Compared with traditional methods, this application forms a layered distillation mechanism from "feature layer → regional layer → output layer", significantly improving the accuracy and robustness of power grid equipment defect identification, while reducing data transmission delay and improving the real-time performance of the system.
[0100] Combination of the above Figure 1-Figure 3 The power grid equipment defect detection method and application based on knowledge distillation provided in the embodiment of the present application are described in detail. The power grid equipment defect detection system based on knowledge distillation provided in the embodiment of the present application is described in detail below.
[0101] The system specifically includes: acquisition and image processing module, model building module, processing module, and optimization module, as shown below.
[0102] The acquisition and image processing module is used to acquire the original image, perform image resolution standardization on the original image, obtain the target image, and divide the target image into a training data set and a test data set according to a preset ratio;
[0103] Model building module, used to build a knowledge distillation model including a teacher network, a student network, a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module;
[0104] A processing module is used to input the training data set into the teacher network and the student network respectively for image feature extraction to obtain a teacher network feature map and a student network feature map; input the teacher network feature map and the student network feature map into the structure-guided double-mask decoupling module, calculate the deviation between the target feature information and the background feature information in the teacher network feature map and the student network feature map, and obtain a first loss function; input the teacher network feature map and the student network feature map into the regional attention learning module, calculate the regional feature deviation between the teacher network feature map and the student network feature map, and obtain a second loss function; and input the teacher network feature map and the student network feature map into the defect detection network module, calculate the deviation of defect detection after the target image is processed by the teacher network and the student network, and obtain a third loss function;
[0105] The optimization module is used to optimize the student network based on the first loss function, the second loss function and the third loss function, input the test data set into the optimized student network for detection, and obtain the detection accuracy of the optimized student network.
[0106] In addition, for the above-mentioned specific implementation of the system, since it is basically similar to the method implementation, the description is relatively simple, and the relevant parts can be referred to the partial description of the method implementation. Moreover, it should be noted that in each module of the system of the present application, the components therein are logically divided according to the functions to be implemented, but the present application is not limited thereto, and the components can be re-divided or combined as needed.
[0107] The above describes the power grid equipment defect detection method and system based on knowledge distillation provided by the embodiment of the present application. Figure 4-Figure 5 A detailed description is given of a power grid equipment defect detection device based on knowledge distillation for executing the embodiments of the present application.
[0108] Figure 4 This is a schematic diagram of the structure of the power grid equipment defect detection device based on knowledge distillation provided in the embodiment of the present application. Figure 1 For example, Figure 4 As shown, the power grid equipment defect detection device 400 based on knowledge distillation includes: a transceiver module 401 and a processing module 402. For the convenience of explanation, Figure 4 Only the main components of the knowledge distillation-based power grid equipment defect detection device are shown.
[0109] Among them, the transceiver module 401 is used to perform the transceiver function of the above-mentioned power grid equipment defect detection method based on knowledge distillation, and the processing module 402 is used to perform other functions of the above-mentioned power grid equipment defect detection method based on knowledge distillation except the transceiver function.
[0110] Optionally, the transceiver module 401 may include a sending module ( Figure 4 Not shown) and receiving module ( Figure 4 (not shown). The sending module is used to implement the sending function of the power grid equipment defect detection device 400 based on knowledge distillation, and the receiving module is used to implement the receiving function of the power grid equipment defect detection device 400 based on knowledge distillation.
[0111] Optionally, the power grid equipment defect detection device 400 based on knowledge distillation may further include a storage module ( Figure 4 (not shown), the storage module stores a program or instruction. When the processing module 402 executes the program or instruction, the power grid device defect detection apparatus 400 based on knowledge distillation can perform the power grid device defect detection method based on knowledge distillation in the embodiment of the present application.
[0112] The following combination Figure 5 Each component of the power grid equipment defect detection device 500 based on knowledge distillation is specifically introduced:
[0113] The processor 501 is the control center of the knowledge distillation-based power grid equipment defect detection device 500 and can be a single processor or a collective term for multiple processing elements. For example, the processor 501 can be one or more central processing units (CPUs), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application, such as one or more microprocessors (digital signal processors, DSPs) or one or more field programmable gate arrays (FPGAs).
[0114] Optionally, the processor 501 can perform various functions of the knowledge distillation-based power grid equipment defect detection device 500 by running or executing a software program stored in the memory 502, and calling data stored in the memory 502, such as executing the knowledge distillation-based power grid equipment defect detection method in the embodiment of the present application.
[0115] In a specific implementation, as an embodiment, the processor 501 may include one or more CPUs, such as Figure 5 CPU0 and CPU1 are shown in FIG.
[0116] In a specific implementation, as an embodiment, the power grid equipment defect detection device 500 based on knowledge distillation may also include multiple processors, such as Figure 5 The processor 501 and processor 504 shown in . Each of these processors can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor here can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions). Among them, the memory 502 is used to store the software program that executes the solution of the present application, and is controlled by the processor 501 to execute. The specific implementation method can refer to the above method embodiment and will not be repeated here.
[0117] Optionally, the memory 502 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 502 may be integrated with the processor 501 or exist independently and accessed through the interface circuit ( Figure 5 (not shown) is coupled to the processor 501, which is not specifically limited in this embodiment of the present application.
[0118] The transceiver 503 is used for communicating with other communication devices. For example, the power grid equipment defect detection device 500 based on knowledge distillation is a first device, and the transceiver 503 can be used for communicating with a second device or a third device.
[0119] Optionally, the transceiver 503 may include a receiver and a transmitter ( Figure 5 (not shown separately in the figure). The receiver is used to implement a receiving function, and the transmitter is used to implement a sending function.
[0120] Optionally, the transceiver 503 may be integrated with the processor 501 or may exist independently and be connected to the power grid equipment defect detection device 500 based on knowledge distillation through an interface circuit ( Figure 5 (not shown) is coupled to the processor 501, which is not specifically limited in this embodiment of the present application.
[0121] It is understandable that Figure 5 The structure of the knowledge distillation-based power grid equipment defect detection device 500 shown in the figure does not constitute a limitation of the knowledge distillation-based power grid equipment defect detection device. The actual knowledge distillation-based power grid equipment defect detection device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0122] In addition, the technical effects of the power grid equipment defect detection device 500 based on knowledge distillation can refer to the technical effects of the method described in the above method embodiment, and will not be repeated here.
[0123] It should be understood that the processor in the embodiments of the present application may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0124] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0125] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (such as infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
Claims
1. A power grid equipment defect detection method based on knowledge distillation, characterized in that: The method comprises: Acquire an original image, perform image resolution normalization on the original image to obtain a target image, and divide the target image into a training data set and a test data set according to a preset ratio; Construct a knowledge distillation model consisting of a teacher network, a student network, a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module; Inputting the training data set into the teacher network and the student network respectively to extract image features, thereby obtaining a teacher network feature map and a student network feature map; Inputting the teacher network feature graph and the student network feature graph into the structure-guided dual-mask decoupling module, calculating the deviation between the target feature information and the background feature information in the teacher network feature graph and the student network feature graph, and obtaining a first loss function; Inputting the teacher network feature map and the student network feature map into the regional attention learning module, calculating the regional feature deviation between the teacher network feature map and the student network feature map, and obtaining a second loss function; Inputting the teacher network feature map and the student network feature map into the defect detection network module, calculating the deviation of defect detection after the target image is processed by the teacher network and the student network, and obtaining a third loss function; Based on the first loss function, the second loss function and the third loss function, the student network is optimized, the test data set is input into the optimized student network for detection, and the detection accuracy of the optimized student network is obtained.
2. The power grid equipment defect detection method based on knowledge distillation according to claim 1 is characterized in that: The step of performing image resolution normalization processing on the original image to obtain a target image includes: S1. Determine a scaling factor based on a preset resolution of the target image and a resolution of the original image; S2. Determine, based on the scaling factor, the coordinate position corresponding to each pixel point in the target image in the original image, and determine 16 neighboring pixel points surrounding the corresponding coordinate position in the original image, as well as the value of each of the 16 neighboring pixel points; S3. Calculate the weight of each of the 16 neighboring pixel points based on the cubic convolution interpolation formula, multiply the value of each neighboring pixel point by the corresponding weight, and sum the results to obtain the value of the target pixel point; S4. Repeat steps S1 to S3 until all pixels in the target image are processed to obtain the target image.
3. The power grid equipment defect detection method based on knowledge distillation according to claim 1 is characterized in that: Inputting the teacher network feature graph and the student network feature graph into the structure-guided dual-mask decoupling module, calculating the deviation between the target feature information and the background feature information in the teacher network feature graph and the student network feature graph, and obtaining a first loss function, including: The sample image is manually annotated with a labeling frame, and a binary mask M is set for the teacher network feature map and the student network feature map according to the labeling frame, where M takes a value of 1 or 0. When M takes a value of 1, it indicates that the teacher network feature map and / or the student network feature map contains target feature information, and when M takes a value of 0, it indicates that the teacher network feature map and / or the student network feature map contains background feature information; Based on the value of M, the structure-guided dual-mask decoupling module introduces a structure-aware dual-mask mechanism, adopts different convolution paths and alignment strategies for target feature information and background feature information, calculates the deviation of target feature information and background feature information in the teacher network feature graph and the student network feature graph, and obtains a first loss function; The first loss function is expressed as: Wherein, H, W, and C are the same height, width, and number of channels of the teacher network feature graph and the student network feature graph, and a o and the a b are adjustment coefficients for the target feature information and the background feature information respectively; o and the N b are respectively the number of regions containing the target feature information and the number of regions containing the background feature information in the teacher network feature graph or the student network feature graph; s is the student network feature graph, the F t is the teacher network feature map; A and B represent 1×1 convolution operations used to adjust the number of channels, and μ is a preset structural consistency adjustment factor; G(F t , F s ) represents the image structure extraction function in the student network feature graph and the teacher network feature graph, Among them, the and stated Respectively represent the pth and qth spatial position feature vectors in the teacher network feature map, the and stated They respectively represent the pth and qth spatial position feature vectors in the student network feature graph, and sim() represents the cosine similarity.
4. The power grid equipment defect detection method based on knowledge distillation according to claim 1 is characterized in that: The step of inputting the teacher network feature map and the student network feature map into the regional attention learning module, calculating the regional feature deviation between the teacher network feature map and the student network feature map, and obtaining a second loss function includes: Inputting the teacher network feature map and the student network feature map into the regional attention learning module to obtain the teacher network regional feature map and the student network regional feature map including classification and regression; The second loss function is expressed as: Wherein, N′ represents the total number of regions included in the teacher network region feature graph and the student network region feature graph, and A n represents the significance score of the nth region obtained by the regional attention learning module, where n is a positive integer less than or equal to N′. s ′ represents the teacher network regional feature map, the F t ′ represents the student network area feature map, and C′ represents F t ′, and σ represents a convolution operation for adjusting the consistency between the number of channels of the teacher network region feature map and the number of channels of the student network region feature map.
5. The power grid equipment defect detection method based on knowledge distillation according to claim 1 is characterized in that: The step of inputting the teacher network feature map and the student network feature map into the defect detection network module, calculating the deviation of defect detection after the target image is processed by the teacher network and the student network, and obtaining a third loss function includes: The third loss function includes classification loss and position loss, and the third loss function is expressed as: Among them, the L conf (x, c) is expressed as the classification loss, the L loc (x, l, g) represents the position loss, N is the number of matched default boxes, x represents the input image prediction value, c represents the category confidence prediction value, l represents the predicted box position information, g represents the actual box position information, and α represents a hyperparameter used to adjust the relative importance of classification loss and position loss.
6. The power grid equipment defect detection method based on knowledge distillation according to claim 1 is characterized in that: Optimizing the student network based on the first loss function, the second loss function, and the third loss function includes: The student network is optimized by weighted combination of the first loss function, the second loss function and the third loss function, wherein the weight coefficients of the first loss function, the second loss function and the third loss function are adjusted according to task requirements.
7. The power grid equipment defect detection method based on knowledge distillation according to claim 1 or 6, characterized in that: The optimizing the student network includes: The student network is pruned and quantized, wherein the pruning process is to remove redundant neural network connections or nodes in the student network, and the quantization process is to convert floating-point weights or activation values in the student network into integers with lower precision.
8. A power grid equipment defect detection system based on knowledge distillation, characterized in that: The system comprises: An acquisition and image processing module is used to acquire an original image, perform image resolution normalization on the original image to obtain a target image, and divide the target image into a training data set and a test data set according to a preset ratio; Model building module, used to build a knowledge distillation model including a teacher network, a student network, a structure-guided dual-mask decoupling module, a regional attention learning module, and a defect detection network module; a processing module for inputting the training data set into the teacher network and the student network respectively for image feature extraction to obtain a teacher network feature map and a student network feature map; for inputting the teacher network feature map and the student network feature map into the structure-guided dual-mask decoupling module, calculating the deviation between the target feature information and the background feature information in the teacher network feature map and the student network feature map, and obtaining a first loss function; for inputting the teacher network feature map and the student network feature map into the regional attention learning module, calculating the regional feature deviation between the teacher network feature map and the student network feature map, and obtaining a second loss function; and for inputting the teacher network feature map and the student network feature map into the defect detection network module, calculating the deviation of defect detection after the target image is processed by the teacher network and the student network, and obtaining a third loss function; An optimization module is used to optimize the student network based on the first loss function, the second loss function and the third loss function, input the test data set into the optimized student network for detection, and obtain the detection accuracy of the optimized student network.
9. A power grid equipment defect detection device based on knowledge distillation, characterized in that: The apparatus comprises: a module for executing the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program or instructions, which, when executed, causes the method according to any one of claims 1 to 7 to be performed.