A method, system, device and storage medium for lightweight fault detection model

Through the training, structural replacement, compression fine-tuning and optimization of the power equipment fault detection model, the hardware requirements caused by model complexity are solved, and the deployment and application on low configuration platforms are realized, and the computing accuracy and computing speed are ensured. promote.

CN113987953BActive Publication Date: 2024-11-26STATE GRID ZHEJIANG ELECTRIC POWER CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111319532.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-09
Publication Date
2024-11-26
Estimated Expiration
2041-11-09

AI Technical Summary

Technical Problem

The existing power equipment fault detection model has increased the hardware demand for the deployment platform due to the increase in structure and operation complexity, which limits the deployment and application of low-configuration platforms.

Method used

The Resnet-based fault detection model is trained through preset training sets and test sets, and the model is replaced, compressed and fine-tuned, and optimized using lightweight network structure, preset compression fine-tuning algorithm and optimization engine to reduce the complexity of the model.

Benefits of technology

On the premise of ensuring the accuracy of operations, the structural complexity of the neural network model is reduced, the computing speed is improved, and the deployment and application on low-configuration platforms are realized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113987953B_ABST
    Figure CN113987953B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method, system, device and storage medium for lightweighting a fault detection model, the method comprising: training a first power equipment fault detection model using a preset training set and a preset test set to obtain a second power equipment fault detection model, replacing the basic network structure of the second power equipment fault detection model with a lightweight network structure to obtain a third power equipment fault detection model, inputting the third power equipment fault detection model into a preset compression fine-tuning algorithm, performing compression fine-tuning to obtain a fourth power equipment fault detection model, inputting the fourth power equipment fault detection model into a preset optimization engine, so that the preset optimization engine optimizes the fourth power equipment fault detection model, and obtaining a lightweight power equipment fault detection model. The present invention reduces the structural complexity of the neural network model while ensuring the accuracy of the output results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of model compression, and in particular to a method, system, device and storage medium for lightweighting a fault detection model. Background Art

[0002] As more and more sensors are used in fault detection of power equipment, neural network models are increasingly used to process the massive detection data transmitted by the above sensors due to their intelligent and efficient data processing.

[0003] However, due to the increase in the amount and complexity of data uploaded by sensors, the structure and computational complexity of existing models for power equipment fault detection have also increased, which directly leads to an increase in the demand for deployment platform hardware for existing models, limiting the deployment and application of existing models on low-configuration platforms. Therefore, how to reduce the complexity of neural networks while ensuring accurate calculations has become an urgent problem for technicians in related fields. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a method, system, device and storage medium for lightweight fault detection model, so as to reduce the structural complexity of the neural network model while ensuring the accuracy of calculation. The specific technical solution is as follows:

[0005] A method for lightweighting a fault detection model, the method comprising:

[0006] The first power equipment fault detection model is trained using a preset training set and a preset test set to obtain a second power equipment fault detection model, wherein the preset training set and the preset test set include: monitoring data collected by the power equipment terminal and the corresponding fault type, and the first power equipment fault detection model is a machine learning model based on Resnet.

[0007] The basic network structure of the second power equipment fault detection model is replaced by a lightweight network structure to obtain a third power equipment fault detection model.

[0008] The third power equipment fault detection model is input into a preset compression and fine-tuning algorithm so that the preset compression and fine-tuning algorithm compresses and fine-tunes the third power equipment fault detection model to obtain a fourth power equipment fault detection model, wherein the preset compression and fine-tuning algorithm includes: a preset pruning algorithm and a preset knowledge distillation algorithm.

[0009] The fourth electric power equipment fault detection model is input into a preset optimization engine, so that the preset optimization engine optimizes the fourth electric power equipment fault detection model to obtain a lightweight electric power equipment fault detection model.

[0010] Optionally, the step of replacing the basic network structure of the second power equipment fault detection model with a lightweight network structure to obtain a third power equipment fault detection model specifically includes:

[0011] The lightweight network structure is used to replace the convolution kernel in the basic network structure, and the first number of channels in the convolution kernel is reduced to obtain the processed third power equipment fault detection model.

