A meta-learning-based substation equipment defect detection method and system
By introducing the GCB module and ACSP module into the DarkNet-53 detection framework and combining it with the MAML algorithm, the problem of small samples in substation equipment defect detection is solved, and the detection accuracy and the ability to adapt to complex environments are improved.
Patent Information
- Application Number
- CN202311214573.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-18
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-09-18
AI Technical Summary
The existing substation equipment defect detection method has a small sample size problem and the detection results are not accurate enough.
A meta-learning-based method is adopted, combined with the DarkNet-53 detection framework, adding the GCB module and the ACSP module, integrating the MAML algorithm, and extracting global target information through multi-scale pooling and attention mechanism to detect substation equipment defects.
It improves the detection capability and accuracy of detection results in small sample tasks, enhances the overall extraction capability of defect features, and improves detection accuracy.
Smart Images

Figure CN117274191B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer vision and defect detection, and in particular to a meta-learning-based substation equipment defect detection method and system. Background Art
[0002] Real-time defect detection of substation equipment is crucial for its safe and stable operation. Traditional image detection methods, such as local region-based device edge detection, scale-invariant feature transforms, Hough transforms, and K-nearest neighbor algorithms, detect potential defects in these inspection images. However, traditional image detection algorithms can only handle a single defect category and often perform poorly with complex background images. They place high demands on imaging equipment and struggle to adapt to the complex and ever-changing substation equipment environment. With the rapid development of artificial intelligence (AI) technology in recent years, numerous studies have applied AI to substation equipment defect detection. These algorithms utilize labels and data from datasets to train convolutional neural networks (CNNs). For example, a CNN-based substation equipment defect detection method is disclosed in Chinese Patent Publication No. CN114882005A. This type of algorithm can be categorized into object detection and object segmentation. While these algorithms offer higher detection accuracy than traditional algorithms, the application of AI to substation equipment defect detection still suffers from the problem of small sample sizes, limiting the application of AI technology. Summary of the Invention
[0003] The technical problem to be solved by the present invention is that the existing method for detecting defects in substation equipment has the problem of small sample size and the detection results are not accurate enough.
[0004] The present invention solves the above technical problems through the following technical means: a method for detecting substation equipment defects based on meta-learning, comprising the following steps:
[0005] Obtain defect images of substation equipment to form a dataset, which is divided into a training set, a validation set, and a test set;
[0006] Using DarkNet-53 as the detection framework, a GCB module was added to the last layer of the network to extract global target information of different fine-grained levels. An attention mechanism was added to the last two CSP modules of the network to form an ACSP module. Finally, the meta-learning algorithm MAML was integrated into the training process of the detection framework to obtain a meta-learning-based defect detection model. The defect detection model was trained using the training set to obtain the final defect detection model.
[0007] The defect image of the substation equipment to be detected is obtained and preprocessed as the input image. The final defect detection model is used to identify the defect object and location of the input image to obtain the final substation equipment defect detection result.
[0008] Furthermore, the data set is obtained as follows:
[0009] Visible light cameras were used to photograph the internal equipment of the substation at different angles, heights, and distances. Images with defective targets were selected from the captured images for calibration, and open source related datasets were downloaded from the Internet and screened. After expansion and screening, the dataset contained six types of substation equipment defect images, including missing insulators, oil leakage, bird nests, suspended objects, broken dials, and broken insulators. The images were divided into training set, validation set, and test set in a ratio of 7:1:2.
[0010] Furthermore, the working process of the ACSP module is as follows:
[0011] The input passes through two branches. The first branch passes through the CBL layer, RexX layer, and Conv layer. The second branch passes through the CBL layer, Conv layer, and is concatenated with the output of the first branch before passing through the BN layer, L-Relu layer, and CBL layer for output. The ResX layer represents a residual process, which contains several CBL modules and then jumps to the input.
[0012] Furthermore, the working process of the GCB module is as follows:
[0013] Through multi-scale pooling, CBR layer and convolution operation after upsampling, global target information of different fine-grained levels is extracted, and the output is a two-dimensional weight map.
[0014] Furthermore, the working process of DarkNet-53 is as follows:
[0015] After the input passes through the Focus module, it passes through a series of CBL layers and CSP layers. The three CSP layers output three different scales of A-level features, namely the first A-level feature to the third A-level feature; the first A-level feature is divided into two outputs through a CBL layer, one output obtains the first B-level feature, and the other output is fused with the second A-level feature after upsampling, and then it passes through a CSP layer and a CBL layer to be divided into two outputs, one output obtains the second B-level feature, and the other output is fused with the third A-level feature after upsampling to obtain the third B-level feature. The third B-level feature is divided into two after passing through a CSP layer. Output, one output is used as a detection output end, the other output is fused with the second B-level feature after passing through a CBL layer, and then divided into two outputs after passing through an ACSP module, one output is used as another detection output end, and the other output is fused with the first B-level feature after passing through a CBL module and then input into another ACSP module, and the output of the ACSP module is used as another detection output end; the input end of the GCB module is connected to the CSP layer corresponding to the first A-level feature, and the output end of the GCB module is connected to the two ACSP modules respectively; the three detection output ends are connected to the MAML algorithm module for model training.
[0016] Furthermore, the detection framework is used to extract and detect targets in defective images of substation equipment. The input image is divided into an N×M grid, and the center of each grid is predicted. Each cell generates K prediction values, which include the center coordinates of the object, the offset relative to the cell center, the length and width of the prediction box, and the confidence score. The probability value of C categories is output for each cell, indicating the probability size of each category in the prediction box that the cell output may contain the target. The conditional probability of the target existing in the cell is P. r (class|object), P r (object) indicates whether the prediction box contains an object, and the probability that the identified object is a certain category is P r (class), Represents the intersection-over-union ratio of the target prediction box and the target real box area, then:
[0017]
[0018] Furthermore, the model training process of the MAML algorithm module is defined as MFP. The first stage of MFP training corresponds to gradient optimization of the outputs of the three scales. The algorithm will copy the original network with the same parameters as the original network, and receive the loss value obtained by the detection network's own training for gradient optimization; in the second stage, the loss and gradient values on the query set are calculated using the network optimized and updated in the first stage, and the gradient is updated on the parameters of the original network, completing the parameter update of the second stage. At this time, the original model parameters with stronger optimization capabilities are obtained.
[0019] Furthermore, during the model training process of the MAML algorithm module, the loss function adopts classification loss, positioning loss and confidence loss, the initial learning rate is 0.01; the learning rate decay coefficient is 0.0005; the fast adaptation learning rate of the MAML algorithm is 0.0003; the batch size is set to 10; the learning rate adjustment strategy is that when the test set loss does not decrease after 5 consecutive full data sets, the learning rate will be adjusted at a ratio of 0.1; when the loss function value of the test set does not decrease after 100 full data sets, the training is terminated early.
[0020] The present invention also provides a substation equipment defect detection system based on meta-learning, comprising:
[0021] The dataset construction module is used to obtain defect images of substation equipment to form a dataset. The dataset is divided into a training set, a validation set, and a test set.
[0022] The model building and training module uses DarkNet-53 as the detection framework, adds a GCB module to the last layer of the network to extract global target information of different fine-grained levels, adds an attention mechanism to the last two layers of the CSP module to form an ACSP module, and finally integrates the meta-learning algorithm MAML into the training process of the detection framework to obtain a meta-learning-based defect detection model. The defect detection model is trained using the training set to obtain the final defect detection model.
[0023] The detection result output module is used to obtain and preprocess the defect image of the substation equipment to be detected as the input image, and use the final defect detection model to identify the defect object and location of the input image to obtain the final substation equipment defect detection result.
[0024] Furthermore, the dataset construction module is also used to:
[0025] Visible light cameras were used to photograph the internal equipment of the substation at different angles, heights, and distances. Images with defective targets were selected from the captured images for calibration, and open source related datasets were downloaded from the Internet and screened. After expansion and screening, the dataset contained six types of substation equipment defect images, including missing insulators, oil leakage, bird nests, suspended objects, broken dials, and broken insulators. The images were divided into training set, validation set, and test set in a ratio of 7:1:2.
[0026] Furthermore, the working process of the ACSP module is as follows:
[0027] The input passes through two branches. The first branch passes through the CBL layer, RexX layer, and Conv layer. The second branch passes through the CBL layer, Conv layer, and is concatenated with the output of the first branch before passing through the BN layer, L-Relu layer, and CBL layer for output. The ResX layer represents a residual process, which contains several CBL modules and then jumps to the input.
[0028] Furthermore, the working process of the GCB module is as follows:
[0029] Through multi-scale pooling, CBR layer and convolution operation after upsampling, global target information of different fine-grained levels is extracted, and the output is a two-dimensional weight map.
[0030] Furthermore, the working process of DarkNet-53 is as follows:
[0031] After the input passes through the Focus module, it passes through a series of CBL layers and CSP layers. The three CSP layers output three different scales of A-level features, namely the first A-level feature to the third A-level feature; the first A-level feature is divided into two outputs through a CBL layer, one output obtains the first B-level feature, and the other output is fused with the second A-level feature after upsampling, and then it passes through a CSP layer and a CBL layer to be divided into two outputs, one output obtains the second B-level feature, and the other output is fused with the third A-level feature after upsampling to obtain the third B-level feature. The third B-level feature is divided into two after passing through a CSP layer. Output, one output is used as a detection output end, the other output is fused with the second B-level feature after passing through a CBL layer, and then divided into two outputs after passing through an ACSP module, one output is used as another detection output end, and the other output is fused with the first B-level feature after passing through a CBL module and then input into another ACSP module, and the output of the ACSP module is used as another detection output end; the input end of the GCB module is connected to the CSP layer corresponding to the first A-level feature, and the output end of the GCB module is connected to the two ACSP modules respectively; the three detection output ends are connected to the MAML algorithm module for model training.
[0032] Furthermore, the detection framework is used to extract and detect targets in defective images of substation equipment. The input image is divided into an N×M grid, and the center of each grid is predicted. Each cell generates K prediction values, which include the center coordinates of the object, the offset relative to the cell center, the length and width of the prediction box, and the confidence score. The probability value of C categories is output for each cell, indicating the probability size of each category in the prediction box that the cell output may contain the target. The conditional probability of the target existing in the cell is P. r (class|object), P r (object) indicates whether the prediction box contains an object, and the probability that the identified object is a certain category is P r (class), Represents the intersection-over-union ratio of the target prediction box and the target real box area, then:
[0033]
[0034] Furthermore, the model training process of the MAML algorithm module is defined as MFP. The first stage of MFP training corresponds to gradient optimization of the outputs of the three scales. The algorithm will copy the original network with the same parameters as the original network, and receive the loss value obtained by the detection network's own training for gradient optimization; in the second stage, the loss and gradient values on the query set are calculated using the network optimized and updated in the first stage, and the gradient is updated on the parameters of the original network, completing the parameter update of the second stage. At this time, the original model parameters with stronger optimization capabilities are obtained.
[0035] Furthermore, during the model training process of the MAML algorithm module, the loss function adopts classification loss, positioning loss and confidence loss, the initial learning rate is 0.01; the learning rate decay coefficient is 0.0005; the fast adaptation learning rate of the MAML algorithm is 0.0003; the batch size is set to 10; the learning rate adjustment strategy is that when the test set loss does not decrease after 5 consecutive full data sets, the learning rate will be adjusted at a ratio of 0.1; when the loss function value of the test set does not decrease after 100 full data sets, the training is terminated early.
[0036] The advantages of the present invention are:
[0037] (1) This paper integrates the classic meta-learning algorithm MAML in small samples into the DarkNet-53 detection framework, which further highlights the potential performance of parameter optimization during training, improves the detection ability of the network when facing new small sample tasks, and improves the accuracy of detection results.
[0038] (2) The present invention adds a GCB module to the last layer of the DarkNet-53 network. The GCB module extracts global target information of different fine-grained levels through multi-scale pooling, and the output is a two-dimensional weight map. The weight map is input into the ACSP module, thereby highlighting the global and local features of the target and enhancing the overall extraction capability of the original network for defect features. The ACSP module adds an attention mechanism to the last two layers of the CSP module, making full use of the global information extracted by GCB to further improve the accuracy of target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is a schematic diagram of an ACSP module in a meta-learning-based substation equipment defect detection method disclosed in an embodiment of the present invention;
[0040] Figure 2 This is a schematic diagram of a GCB module in a substation equipment defect detection method based on meta-learning disclosed in an embodiment of the present invention;
[0041] Figure 3 This is a schematic diagram of the structure of the DarkNet-53 detection framework in a meta-learning-based substation equipment defect detection method disclosed in an embodiment of the present invention;
[0042] Figure 4 A training flow chart of a meta-learning algorithm in a meta-learning-based substation equipment defect detection method disclosed in an embodiment of the present invention;
[0043] Figure 5 This is a sample diagram of a data set in a method for detecting substation equipment defects based on meta-learning disclosed in an embodiment of the present invention, wherein: Figure 5 (a) and Figure 5 (b) are two sample images from different datasets;
[0044] Figure 6 This is a sample image of the detection effect in a substation equipment defect detection method based on meta-learning disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with 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. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0046] Example 1
[0047] like Figures 1 to 4As shown, the present invention provides a substation equipment defect detection method based on meta-learning, comprising the following steps:
[0048] S1. Obtain defect images of substation equipment to form a dataset. The dataset is divided into a training set, a validation set, and a test set. The specific process is as follows:
[0049] Use a quadruped robot equipped with a visible light camera or manually use a visible light camera to photograph the internal equipment of the substation. The image resolution should be no less than 640*640. The sample image of the dataset is as follows: Figure 5 (a)-5(b) are shown. To ensure data diversity, the images were taken at different angles, heights, and distances. A manual calibration method was used to select images with defective targets from the captured images for calibration. The calibration images were in the PASCAL VOC format. However, the number of manually captured images containing defective targets is very limited. To fully utilize the limited data, open-source datasets were downloaded and screened. After amplification and screening, the dataset contained images of six types of substation equipment defects: missing insulators, oil leaks, bird nests, suspended debris, damaged dials, and damaged insulators. There were 50 images in each category, for a total of 300 images, which were divided into training, validation, and test sets in a ratio of 7:1:2.
[0050] S2. Using DarkNet-53 as the detection framework, a GCB module is added to the last layer of its network to extract global target information of different fine-grained levels. An attention mechanism is added to the last two CSP modules of the network to form an ACSP module. Finally, the meta-learning algorithm MAML is integrated into the training process of the detection framework to obtain a meta-learning-based defect detection model. The defect detection model is trained using the training set to obtain the final defect detection model. The specific process is as follows:
[0051] like Figure 1As shown in the figure, the working process of the ACSP module is as follows: the input passes through two branches. The first branch passes through the CBL layer, RexX layer, and Conv layer. The second branch passes through the CBL layer and Conv layer, is concatenated with the output of the first branch, and then passes through the BN layer, L-Relu layer, and CBL layer before output. The ResX layer represents a residual process, which includes several CBL modules. The output obtained after the input of ResX passes through these several CBL modules is then skipped and added to the input of ResX to obtain the final output. ACSP (Attention-based CSP) introduces an attention mechanism into the CSP module, enabling it to have more efficient target extraction capabilities when processing complex features, thereby better capturing key information in the input features. The feature map processed by the ACSP module enhances the information attention of the target location, which in turn helps guide the accuracy of the target detection task. Specifically, the module introduces a Hadamard product operation at the input port, which helps to increase the attention of the input features to the target location information. The ACSP module uses the Hadamard product operation to combine the feature map generated by the CBL branch with the ACSP module input, thereby enhancing the original input features' focus on target location information. Furthermore, the Hadamard product operation helps increase the receptive field of the feature map, thereby helping to capture target information over a wider range. Therefore, the ACSP module can effectively improve the performance of the object detection algorithm, thereby enhancing object detection accuracy.
[0052] like Figure 2 As shown in the figure, the GCB module works as follows: it extracts global object information at different granularities through multi-scale pooling, CBR layers, and convolution operations after upsampling, resulting in a two-dimensional weight map as output. Specifically, the module first uses a multi-scale pooling method to pool the input feature map at different scales, thereby obtaining feature representations at different scales. These feature representations can better capture the characteristic information of objects at different scales, enhancing the detection capability of objects of different scales. Next, the module uses a CBR layer to extract features from the pooled feature map. By using the CBR layer, the module can better extract feature information from the feature map and improve the feature representation capability. The module then uses an upsampling method to gradually increase the size of the feature map until it returns to the size of the original input feature map. This ensures that the feature map covers all the information in the original input feature map, facilitating subsequent feature extraction and object detection. Finally, the module uses a convolution operation on the upsampled feature map to extract global object information at different granularities. The output is a two-dimensional weight map, which contains feature weight information for each pixel position. These weight information can reflect the matching degree between different targets and different position features, thereby achieving effective detection and recognition of targets.
[0053] like Figure 3 As shown, the working process of DarkNet-53 is as follows: the input passes through the Focus module and then passes through a series of CBL layers and CSP layers, wherein the three CSP layers output three different scales of A-level features, namely the first A-level feature to the third A-level feature; the first A-level feature is divided into two outputs through a CBL layer, one output obtains the first B-level feature, and the other output is fused with the second A-level feature after upsampling, and then is divided into two outputs through a CSP layer and a CBL layer, one output obtains the second B-level feature, and the other output is fused with the third A-level feature after upsampling to obtain the third B-level feature, and the third B-level feature is passed through a After a CSP layer, it is divided into two outputs, one output is used as a detection output end, and the other output is fused with the second B-level feature after passing through a CBL layer, and then divided into two outputs after passing through an ACSP module, one output is used as another detection output end, and the other output is fused with the first B-level feature after passing through a CBL module and then input into another ACSP module, and the output of the ACSP module is used as another detection output end; the input end of the GCB module is connected to the CSP layer corresponding to the first A-level feature, and the output end of the GCB module is connected to the two ACSP modules respectively; the three detection output ends are connected to the MAML algorithm module for model training.
[0054] Continue reading Figure 3The target detection network adopts the improved Darknet-53 feature extraction backbone. Compared with the existing Darknet-53, the Bottleneck CSP module in the improved Darknet-53 is replaced by the C3 module in CSPNet. The feature aggregation module adopts SPPF. Compared with the SPP module, the SPPF module uses multiple small-size pooling instead of the single large-size pooling in the SPP module, thereby further improving the running speed while maintaining the extraction of multi-scale receptive field features. PANet is introduced in the feature fusion layer. PANet introduces a bottom-up path based on the bottom-up feature fusion of FPN, so that the bottom-level position information can also be passed to the deep layer, thereby enhancing the positioning capability at multiple scales. At the same time, compared with FPN, the number of feature layers that the bottom-level features in PANet need to pass through is greatly reduced, making it easier for the bottom-level position information to be passed to the top. After the input passes through the Focus module, it passes through a series of CBL and CSP modules to obtain three different scales of first-level features, namely the above-mentioned A-level features. These features are further subjected to upsampling and CSP, CBL, convolution and other operations to obtain second-level features, namely B-level features. There is a Concat operation between the first and second levels to splice the features, and then a series of convolutions and splicing are performed to obtain outputs of three scales for detection. The specific operation of CBL is that the input passes through the convolution layer Conv, the batch normalization layer BN, and the Leaky Relu activation function layer. The specific operation of CSP is that the input passes through two branches. The first branch passes through the CBL, RexX, and Conv layers. The second branch passes through the Conv layer and is spliced with the output of the first branch, and then passes through the BN, Leaky Relu and CBL layers before output. ResX represents a residual process, which includes several CBL modules, and then jumps to the input. Add a GCB module to the last layer of the DarkNet-53 network, such as Figure 2 As shown in Figure 2, the GCB module extracts global target information of different fine-grained levels through multi-scale pooling, and the output is a two-dimensional weight map. This weight map is input into the ACSP module to highlight the global and local features of the target. ACSP adds an attention mechanism based on CSP, and its structure is as follows: Figure 1 As shown, there are two inputs at the input end of ACSP, where the input of the weight map is channel compressed by the CBL module, and the compressed weight map is Hadamard-producted with the other input.
[0055] When using the DarkNet-53 detection framework for object detection, object detection is treated as a regression problem. The input image is divided into an N×M grid (usually N=M) and the center of each grid is predicted. If the center of an object is located in that grid, then that grid is responsible for detecting the object. Each cell generates K prediction values (bounding boxes), which contain five parameters: the center coordinates of the object, the offset relative to the cell center (x, y, w, h), the length and width of the prediction box, and the confidence score. The confidence score reflects the accuracy of the target information in the prediction box and is calculated as follows:
[0056]
[0057] where P r (object) predicts whether the box contains an object, 1 if it does, 0 if not; Represents the intersection-over-union ratio of the predicted box and the target ground-truth box area.
[0058] The detection network divides the input image into N×M (usually 80*80, 40*40, 20*20) grids, uses convolutional neural networks to extract image features and perform regression predictions on the target. The network output layer contains predictions of three different scales, each of which contains multiple cells. For each cell, the probability value of C categories is output, indicating the probability of the target contained in the prediction box that the cell is responsible for predicting belongs to each category. The conditional probability of the target existing in the cell is P r (class|object), P r (object) indicates whether the prediction box contains an object, and the probability that the identified object is a certain category is P r (class), Represents the intersection-over-union ratio of the target prediction box and the target real box area, then:
[0059]
[0060] This probability value affects the probability that the network ultimately determines the output result belongs to a certain category, and in this way it quantitatively determines the category of the target detected by the detection box.
[0061] The detection network uses three loss functions: classification loss, localization loss, and confidence loss. The overall loss is the weighted sum of these three losses. The weights can be adjusted by changing the weights. The classification loss formula is as follows:
[0062]
[0063] Among them, S and B represent the number of grids into which the scale is divided and the number of targets whose labels are assigned to the prior box, respectively. i (c) is the probability value of category c, is the cross entropy loss, λ c is the classification loss weight coefficient.
[0064] The positioning loss formula is as follows:
[0065]
[0066]
[0067]
[0068]
[0069] Among them, b, b gt are the prediction box and label box respectively, w gt 、h gt , w, h are the width and height of the label box and the prediction box respectively, ρ represents the distance between the center points of the two boxes, and α is the weight coefficient. iou is the weight coefficient of IoU loss.
[0070] The confidence loss formula is as follows:
[0071]
[0072] Among them, λ cls is the weight coefficient of confidence loss.
[0073] exist Figure 3 The Detect part or Figure 4 In the gradient update part, the network performs back propagation through the above three loss functions to obtain the parameter gradient and perform parameter update.
[0074] In the gradient optimization process, referring to the MAML algorithm, the training process is divided into two parts, which are reflected as follows: Figure 3 The MFP (Meta Forward Process) module in the Figure 4 As shown, Figure 4 YOLOv5 refers to the DarkNet-53 detection framework of the present invention, Data-set refers to the input dataset, Support-set refers to the support set, and Query-set refers to the query set. The MAML algorithm process is as follows: Assume that there is a model f θ, the parameter is θ, when training the model's initialization parameters, the model first optimizes the network parameters through the inner loop stage, and then optimizes the network parameters that need to be saved through the outer loop. For the inner loop stage, the network will undergo multiple gradient descents, the formula is:
[0075]
[0076] Among them, α is the inner layer learning rate; is the parameter θ in task T i The loss function used on for In Task T i After one gradient descent, update the network parameters θ.
[0077] In the outer loop phase, the parameters learned by the network in the inner loop need to be reflected in the outer loop, that is, they need to be adapted to all tasks. Therefore, the parameter update formula of the outer loop is as follows:
[0078]
[0079] Among them, β is the outer learning rate, p(T) is the task distribution of meta-learning training tasks, multiple tasks are sampled at a time, and the gradients are calculated and summed over multiple tasks.
[0080] In the implementation case of the present disclosure, the meta-learning algorithm divides the training data into a support set and a query set during the training phase. The network parameters are optimized and trained in two phases: the first phase performs gradient optimization on the support set, and the second phase performs gradient optimization on the query set. Specifically, the first phase of MFP training corresponds to gradient optimization of the outputs of the three scales. The algorithm copies the original network with the same parameters as the original network and receives the loss value obtained from the training of the detection network itself for gradient optimization. In the second phase, the loss and gradient values on the query set are calculated using the network optimized and updated in the first phase. The gradient is updated on the parameters of the original network, completing the second phase of parameter update. At this point, the original model parameters with stronger optimization capabilities are obtained. It should be noted that the MAML algorithm belongs to the prior art, and the above algorithm formula belongs to the existing formula. The present invention only inputs the output results of the DarkNet-53 detection framework into the MAML algorithm for model training and does not improve the MAML algorithm itself. The loss function during training has been given above, and the relevant parameter settings of the training process and the training cutoff conditions are described in detail below.
[0081] The experimental environment of the method of the present invention is Windows 10 system, the CPU is Intel i7-10700KF, the GPU is NVIDIA RTX 3060, the video memory is 12GB, and the GPU acceleration library used is CUDA11.3. The programming language used in the experiment is Python3.8, and the deep learning framework adopts Pytorch, version 1.12.1. The training parameters are as follows: the initial learning rate is 0.01; the learning rate decay coefficient is 0.0005; the momentum gradient descent algorithm with a momentum of 0.9 is adopted; the fast adaptation learning rate of meta-learning is 0.0003; the batch size is set to 10; 300 full data sets (Epoch) are trained by fine-tuning training based on the pre-trained model. The learning rate adjustment strategy is to adjust the learning rate according to a ratio of 0.1 when the test set loss does not decrease after 5 consecutive Epochs; when the loss value of the test set does not decrease after 100 Epochs, the training is terminated early.
[0082] After the network training is completed, the images of the test set are input into the network for detection. When the intersection over union (IoU) between the predicted box output by the model and the target ground truth box is ≥ 0.5 and the target classification is correct, the target detection is considered successful, otherwise it is considered a failure. The final detection result sample image is as follows Figure 6 shown.
[0083] S3. Obtain an image of the substation equipment to be inspected, normalize and crop the image, and use it as the input image. Use the final detection model to identify defective objects and locations in the input image to obtain the final substation equipment defect detection result.
[0084] Through the above technical solution, the present invention integrates the classic meta-learning algorithm MAML in small samples into the DarkNet-53 detection framework, further highlighting the potential performance of parameter optimization during training, improving the detection ability of the network when facing new small sample tasks, optimizing the training scheme, improving the detection performance, and improving the accuracy of the detection results.
[0085] Example 2
[0086] Based on Example 1, Example 2 of the present invention further provides a substation equipment defect detection system based on meta-learning, including:
[0087] The dataset construction module is used to obtain defect images of substation equipment to form a dataset. The dataset is divided into a training set, a validation set, and a test set.
[0088] The model building and training module uses DarkNet-53 as the detection framework, adds a GCB module to the last layer of the network to extract global target information of different fine-grained levels, adds an attention mechanism to the last two layers of the CSP module to form an ACSP module, and finally integrates the meta-learning algorithm MAML into the training process of the detection framework to obtain a meta-learning-based defect detection model. The defect detection model is trained using the training set to obtain the final defect detection model.
[0089] The detection result output module is used to obtain and preprocess the defect image of the substation equipment to be detected as the input image, and use the final defect detection model to identify the defect object and location of the input image to obtain the final substation equipment defect detection result.
[0090] Specifically, the dataset construction module is further used to:
[0091] Visible light cameras were used to photograph the internal equipment of the substation at different angles, heights, and distances. Images with defective targets were selected from the captured images for calibration, and open source related datasets were downloaded from the Internet and screened. After expansion and screening, the dataset contained six types of substation equipment defect images, including missing insulators, oil leakage, bird nests, suspended objects, broken dials, and broken insulators. The images were divided into training set, validation set, and test set in a ratio of 7:1:2.
[0092] Specifically, the working process of the ACSP module is as follows:
[0093] The input passes through two branches. The first branch passes through the CBL layer, RexX layer, and Conv layer. The second branch passes through the CBL layer, Conv layer, and is concatenated with the output of the first branch before passing through the BN layer, L-Relu layer, and CBL layer for output. The ResX layer represents a residual process, which contains several CBL modules and then jumps to the input.
[0094] More specifically, the working process of the GCB module is as follows:
[0095] Through multi-scale pooling, CBR layer and convolution operation after upsampling, global target information of different fine-grained levels is extracted, and the output is a two-dimensional weight map.
[0096] More specifically, the working process of DarkNet-53 is:
[0097] After the input passes through the Focus module, it passes through a series of CBL layers and CSP layers. The three CSP layers output three different scales of A-level features, namely the first A-level feature to the third A-level feature; the first A-level feature is divided into two outputs through a CBL layer, one output obtains the first B-level feature, and the other output is fused with the second A-level feature after upsampling, and then it passes through a CSP layer and a CBL layer to be divided into two outputs, one output obtains the second B-level feature, and the other output is fused with the third A-level feature after upsampling to obtain the third B-level feature. The third B-level feature is divided into two after passing through a CSP layer. Output, one output is used as a detection output end, the other output is fused with the second B-level feature after passing through a CBL layer, and then divided into two outputs after passing through an ACSP module, one output is used as another detection output end, and the other output is fused with the first B-level feature after passing through a CBL module and then input into another ACSP module, and the output of the ACSP module is used as another detection output end; the input end of the GCB module is connected to the CSP layer corresponding to the first A-level feature, and the output end of the GCB module is connected to the two ACSP modules respectively; the three detection output ends are connected to the MAML algorithm module for model training.
[0098] More specifically, the detection framework is used to extract and detect targets in defective images of substation equipment. The input image is divided into an N×M grid, and the center of each grid is predicted. Each cell generates K prediction values, which include the center coordinates of the object, the offset relative to the cell center, the length and width of the prediction box, and the confidence score. The probability values of C categories are output for each cell, indicating the probability of each category in the prediction box that the cell output may contain the target. The conditional probability of the target existing in the cell is P. r (class|object), P r (object) indicates whether the prediction box contains an object, and the probability that the identified object is a certain category is P r (class), Represents the intersection-over-union ratio of the target prediction box and the target real box area, then:
[0099]
[0100] More specifically, the model training process of the MAML algorithm module is defined as MFP. The first stage of MFP training corresponds to gradient optimization of the outputs of the three scales. The algorithm will copy the original network with the same parameters as the original network, and receive the loss value obtained by the detection network's own training for gradient optimization; in the second stage, the loss and gradient value on the query set are calculated using the network optimized and updated in the first stage, and the gradient is updated on the parameters of the original network, completing the parameter update of the second stage. At this time, the original model parameters with stronger optimization capabilities are obtained.
[0101] More specifically, during the model training process of the MAML algorithm module, the loss function adopts classification loss, positioning loss and confidence loss, the initial learning rate is 0.01; the learning rate decay coefficient is 0.0005; the fast adaptation learning rate of the MAML algorithm is 0.0003; the batch size is set to 10; the learning rate adjustment strategy is that when the test set loss does not decrease after 5 consecutive full data sets, the learning rate will be adjusted at a ratio of 0.1; when the loss function value of the test set does not decrease after 100 full data sets, the training is terminated early.
[0102] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for detecting substation equipment defects based on meta-learning, characterized in that: The following steps are involved: Obtain defect images of substation equipment to form a dataset, which is divided into a training set, a validation set, and a test set; DarkNet-53 is used as the detection framework, and a GCB module for extracting global target information of different fine-grained levels is added to the last layer of its network. The attention mechanism is added to the last two CSP modules of the network to form an ACSP module. Finally, the meta-learning algorithm MAML algorithm is integrated into the training process of the detection framework to obtain a meta-learning-based defect detection model. The defect detection model is trained using the training set to obtain the final defect detection model. The working process of the ACSP module is as follows: the input passes through two branches, the first branch passes through the CBL layer, the RexX layer, and the Conv layer, and the second branch passes through the CBL layer and the Conv layer and is concatenated with the output of the first branch. The second branch passes through the BN layer, the L-Relu layer, and the CBL layer before output. The ResX layer represents a residual process, which contains several CBL modules and is then jump-connected to the input. The working process of the GCB module is as follows: global target information of different fine-grained levels is extracted through multi-scale pooling, the CBR layer, and convolution operations after upsampling, and the output is a two-dimensional weight map. The working process of DarkNet-53 is as follows: the input passes through the Focus module and then passes through a series of CBL layers and CSP layers, wherein the three CSP layers output three different scales of A-level features, namely the first A-level feature to the third A-level feature; the first A-level feature is divided into two outputs through a CBL layer, one output obtains the first B-level feature, and the other output is fused with the second A-level feature after upsampling, and then is divided into two outputs through a CSP layer and a CBL layer, one output obtains the second B-level feature, and the other output is fused with the third A-level feature after upsampling to obtain the third B-level feature, and the third B-level feature is passed through a CBL layer. After the SP layer, the output is divided into two paths. One output is used as a detection output end. The other output passes through a CBL layer and is fused with the second B-level feature. Then, after passing through an ACSP module, it is divided into two output paths. One output is used as another detection output end. The other output passes through a CBL module and is fused with the first B-level feature and then input into another ACSP module. The output of the ACSP module is used as another detection output end. The input end of the GCB module is connected to the CSP layer corresponding to the first A-level feature. The output end of the GCB module is connected to the two ACSP modules respectively. The three detection output ends are connected to the MAML algorithm module for model training. The defect image of the substation equipment to be detected is obtained and preprocessed as the input image. The final defect detection model is used to identify the defect object and location of the input image to obtain the final substation equipment defect detection result.
2. A method for detecting substation equipment defects based on meta-learning according to claim 1, characterized in that: The process of obtaining the dataset is as follows: Visible light cameras were used to photograph the internal equipment of the substation at different angles, heights, and distances. Images with defective targets were selected from the captured images for calibration, and open source related datasets were downloaded from the Internet and screened. After expansion and screening, the dataset contained six types of substation equipment defect images, including missing insulators, oil leakage, bird nests, suspended objects, broken dials, and broken insulators. The images were divided into training set, validation set, and test set in a ratio of 7:1:
2.
3. The method for detecting substation equipment defects based on meta-learning according to claim 1, characterized in that: The detection framework is used to extract and detect targets in defect images of substation equipment, and the input image is divided into , and predict the center of each grid; each cell will generate K prediction values, which include the center coordinates of the object, the offset relative to the cell center, the length and width of the prediction box, and the confidence score; output C category probability values for each cell, indicating the probability size of each category in the prediction box that the cell outputs may contain the target. The conditional probability of the target existing in the cell is , Indicates whether the prediction box contains a target, and the probability that the identified target is a certain category is , Represents the intersection-over-union ratio of the target prediction box and the target real box area, then: 。 4. A method for detecting substation equipment defects based on meta-learning according to claim 1, characterized in that: The model training process of the MAML algorithm module is defined as MFP. The first stage of MFP training corresponds to gradient optimization of the outputs of the three scales. The algorithm will copy the original network with the same parameters as the original network and receive the loss value obtained by the detection network itself for gradient optimization. In the second stage, the loss and gradient values on the query set are calculated using the network optimized and updated in the first stage, and the gradients are updated on the parameters of the original network, completing the parameter update of the second stage. At this time, the original model parameters with stronger optimization capabilities are obtained.
5. A method for detecting substation equipment defects based on meta-learning according to claim 4, characterized in that: The loss function of the MAML algorithm module in the process of model training adopts classification loss, positioning loss and confidence loss, the initial learning rate is 0.01; the learning rate decay coefficient is 0.0005; the fast adaptation learning rate of the MAML algorithm is 0.0003; and the batch size is set to 10; The learning rate adjustment strategy is to adjust the learning rate by a ratio of 0.1 when the loss function value of the test set does not decrease after 5 consecutive full data sets; when the loss function value of the test set does not decrease after 100 full data sets, the training is terminated early.
6. A substation equipment defect detection system based on meta-learning, characterized in that: include: The dataset construction module is used to obtain defect images of substation equipment to form a dataset. The dataset is divided into a training set, a validation set, and a test set. The model construction and training module is used to use DarkNet-53 as the detection framework, add a GCB module for extracting global target information of different fine-grained levels to the last layer of its network, add an attention mechanism to the last two CSP modules of the network to form an ACSP module, and finally integrate the meta-learning algorithm MAML algorithm into the training process of the detection framework to obtain a meta-learning-based defect detection model. The defect detection model is trained using the training set to obtain the final defect detection model. The working process of the ACSP module is as follows: the input passes through two branches, the first branch passes through the CBL layer, the RexX layer, and the Conv layer, and the second branch passes through the CBL layer and the Conv layer and is concatenated with the output of the first branch, and then passes through the BN layer, the L-Relu layer, and the CBL layer before output. The ResX layer represents a residual process, which includes several CBL modules and is then jump-connected to the input. The working process of the GCB module is as follows: global target information of different fine-grained levels is extracted through multi-scale pooling, the CBR layer, and convolution operations after upsampling, and the output is a two-dimensional weight map. The working process of DarkNet-53 is as follows: the input passes through the Focus module and then passes through a series of CBL layers and CSP layers, wherein the three CSP layers output three different scales of A-level features, namely the first A-level feature to the third A-level feature; the first A-level feature is divided into two outputs through a CBL layer, one output obtains the first B-level feature, and the other output is fused with the second A-level feature after upsampling, and then is divided into two outputs through a CSP layer and a CBL layer, one output obtains the second B-level feature, and the other output is fused with the third A-level feature after upsampling to obtain the third B-level feature, and the third B-level feature is passed through a CBL layer. After the SP layer, the output is divided into two paths. One output is used as a detection output end. The other output passes through a CBL layer and is fused with the second B-level feature. Then, after passing through an ACSP module, it is divided into two output paths. One output is used as another detection output end. The other output passes through a CBL module and is fused with the first B-level feature and then input into another ACSP module. The output of the ACSP module is used as another detection output end. The input end of the GCB module is connected to the CSP layer corresponding to the first A-level feature. The output end of the GCB module is connected to the two ACSP modules respectively. The three detection output ends are connected to the MAML algorithm module for model training. The detection result output module is used to obtain and preprocess the defect image of the substation equipment to be detected as the input image, and use the final defect detection model to identify the defect object and location of the input image to obtain the final substation equipment defect detection result.
7. A meta-learning-based substation equipment defect detection system according to claim 6, characterized in that: The dataset construction module is further configured to: Visible light cameras were used to photograph the internal equipment of the substation at different angles, heights, and distances. Images with defective targets were selected from the captured images for calibration, and open source related datasets were downloaded from the Internet and screened. After expansion and screening, the dataset contained six types of substation equipment defect images, including missing insulators, oil leakage, bird nests, suspended objects, broken dials, and broken insulators. The images were divided into training set, validation set, and test set in a ratio of 7:1:2.
Citation Information
Patent Citations
Convolutional neural network-based substation equipment defect detection method
CN114882005A
Small sample target detection method based on multi-scale feature weighting
CN112464743A
Cylinder sleeve small sample defect detection method based on meta learning
CN114663729A