[0012] Optionally, the step of inputting the third electric power equipment fault detection model into a preset compression fine-tuning algorithm so that the preset compression fine-tuning algorithm compresses and fine-tunes the third electric power equipment fault detection model to obtain a fourth electric power equipment fault detection model includes:

[0013] The third electric power equipment fault detection model is compressed using the preset pruning algorithm to obtain a compressed fifth electric power equipment fault detection model.

[0014] The fifth electric power equipment fault detection model is fine-tuned using the preset knowledge distillation algorithm to obtain the fourth electric power equipment fault detection model.

[0015] Optionally, compressing the third power equipment fault detection model by using the preset pruning algorithm to obtain a compressed fifth power equipment fault detection model specifically includes:

[0016] Utilizing the preset pruning algorithm, by limiting the search space and setting a reward function, a search is performed for a pruning scheme of the third power equipment fault detection model that satisfies a preset reasoning delay within a preset pruning range and a preset precision loss range. After the search has been iterated for a second number of times, when the result of the search satisfies a first preset condition, the pruning scheme corresponding to the result of the search that satisfies the first preset condition is determined as the final pruning scheme, wherein the reward function is used to limit the preset precision loss range and the preset reasoning delay.

[0017] According to the cropping scheme, the model mask of the third power equipment fault detection model is obtained, the channel layer that is set to zero in the model mask is deleted using the pruning algorithm, and the shape inference of the third power equipment fault detection model is performed by calculating the number of non-zero input channels and output channels in each convolutional layer of the third power equipment fault detection model to obtain the convolutional layer that needs to be replaced in the third power equipment fault detection model, and the preset pruning algorithm is used to complete the replacement of the convolutional layer by rewriting the structure of the convolutional layer to obtain the compressed fifth power equipment fault detection model.

[0018] Optionally, the using the preset knowledge distillation algorithm to fine-tune the fifth power equipment fault detection model to obtain the fourth power equipment fault detection model specifically includes:

[0019] The teacher model and the student model are input into a preset knowledge distillation algorithm so that the preset knowledge distillation algorithm extracts the distance between the teacher model and the student model on the output layer as a loss function. The preset knowledge distillation algorithm transfers the features of the teacher model to the student model according to the loss function to obtain the fourth power equipment fault detection model that has been fine-tuned, wherein the teacher model is the second power equipment fault detection model and the student model is the fifth power equipment fault detection model.

[0020] Optionally, inputting the fourth power equipment fault detection model into a preset optimization engine so that the preset optimization engine optimizes the fourth power equipment fault detection model to obtain a lightweight power equipment fault detection model includes:

[0021] The preset optimization engine is used to perform model quantization, dynamic memory optimization and layer fusion on the fourth power equipment fault detection model to obtain the lightweight power equipment fault detection model, wherein the model quantization refers to converting the network parameters in the fourth power equipment fault detection model from the first type to the second type using the preset optimization engine, the dynamic memory optimization refers to applying for a memory when the fourth power equipment fault detection model is running using the preset optimization engine, and controlling the fourth power equipment fault detection model to reuse the memory, and the layer fusion refers to using the preset optimization engine to fuse the convolution operation, bias operation and activation function in the fourth power equipment fault detection model, and calling a convolution kernel to process the fused operation.

[0022] A system for lightweight fault detection model, the system comprising:

[0023] The model training module trains the first power equipment fault detection model by using a preset training set and a preset test set to obtain a second power equipment fault detection model, wherein the preset training set and the preset test set include: monitoring data collected by the power equipment terminal and the corresponding fault type, and the first power equipment fault detection model is a machine learning model based on Resnet.

[0024] The structure replacement module replaces the basic network structure of the second power equipment fault detection model by using a lightweight network structure to obtain a third power equipment fault detection model.

[0025] A compression and fine-tuning module is used to input the third power equipment fault detection model into a preset compression and fine-tuning algorithm so that the preset compression and fine-tuning algorithm compresses and fine-tunes the third power equipment fault detection model to obtain a fourth power equipment fault detection model, wherein the preset compression and fine-tuning algorithm includes: a preset pruning algorithm and a preset knowledge distillation algorithm.

[0026] The model optimization module is used to input the fourth power equipment fault detection model into a preset optimization engine so that the preset optimization engine optimizes the fourth power equipment fault detection model to obtain a lightweight power equipment fault detection model.

[0027] Optionally, the structure replacement module is configured as:

[0028] The lightweight network structure is used to replace the convolution kernel in the basic network structure, and the first number of channels in the convolution kernel is reduced to obtain the processed third power equipment fault detection model.

[0029] Optionally, the compression fine-tuning module includes:

[0030] The compression submodule compresses the third electric equipment fault detection model using the preset pruning algorithm to obtain a compressed fifth electric equipment fault detection model.

[0031] The fine-tuning submodule uses the preset knowledge distillation algorithm to fine-tune the fifth power equipment fault detection model to obtain the fourth power equipment fault detection model.

[0032] Optionally, the compression submodule is configured as:

[0033] Utilizing the preset pruning algorithm, by limiting the search space and setting a reward function, a search is performed for a pruning scheme of the third power equipment fault detection model that satisfies a preset reasoning delay within a preset pruning range and a preset precision loss range. After the search has been iterated for a second number of times, when the result of the search satisfies a first preset condition, the pruning scheme corresponding to the result of the search that satisfies the first preset condition is determined as the final pruning scheme, wherein the reward function is used to limit the preset precision loss range and the preset reasoning delay.

[0034] According to the cropping scheme, the model mask of the third power equipment fault detection model is obtained, the channel layer that is set to zero in the model mask is deleted using the pruning algorithm, and the shape inference of the third power equipment fault detection model is performed by calculating the number of non-zero input channels and output channels in each convolutional layer of the third power equipment fault detection model to obtain the convolutional layer that needs to be replaced in the third power equipment fault detection model, and the preset pruning algorithm is used to complete the replacement of the convolutional layer by rewriting the structure of the convolutional layer to obtain the compressed fifth power equipment fault detection model.

[0035] Optionally, the fine-tuning submodule is configured as:

[0036] The teacher model and the student model are input into a preset knowledge distillation algorithm so that the preset knowledge distillation algorithm extracts the distance between the teacher model and the student model on the output layer as a loss function. The preset knowledge distillation algorithm transfers the features of the teacher model to the student model according to the loss function to obtain the fourth power equipment fault detection model that has been fine-tuned, wherein the teacher model is the second power equipment fault detection model and the student model is the fifth power equipment fault detection model.

[0037] Optionally, the model optimization module is configured as follows:

[0038] The preset optimization engine is used to perform model quantization, dynamic memory optimization and layer fusion on the fourth power equipment fault detection model to obtain the lightweight power equipment fault detection model, wherein the model quantization refers to converting the network parameters in the fourth power equipment fault detection model from the first type to the second type using the preset optimization engine, the dynamic memory optimization refers to applying for a memory when the fourth power equipment fault detection model is running using the preset optimization engine, and controlling the fourth power equipment fault detection model to reuse the memory, and the layer fusion refers to using the preset optimization engine to fuse the convolution operation, bias operation and activation function in the fourth power equipment fault detection model, and calling a convolution kernel to process the fused operation.

[0039] A device for lightweight fault detection model, comprising:

[0040] processor;

[0041] A memory for storing instructions executable by the processor.

[0042] The processor is configured to execute the instructions to implement the method for lightweighting the fault detection model as described in any one of the above items.

[0043] A computer-readable storage medium, when the instructions in the computer-readable storage medium are executed by the processor of the device, enables the device to execute the method for lightweighting a fault detection model as described in any one of the above items.

[0044] The embodiments of the present invention provide a method, system, device and storage medium for lightweighting a fault detection model. The first power equipment fault detection model is trained by a preset training set and a preset test set to obtain a second power equipment fault detection model, so that when the above-mentioned power fault detection model is lightweighted, it can be lightweighted based on a model that can output accurate results, which fundamentally ensures that the model after lightweight processing can still maintain the accuracy of the output results. At the same time, the present invention adopts a lightweight network structure to replace the basic network structure of the existing model, thereby reducing the parameter calculation amount and structural complexity of the neural network model. The present invention also uses a preset compression fine-tuning algorithm to further simplify the structure of the neural network that has been lightweighted, and uses a preset optimization engine to improve the calculation speed of the neural network while ensuring the accuracy of the output results. It can be seen that the present invention achieves the reduction of the structural complexity of the neural network model while ensuring the accuracy of the output results of the neural network model.

[0045] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 A flowchart of a method for lightweighting a fault detection model provided by an embodiment of the present invention;

[0048] Figure 2 A block diagram of a system for lightweight fault detection model provided by an embodiment of the present invention;

[0049] Figure 3 A block diagram of a device with a lightweight fault detection model provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] The embodiment of the present invention provides a method for lightweight fault detection model, such as Figure 1 As shown, including:

[0052] S101. Train the first power equipment fault detection model using a preset training set and a preset test set to obtain a second power equipment fault detection model, wherein the preset training set and the preset test set include: monitoring data collected by the power equipment terminal and the corresponding fault type, and the first power equipment fault detection model is a machine learning model based on Resnet.

[0053] The above-mentioned power equipment terminals include but are not limited to: high-definition cameras, monitoring sensors and intelligent monitoring robots, etc. The above-mentioned monitoring data include but are not limited to: image data and equipment parameters, etc.

[0054] Optionally, in an optional embodiment of the present invention, the above-mentioned first power equipment fault detection model adopts a convolutional neural network for the power equipment fault detection task based on Resnet, and the convolutional neural network includes an independent convolutional layer and four different types of convolutional residual blocks, each convolutional residual block consists of three convolutional layers and a fully connected layer.

[0055] The present invention uses a preset training set and a preset test set to train a first power equipment fault detection model to obtain a second power equipment fault detection model, so that when the above-mentioned power fault detection model is lightweight, lightweight processing can be performed based on a model that can output accurate results, which fundamentally ensures that the model after lightweight processing can still maintain the accuracy of the output results.

[0056] S102: Replace the basic network structure of the second power equipment fault detection model with a lightweight network structure to obtain a third power equipment fault detection model.

[0057] Among them, the above-mentioned lightweight network structures include but are not limited to: efficient models based on mobile embedded vision applications (MobileNets), lightweight neural networks (ShuffleNets) and convolutional kernel split networks (Inception).

[0058] Optionally, in other optional embodiments of the present invention, the above-mentioned lightweight network structure has the characteristics of simple network structure, small number of convolution kernels and small number of channels compared with the above-mentioned basic network structure.

[0059] The present invention replaces the basic network structure in the above-mentioned second power equipment fault detection model with a lightweight network structure, thereby obtaining a third power equipment fault detection model with less parameter calculation and lower structural complexity compared with the above-mentioned second power equipment fault detection model.

[0060] S103. Input the third power equipment fault detection model into a preset compression and fine-tuning algorithm so that the preset compression and fine-tuning algorithm compresses and fine-tunes the third power equipment fault detection model to obtain a fourth power equipment fault detection model, wherein the preset compression and fine-tuning algorithm includes: a preset pruning algorithm and a preset knowledge distillation algorithm.

[0061] The preset pruning algorithm reduces the amount of computation by removing neurons or branches in the neural network whose contribution to the output result is lower than the preset standard. The preset standards for the contribution include but are not limited to: neuron weight parameters, regularization average values, average output values ​​of activation functions, and the number of times that the value is not 0 on the test data set. The preset knowledge distillation algorithm compresses the neural network model by reducing the computing resources and latency required for the neural network model, and fine-tunes the compressed neural network model to restore the output accuracy of the neural network model.

[0062] The present invention compresses and fine-tunes the third electric power equipment fault detection model by utilizing the preset compression and fine-tuning algorithm, thereby reducing the network structure complexity of the third electric power equipment fault detection model while ensuring the accuracy of the output results.

[0063] S104: Input the fourth electric power equipment fault detection model into a preset optimization engine, so that the preset optimization engine optimizes the fourth electric power equipment fault detection model to obtain a lightweight electric power equipment fault detection model.

[0064] Among them, the above-mentioned preset optimization engine improves the calculation speed of the optimized neural network model while ensuring the accuracy of the output results by progressively processing the network parameters, running memory and network structure in the neural network model.

[0065] Optionally, the basic network structure of the second power equipment fault detection model is replaced by a lightweight network structure to obtain a third power equipment fault detection model, specifically including:

[0066] The convolution kernel in the basic network structure is replaced by utilizing a lightweight network structure, and the first number of channels in the convolution kernel is reduced to obtain a processed third power equipment fault detection model.

[0067] Optionally, inputting the third power equipment fault detection model into a preset compression fine-tuning algorithm so that the preset compression fine-tuning algorithm compresses and fine-tunes the third power equipment fault detection model to obtain a fourth power equipment fault detection model, including:

[0068] The third electric power equipment fault detection model is compressed using a preset pruning algorithm to obtain a compressed fifth electric power equipment fault detection model.

[0069] The fifth power equipment fault detection model is fine-tuned using a preset knowledge distillation algorithm to obtain a fourth power equipment fault detection model.

[0070] Optionally, compressing the third power equipment fault detection model by using a preset pruning algorithm to obtain a compressed fifth power equipment fault detection model specifically includes:

[0071] Using a preset pruning algorithm, by limiting the search space and setting a reward function, a pruning scheme that satisfies a preset reasoning delay within a preset pruning range and a preset precision loss range is searched for the third power equipment fault detection model. After the search has been iterated for a second number of times, when the search result satisfies a first preset condition, the pruning scheme corresponding to the search result that satisfies the first preset condition is determined as the final pruning scheme, wherein the reward function is used to limit the preset precision loss range and the preset reasoning delay.

[0072] Among them, the above reward function is a function composed of accuracy, computational complexity and inference delay.

[0073] Optionally, in an optional embodiment of the present invention, the preset clipping range can be obtained by dividing the computational complexity of the third power equipment fault detection model by the computational complexity of the untrained model. The computational complexity of the third power equipment fault detection model is determined by the size of the model file that the terminal device can carry. Optionally, in another optional embodiment of the present invention, the clipping scheme includes the number of input channels and the number of output channels of each layer in the third power equipment fault detection model, which is specifically expressed in the form of a model mask. In the model mask, the clipped input channels and output channels are represented as 0, and the non-clipped input channels and output channels are represented as 1.

[0074] Optionally, in another optional embodiment of the present invention, the search result satisfying the first preset condition means that the search result is stable, and the search result is stable means that the cropping rate and precision loss range of the cropping scheme are both within a preset range.

[0075] According to the cropping scheme, the model mask of the third power equipment fault detection model is obtained, the channel layer that is set to zero in the model mask is deleted, and the shape inference of the third power equipment fault detection model is performed by calculating the number of non-zero input channels and output channels in each convolutional layer of the third power equipment fault detection model, so as to obtain the convolutional layer that needs to be replaced in the third power equipment fault detection model, and the replacement of the convolutional layer is completed by rewriting the structure of the convolutional layer using a preset pruning algorithm to obtain a compressed fifth power equipment fault detection model.

[0076] Optionally, fine-tuning the fifth power equipment fault detection model by using a preset knowledge distillation algorithm to obtain a fourth power equipment fault detection model specifically includes:

[0077] The teacher model and the student model are input into the preset knowledge distillation algorithm so that the preset knowledge distillation algorithm extracts the distance between the teacher model and the student model on the output layer as the loss function. The preset knowledge distillation algorithm transfers the features of the teacher model to the student model according to the loss function to obtain a fine-tuned fourth power equipment fault detection model, wherein the teacher model is the second power equipment fault detection model and the student model is the fifth power equipment fault detection model.

[0078] Optionally, in an optional embodiment of the present invention, the role of the above-mentioned loss function is to guide the training of the student model by calculating the difference between the output results of the teacher model and the student model, so that the results of the student model are more accurate.

[0079] Optionally, in another optional embodiment of the present invention, the feature of the teacher model refers to the distribution of responses of each input of the teacher model after calculation by the model, and the feature is expressed as a vector. When the vector distribution of the output layer of the student model is consistent with the vector distribution of the output layer of the teacher model, the above-mentioned operation of migrating the features of the teacher model to the student model is realized.

[0080] Optionally, the fourth power equipment fault detection model is input into a preset optimization engine so that the preset optimization engine optimizes the fourth power equipment fault detection model to obtain a lightweight power equipment fault detection model, including:

[0081] The fourth power equipment fault detection model is quantized, dynamically optimized and layer fused by using a preset optimization engine to obtain a lightweight power equipment fault detection model, wherein the model quantization refers to converting the network parameters in the fourth power equipment fault detection model from the first type to the second type by using the preset optimization engine. The dynamic memory optimization refers to applying for a memory when the fourth power equipment fault detection model is running by using the preset optimization engine, and controlling the fourth power equipment fault detection model to reuse the memory. The layer fusion refers to fusing the convolution operation, bias operation and activation function in the fourth power equipment fault detection model by using the preset optimization engine, and calling a convolution kernel to process the fused operation.

[0082] The present invention trains the first power equipment fault detection model through a preset training set and a preset test set to obtain the second power equipment fault detection model, so that when the above-mentioned power fault detection model is lightweighted, it can be lightweighted based on a model that can output accurate results, which fundamentally ensures that the model after lightweighting can still maintain the accuracy of the output results. At the same time, the present invention adopts a lightweight network structure to replace the basic network structure of the existing model, thereby reducing the parameter calculation amount and structural complexity of the neural network model. The present invention also uses a preset compression fine-tuning algorithm to further simplify the structure of the neural network that has undergone lightweight processing, and uses a preset optimization engine to improve the calculation speed of the neural network while ensuring the accuracy of the output results. It can be seen that the present invention achieves the reduction of the structural complexity of the neural network model while ensuring the accuracy of the output results of the neural network model.

[0083] Corresponding to the above-mentioned embodiment of the method for determining the gaze target, the present invention also provides a system for lightweight fault detection model, such as Figure 2 As shown, the system includes:

[0084] The model training module 201 obtains a second power equipment fault detection model by training the first power equipment fault detection model using a preset training set and a preset test set, wherein the preset training set and the preset test set include: monitoring data collected by the power equipment terminal and the corresponding fault type, and the first power equipment fault detection model is a machine learning model based on Resnet.

[0085] The structure replacement module 202 replaces the basic network structure of the second power equipment fault detection model with a lightweight network structure to obtain a third power equipment fault detection model.

[0086] The compression fine-tuning module 203 is used to input the third power equipment fault detection model into the preset compression fine-tuning algorithm so that the preset compression fine-tuning algorithm compresses and fine-tunes the third power equipment fault detection model to obtain a fourth power equipment fault detection model, wherein the preset compression fine-tuning algorithm includes: a preset pruning algorithm and a preset knowledge distillation algorithm.

[0087] The model optimization module 204 is used to input the fourth power equipment fault detection model into a preset optimization engine, so that the preset optimization engine optimizes the fourth power equipment fault detection model to obtain a lightweight power equipment fault detection model.

[0088] Optionally, the structure replacement module 202 is specifically configured as follows:

[0089] The convolution kernel in the basic network structure is replaced by utilizing a lightweight network structure, and the first number of channels in the convolution kernel is reduced to obtain a processed third power equipment fault detection model.

[0090] Optionally, the compression fine-tuning module 203 includes:

[0091] The compression submodule compresses the third electric power equipment fault detection model using a preset pruning algorithm to obtain a compressed fifth electric power equipment fault detection model.

[0092] The fine-tuning submodule uses a preset knowledge distillation algorithm to fine-tune the fifth power equipment fault detection model to obtain a fourth power equipment fault detection model.

[0093] Optionally, the compression submodule is configured as follows:

[0094] Using a preset pruning algorithm, by limiting the search space and setting a reward function, a pruning scheme that satisfies a preset reasoning delay within a preset pruning range and a preset precision loss range is searched for the third power equipment fault detection model. After the search has been iterated for a second number of times, when the search result satisfies a first preset condition, the pruning scheme corresponding to the search result that satisfies the first preset condition is determined as the final pruning scheme, wherein the reward function is used to limit the preset precision loss range and the preset reasoning delay.

[0095] Optionally, the above-mentioned fine-tuning submodule is configured as follows:

[0096] The teacher model and the student model are input into the preset knowledge distillation algorithm so that the preset knowledge distillation algorithm extracts the distance between the teacher model and the student model on the output layer as the loss function. The preset knowledge distillation algorithm transfers the features of the teacher model to the student model according to the loss function to obtain a fine-tuned fourth power equipment fault detection model, wherein the teacher model is the second power equipment fault detection model and the student model is the fifth power equipment fault detection model.

[0097] Optionally, the model optimization module 204 is configured as follows:

[0098] The fourth power equipment fault detection model is quantized, dynamically optimized and layer-fused by using a preset optimization engine to obtain a lightweight power equipment fault detection model, wherein model quantization refers to converting the network parameters in the fourth power equipment fault detection model from the first type to the second type by using the preset optimization engine. Dynamic memory optimization refers to applying for a memory when the fourth power equipment fault detection model is running by using the preset optimization engine, and controlling the fourth power equipment fault detection model to reuse the memory. Layer fusion refers to fusing the convolution operation, bias operation and activation function in the fourth power equipment fault detection model by using the preset optimization engine, and calling a convolution kernel to process the fused operation.

[0099] An embodiment of the present invention provides a device with a lightweight fault detection model, such as Figure 3 As shown, including:

[0100] Processor 301;

[0101] The memory 302 is used to store instructions executable by the processor 301 .

[0102] The processor 301 is configured to execute instructions to implement any of the above methods for lightweighting the fault detection model.

[0103] An embodiment of the present invention provides a computer-readable storage medium. When instructions in the computer-readable storage medium are executed by a processor 301 of a device, the device can execute any of the above-mentioned methods for lightweighting a fault detection model.

[0104] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0105] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0106] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0107] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0108] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for lightweighting a fault detection model, characterized in that: The method comprises: The first power equipment fault detection model is trained using a preset training set and a preset test set to obtain a second power equipment fault detection model, wherein the preset training set and the preset test set include: monitoring data collected by the power equipment terminal and the corresponding fault type, and the first power equipment fault detection model is a machine learning model based on Resnet; Replacing the basic network structure of the second power equipment fault detection model with a lightweight network structure to obtain a third power equipment fault detection model; Inputting the third power equipment fault detection model into a preset compression and fine-tuning algorithm so that the preset compression and fine-tuning algorithm compresses and fine-tunes the third power equipment fault detection model to obtain a fourth power equipment fault detection model, wherein the preset compression and fine-tuning algorithm includes: a preset pruning algorithm and a preset knowledge distillation algorithm; The fourth electric power equipment fault detection model is input into a preset optimization engine, so that the preset optimization engine optimizes the fourth electric power equipment fault detection model to obtain a lightweight electric power equipment fault detection model.

2. The method according to claim 1, characterized in that The step of replacing the basic network structure of the second power equipment fault detection model with a lightweight network structure to obtain a third power equipment fault detection model specifically includes: The lightweight network structure is used to replace the convolution kernel in the basic network structure, and the first number of channels in the convolution kernel is reduced to obtain the processed third power equipment fault detection model.

3. The method according to claim 1, characterized in that The step of inputting the third electric power equipment fault detection model into a preset compression fine-tuning algorithm so that the preset compression fine-tuning algorithm compresses and fine-tunes the third electric power equipment fault detection model to obtain a fourth electric power equipment fault detection model includes: Compressing the third electric power equipment fault detection model using the preset pruning algorithm to obtain a compressed fifth electric power equipment fault detection model; The fifth electric power equipment fault detection model is fine-tuned using the preset knowledge distillation algorithm to obtain the fourth electric power equipment fault detection model.

4. The method according to claim 3, characterized in that The method of compressing the third electric power equipment fault detection model by using the preset pruning algorithm to obtain a compressed fifth electric power equipment fault detection model specifically includes: Using the preset pruning algorithm, by limiting the search space and setting the reward function, a pruning scheme of the third power equipment fault detection model that satisfies the preset reasoning delay within the preset pruning range and the preset precision loss range is searched, and after the search is iterated for a second number of times, when the result of the search satisfies the first preset condition, the pruning scheme corresponding to the result of the search that satisfies the first preset condition is determined as the final pruning scheme, wherein the reward function is used to limit the preset precision loss range and the preset reasoning delay; According to the cropping scheme, the model mask of the third power equipment fault detection model is obtained, the channel layer that is set to zero in the model mask is deleted using the pruning algorithm, and the shape inference of the third power equipment fault detection model is performed by calculating the number of non-zero input channels and output channels in each convolutional layer of the third power equipment fault detection model to obtain the convolutional layer that needs to be replaced in the third power equipment fault detection model, and the preset pruning algorithm is used to complete the replacement of the convolutional layer by rewriting the structure of the convolutional layer to obtain the compressed fifth power equipment fault detection model.

5. The method according to claim 3, characterized in that: The method of fine-tuning the fifth power equipment fault detection model by using the preset knowledge distillation algorithm to obtain the fourth power equipment fault detection model specifically includes: The teacher model and the student model are input into a preset knowledge distillation algorithm so that the preset knowledge distillation algorithm extracts the distance between the teacher model and the student model on the output layer as a loss function. The preset knowledge distillation algorithm transfers the features of the teacher model to the student model according to the loss function to obtain the fourth power equipment fault detection model that has been fine-tuned, wherein the teacher model is the second power equipment fault detection model and the student model is the fifth power equipment fault detection model.

6. The method according to claim 1, characterized in that The step of inputting the fourth electric power equipment fault detection model into a preset optimization engine so that the preset optimization engine optimizes the fourth electric power equipment fault detection model to obtain a lightweight electric power equipment fault detection model includes: The preset optimization engine is used to perform model quantization, dynamic memory optimization and layer fusion on the fourth power equipment fault detection model to obtain the lightweight power equipment fault detection model, wherein the model quantization refers to converting the network parameters in the fourth power equipment fault detection model from the first type to the second type using the preset optimization engine, the dynamic memory optimization refers to applying for a memory when the fourth power equipment fault detection model is running using the preset optimization engine, and controlling the fourth power equipment fault detection model to reuse the memory, and the layer fusion refers to using the preset optimization engine to fuse the convolution operation, bias operation and activation function in the fourth power equipment fault detection model, and calling a convolution kernel to process the fused operation.

7. A system for lightweight fault detection model, characterized in that: The system comprises: A model training module, which obtains a second power equipment fault detection model by training the first power equipment fault detection model using a preset training set and a preset test set, wherein the preset training set and the preset test set include: monitoring data collected by the power equipment terminal and the corresponding fault type, and the first power equipment fault detection model is a machine learning model based on Resnet; A structure replacement module, which replaces the basic network structure of the second power equipment fault detection model with a lightweight network structure to obtain a third power equipment fault detection model; A compression fine-tuning module, used for inputting the third power equipment fault detection model into a preset compression fine-tuning algorithm, so that the preset compression fine-tuning algorithm compresses and fine-tunes the third power equipment fault detection model to obtain a fourth power equipment fault detection model, wherein the preset compression fine-tuning algorithm includes: a preset pruning algorithm and a preset knowledge distillation algorithm; The model optimization module is used to input the fourth power equipment fault detection model into a preset optimization engine so that the preset optimization engine optimizes the fourth power equipment fault detection model to obtain a lightweight power equipment fault detection model.

8. The system according to claim 7, characterized in that The compression fine-tuning module comprises: a compression submodule, compressing the third electric power equipment fault detection model by using the preset pruning algorithm to obtain a compressed fifth electric power equipment fault detection model; The fine-tuning submodule uses the preset knowledge distillation algorithm to fine-tune the fifth power equipment fault detection model to obtain the fourth power equipment fault detection model.

9. A device for lightweight fault detection model, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method for lightweighting a fault detection model according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor, the method for lightweighting a fault detection model as claimed in any one of claims 1 to 6 can be implemented.

Citation Information

Patent Citations

  • Method and system for compressing convolutional neural network model used for target detection

    CN108898168A

  • Neural network model compression method, system and device and medium

    CN111079899A

  • Convolutional neural network model construction method

    CN112819252A

  • Convolutional neural network model compression method combining pruning and knowledge distillation

    CN113159173A

  • Weight reduction method and system of deep convolutional neural network, and target detection method

    CN113420651A