Power grid anomaly detection method and system based on multi-dimensional residual attention mechanism
By introducing a multi-dimensional residual attention mechanism in the power grid abnormal detection, combined with the CNN and Faster R-CNN, the SVM is used to perform a duct classification to solve the problem of feature extraction and neglect of the contemporary information and correlation in existing technologies. Detection accuracy and generalization ability.
Patent Information
- Application Number
- CN202411976166.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-01-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing power grid abnormality detection methods ignore important context information and feature correlations in feature extraction, making it difficult to adapt to complex or fuzzy defect detection scenarios, resulting in a high rate of missed detection and false detection.
Adopt a grid abnormal detection method based on multi-dimensional residual attention mechanisms, extract the deep features of power grid images through multidimensional residual attention mechanisms, and combine the Internet extraction network with the convolutional neural network CNN and Faster R-CNN regions to generate anchor frames and preliminary preliminary preliminary proceedings Filter, and finally use the support vector machine SVM for duplex detection.
It significantly enhances the sensitivity of the model to the slightly different changes, improves the accuracy and generalized performance of the abnormal detection of the power grid, and reduces the risk of misunderstanding and missed inspection.
Smart Images

Figure CN119380123A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power grid anomaly detection, and in particular to a power grid anomaly detection method and system based on a multi-dimensional residual attention mechanism. Background Art
[0002] The complexity and high standards of the power grid require that any potential faults be identified and responded to quickly and accurately. Although the traditional manual power inspection model can reveal hidden dangers, its drawbacks of low efficiency, high cost and susceptibility to environmental constraints are becoming increasingly apparent. For this reason, the field of power inspection is accelerating its transformation to intelligence, especially relying on deep learning technology, in order to significantly improve inspection efficiency and accuracy. In recent years, the significant progress of deep learning in the field of image recognition has provided a new way for the automatic recognition of power inspection images.
[0003] In this context, researchers proposed the Faster-RCNN detection method, which aims to achieve automatic identification and early warning of foreign objects and transmission equipment defects in the power grid through efficient and accurate target detection technology, thereby effectively reducing the risk of power grid failure and ensuring the safe and stable operation of the power system. However, the Faster-RCNN detection method still faces many challenges in the recognition of small target objects in power inspections, especially the detection of pin detachment in soft connection structures during drone inspections. First, the area occupied by the pins in the image is extremely small, which requires the recognition algorithm to have extremely high detail capture capabilities to accurately identify and locate these key components. Secondly, the scarcity and uneven distribution of pin defect samples seriously limit the quality of the training set, which in turn affects the generalization ability of the recognition algorithm. Finally, the diversity of angles and distances when drones shoot leads to the different presentation states of pins in different images, which further increases the difficulty of recognition.
[0004] In order to meet these challenges, detection models based on attention mechanisms have shown excellent performance in recent years. Although traditional attention mechanisms can help models focus on key areas in images to a certain extent, their single-dimensional attention method limits their ability to fully capture multi-dimensional features of images. In situations where samples are scarce and unevenly distributed, traditional attention mechanisms often find it difficult to learn sufficient feature representations, resulting in limited generalization performance.
[0005] The invention with patent application number CN202210622169.5 proposes a method for substation equipment defect detection based on convolutional neural network, which is mainly trained in the following steps: 1) Collect substation equipment defect image data, classify and count according to the substation equipment defect data category, and establish a substation equipment defect data set, including a training set and a test set; 2) Build an improved Faster RCNN model, add the FPN feature pyramid structure to the Faster RCNN network structure, predict each fused feature layer separately, and the region extraction network RPN extracts the region based on the improved anchor frame; 3) Use the training set to train the improved Faster RCNN model; 4) Use the test set to test the performance of the improved Faster RCNN model, and then use the improved Faster RCNN model for power equipment appearance defect detection. However, this scheme has the following defects: ① Although the FPN feature pyramid structure enhances the model's detection ability for targets of different scales, it may still ignore some important contextual information or the correlation between features when extracting features. This may cause the model to perform poorly in some complex or ambiguous defect detection scenarios. ② Abnormal phenomena in the power grid may have multiple manifestations and complex background environments. Existing models may have difficulty in fully adapting to these complex scenarios, resulting in high rates of missed detections or false detections.
[0006] The invention with patent application number CN202211313317.1 proposes a disc harrow surface defect detection method based on an improved Faster RCNN algorithm, which is mainly trained in the following steps: 1) Use fixed equipment to collect disc harrow images on the production line, select images with defects, and crop them; 2) Annotate, divide, and enhance the collected images to determine the training set and verification set; 3) Improve the model based on the Faster RCNN algorithm: Use the K means clustering method to automatically generate the anchor ratio; Use the Resnet50+FPN structure as the backbone; Add the CA attention mechanism to the model; Use ROI Align instead of ROI Pooling; Use the EIOU NMS designed based on the generalized intersection-over-union (EIOU) to replace the non-maximum suppression NMS in the second stage of the traditional Faster RCNN algorithm; 4) The loss function used in the training of the Faster RCNN model includes the loss function of Fast RCNN and the loss function of RPN. The loss function during training is improved, and SIOU Loss is used as the regression loss of the entire algorithm; 5) Improve the Faster RCNN model. RCNN model is trained; 6) the disc rake image to be inspected is input into the trained model for image processing and outputting a new image, and the identified defects are framed with a rectangle, and the defect category and probability are marked. However, this scheme has the following defects: ① Although the Resnet50+FPN structure is selected as the backbone, FPN mainly focuses on the construction of feature pyramids, which may still be insufficient for feature extraction in complex scenes. In particular, the robustness of the model may be affected when facing changing lighting conditions, occlusions or complex backgrounds. ② Although the introduced CA attention mechanism can enhance the model's attention to key areas, a single attention mechanism may not be able to fully capture the complex correlations and importance differences in multidimensional data.
[0007] The shortcomings of the above-mentioned prior art can be summarized as follows: Although the current power grid anomaly detection method utilizes the FPN feature pyramid structure to enhance the multi-scale detection capability of the Faster-RCNN model, it still ignores important contextual information and feature correlation in feature extraction, limiting the performance of the model in complex or fuzzy defect detection. At the same time, the diversity of the power grid environment (such as variable lighting, occlusion, and complex background) puts higher requirements on the model. The existing Resnet50+FPN backbone model is not adaptable enough in such complex scenarios, resulting in missed detection and false detection problems. In addition, the single CA attention mechanism is difficult to fully capture the complex correlations and feature importance differences in multidimensional data, affecting the accuracy and robustness of the model in power grid anomaly detection. Summary of the invention
[0008] In view of the deficiencies in the prior art, the object of the present invention is to provide a power grid anomaly detection method and system based on a multi-dimensional residual attention mechanism.
[0009] In order to achieve the above object, the present invention provides the following technical solution: a power grid anomaly detection method based on a multidimensional residual attention mechanism, the detection method comprising the following steps: Input the power grid image, extract the deep features of the power grid image through the multi-dimensional residual attention mechanism, and generate the feature map through the convolutional neural network CNN; The feature map is input into the region extraction network RPN of Faster R-CNN to generate anchor boxes, which are used as candidate regions. Classify and regress the candidate regions, and preliminarily screen out potential abnormal targets in the image as the input of the next layer of support vector machine (SVM); Use the trained support vector machine (SVM) to classify potential abnormal targets into two categories to identify whether there are abnormalities, and mark the detected anomalies in the graph.
[0010] In a preferred embodiment, the deep features of the power grid image are extracted by a multi-dimensional residual attention mechanism, comprising the following steps: The multidimensional residual attention mechanism consists of four branches. The first branch is the residual branch. The input tensor is x, which is used to retain the original feature information. The dimension of x is , is the channel dimension, , is the spatial dimension; The second branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the C axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the C axis Keep x the same dimensions as the original input; The third branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the W axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the W axis Keep x the same dimensions as the original input; The fourth branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the H axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the H axis Keep x the same dimensions as the original input; The calculation process expression of the Z-pool pooling layer is: , (1) in represents the input tensor, Indicates the maximum pooling operation on the 0th dimension. Indicates that an average pooling operation is performed on the 0th dimension; From the input tensor The process expression of obtaining the refined attention tensor y in the multi-dimensional residual attention mechanism is: , (2) In the formula represents the original input shape, σ represents the sigmoid activation function; in the three branches of the multidimensional residual attention mechanism, , and The kernel size is The standard convolutional layer of ; simplifying formula (2) to obtain: , (3) in , , The three cross-dimensional attention weights calculated in the multi-dimensional residual attention mechanism; , and represents a 90° clockwise rotation to keep the same shape of the original input of (C × H × W).
[0011] In a preferred embodiment, generating a feature map by a convolutional neural network (CNN) comprises the following steps: The image processed by the multi-dimensional residual attention mechanism is input into the convolutional neural network CNN. CNN gradually extracts the deep features of the image through multi-layer convolution operations and finally generates a feature map. Each pixel or area in the feature map corresponds to an area in the original image and contains the deep feature representation of the area.
[0012] In a preferred embodiment, the feature map is input into the region extraction network RPN of Faster R-CNN to generate an anchor frame, including the following steps: After the feature map passes through the region extraction network RPN, each pixel in the original image corresponds to a 16x16 pixel area; the generation parameters of the anchor frame are: ratios=[0.5, 1, 2], which means generating three anchor frames with different aspect ratios, that is, changing the aspect ratio to 0.5, 1, and 2 respectively; scales=[8, 16, 32], which means magnifying by 8 times, 16 times, and 32 times respectively, that is, the side length becomes 256, 512, and 1024; for each pixel in the feature map, in the 16x16 area corresponding to the original image, 9 anchor frames of different shapes and sizes are generated according to the ratios and scales parameters; After filtering out some anchor boxes, the remaining anchor boxes are marked as positive samples, negative samples or useless samples. Positive samples contain targets, and negative samples do not contain targets. The offset between each anchor box and the marked box in the training image is calculated, and the gradient descent algorithm is used to perform back propagation training on the region extraction network RPN. The loss function is: , (4) , (5) Where: i is the sequence number of the anchor frame; is the probability that the anchor box is a positive sample, is the true label of the anchor box, the positive sample is 1 and the negative sample is 0; is the predicted offset of the anchor box, is the true offset; classification loss Use the logarithmic loss function for binary classification; regression loss From formula (5), R is the robust loss function Smooth L1; and Used to standardize output; To balance the weight.
[0013] In a preferred embodiment, classifying the candidate regions and performing bounding box regression comprises the following steps: The candidate regions are processed through the ROI pooling layer and input into the fully connected layer to classify and locate abnormal targets using the Softmax loss function and the Smooth L1 loss function. Use the Softmax loss function to classify the candidate area to determine whether it contains abnormal targets. The Softmax loss function expression is: , (6) in, represents the original output for the jth category, represents the sum of the original outputs of all categories after exponential operation, and k represents the total number of categories; The Smooth L1 loss function is used to regress the bounding box of the candidate area. The Smooth L1 loss function expression is: , (7) in, is the Smooth L1 loss function value, u represents the error between the predicted bounding box and the true bounding box, ∣ u ∣: indicates u The absolute value of the error is not considered, that is, the positive and negative errors are not considered.
[0014] In a preferred embodiment, a trained support vector machine (SVM) is used to perform binary classification on potential abnormal targets to identify whether there are abnormalities therein, including the following steps: The optimization goal of the support vector machine (SVM) is to find a hyperplane in the multidimensional sample space to correctly divide the samples into two categories and maximize the interval between the two categories of samples. The equation of the hyperplane is expressed as: , (8) in, Represents the horizontal coordinate of a sample point in the multidimensional sample space; is the normal vector, which determines the direction of the hyperplane; is the displacement term, which determines the distance between the hyperplane and the origin; For the sample points ( , ),when =1 ,when Sometimes ; Increase the interval between the two categories so that the classification is always correct or holds; the interval between the planes where the two types of support vectors are located is ; Find the best hyperplane, that is, find the interval under the premise of satisfying the constraints. r The largest parameter ω and b , the expression is: , (9) in m is the total number of samples. Equation (9) is a convex quadratic programming problem with inequality constraints. The Lagrange multiplier method is used to obtain its dual problem. By solving the dual problem, the parameters are obtained. ω and b , thereby determining the optimal classification hyperplane.
[0015] A power grid anomaly detection system based on a multi-dimensional residual attention mechanism, comprising a deep feature extraction module, a candidate region generation module, a candidate region screening module, and an anomaly detection module; Deep feature extraction module: input power grid image, extract deep features of power grid image through multi-dimensional residual attention mechanism, and generate feature map through convolutional neural network CNN; Candidate region generation module: inputs the feature map into the region extraction network RPN of Faster R-CNN to generate anchor boxes, which are used as candidate regions; Candidate region screening module: classifies candidate regions and performs bounding box regression to preliminarily screen out potential abnormal targets in the image as input for the next layer of support vector machine (SVM); Anomaly detection module: Use the trained support vector machine (SVM) to classify potential abnormal targets into two categories, identify whether there are anomalies, and mark the detected anomalies in the graph.
[0016] In the above technical solution, the technical effects and advantages provided by the present invention are: By introducing a multi-dimensional residual attention mechanism, the present invention can finely weight the feature map in multiple dimensions, not only focusing on the spatial position information in the image, but also capturing features in multiple dimensions such as color, texture, and shape. This multi-dimensional feature capture capability significantly enhances the model's sensitivity to subtle abnormal changes, and is particularly suitable for the detection of small target objects such as pin shedding in power grids. At the same time, in response to the problems of sample scarcity and uneven distribution in power grid anomaly detection, the model constructed by the present invention can make more full use of limited samples and learn more robust and adaptable feature representations. These features show better stability to changes in different viewing angles, lighting conditions, etc., thereby effectively improving the generalization performance of the model and reducing the negative impact caused by sample problems.
[0017] By combining the general target detection algorithm of the multi-dimensional residual attention mechanism and the two-level recognition algorithm of the power grid anomaly of the support vector machine, the present invention can first preliminarily screen out potential abnormal targets through the deep learning model, and then use SVM for fine classification, which effectively reduces the risk of false detection and missed detection and improves the accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0019] Figure 1 is a flow chart of the method of the present invention; Figure 2 Schematic diagram of the residual attention mechanism. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.
[0021] Embodiment 1: In traditional power grid anomaly detection systems, the model often gives the same weight to all features when processing image data. This processing method ignores the differences in importance between different areas and different features in the image, resulting in the model being inefficient in extracting key information and easily interfered by background noise and irrelevant details. In complex or ambiguous defect detection scenarios, this indiscriminate feature processing method will significantly increase the risk of false detection and missed detection, and reduce detection accuracy. Therefore, in this embodiment, by introducing a multi-dimensional residual attention mechanism, the model can simultaneously focus on multiple key features in different dimensions, establish a more comprehensive and in-depth understanding of feature correlation, and thus improve the accuracy and generalization of power grid anomaly detection.
[0022] Anomalies in power grids are often very subtle, such as tiny cracks, rust, or local overheating. When dealing with these subtle anomalies, general target detection algorithms such as Faster R-CNN may not be able to effectively capture these subtle changes due to the large granularity of feature extraction, resulting in a high missed detection rate. In addition, in the data set for power grid anomaly detection, the number of abnormal samples is far less than that of normal samples, which further exacerbates the problem of insufficient model learning of minority categories during training. When dealing with such highly unbalanced data sets, algorithms such as Faster R-CNN often find it difficult to fully learn the features of abnormal samples, resulting in poor detection results. Therefore, this embodiment proposes a two-level recognition algorithm for power grid anomalies using a Faster R-CNN target detection algorithm combined with a multidimensional residual attention mechanism and a support vector machine. The first stage uses a target detection algorithm combined with a multidimensional residual attention mechanism, which can use the powerful feature extraction and learning capabilities of a deep learning model to preliminarily screen out potential abnormal targets in massive data. The second stage uses SVM for fine classification, which can conduct more in-depth analysis and judgment on the potential abnormal targets screened out at the first stage. SVM has unique advantages in processing small samples, high-dimensional data and complex classification problems, and can further improve the accuracy and reliability of detection.
[0023] See also Figure 1 As shown, this embodiment provides a power grid anomaly detection method based on a multi-dimensional residual attention mechanism, and the detection method includes the following steps: (1) Input the power grid image, extract the deep features of the power grid image through the multi-dimensional residual attention mechanism to enhance the model's ability to capture subtle anomalies, and generate feature maps through the convolutional neural network (CNN); Since power grid images usually contain information in multiple dimensions (such as color, texture, shape, etc.), the multi-dimensional residual attention mechanism processes the information in these dimensions separately by designing different attention modules. Each attention module can generate corresponding attention weights according to its own characteristics and perform weighted processing on the input features. In this way, the model can fully capture the deep features of power grid images from multiple dimensions. The image processed by the multi-dimensional residual attention mechanism will be further input into the convolutional neural network. CNN gradually extracts the deep features of the image through multi-layer convolution operations and finally generates a feature map. Each pixel or area in the feature map corresponds to an area in the original image and contains the deep feature representation of the area. These feature representations not only contain spatial position information, but also integrate features of multiple dimensions such as color, texture, and shape.
[0024] The deep features of the power grid image are extracted through the multi-dimensional residual attention mechanism, which includes the following steps: like Figure 2 As shown in Figure 2, the multidimensional residual attention mechanism consists of four branches. The first branch is the residual branch. The input tensor is x, which is used to retain the original feature information. The dimension of x is , is the channel dimension, , The first branch preserves the original feature information and provides an additional propagation path for the gradient by directly passing the input features to the subsequent layers of the network. This "pass-through" method helps to maintain the stability of the gradient, reduce the attenuation in the deep network, and enable the model parameters to be updated and converged more quickly during training, thereby enhancing the robustness of the model.
[0025] The second branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the C axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is In this embodiment, is 7, and then passes through the batch normalization layer to provide a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the C axis Keep x the same dimensions as the original input.
[0026] The third branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the W axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the W axis Keep x the same dimensions as the original input.
[0027] The fourth branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the H axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the H axis Keep x the same dimensions as the original input.
[0028] The Z-pool pooling layer can not only retain the rich representation of the actual tensor, but also reduce its depth to reduce the subsequent calculation amount. The calculation process expression of the Z-pool pooling layer is: , (1) in represents the input tensor, Indicates the maximum pooling operation on the 0th dimension. Indicates that an average pooling operation is performed on the 0th dimension.
[0029] From the input tensor The process expression of obtaining the refined attention tensor y in the multi-dimensional residual attention mechanism is: , (2) In the formula represents the original input shape, σ represents the sigmoid activation function; in the three branches of the multidimensional residual attention mechanism, , and The kernel size is The standard convolutional layer of ; simplifying formula (2) to obtain: , (3) in , , The three cross-dimensional attention weights calculated in the multi-dimensional residual attention mechanism; , and represents a 90° clockwise rotation to keep the same shape of the original input of (C × H × W).
[0030] (2) Input the feature map into the region extraction network RPN of Faster R-CNN to generate anchor boxes, which are used as candidate regions; After the feature map is input into the region extraction network RPN, a certain number of anchor frames will be generated according to preset parameters on the original image area corresponding to each point, and the overlap between the image and the target in the frame will be calculated based on the anchor frame. These anchor frames will cover the areas in the power grid image that may contain abnormal targets.
[0031] The region extraction network RPN generates a series of anchor boxes on the feature map. These anchor boxes are candidate regions that may contain abnormal targets in the power grid. After the feature map passes through the region extraction network RPN, each pixel in the original image corresponds to a 16x16 pixel area; the generation parameters of the anchor box are: ratios=[0.5, 1, 2], which means generating three anchor boxes with different aspect ratios, that is, changing the aspect ratio to 0.5, 1, and 2 respectively; scales=[8, 16, 32], which means magnifying by 8 times, 16 times, and 32 times respectively, that is, the side length becomes 256, 512, and 1024; for each pixel in the feature map, in the 16x16 area corresponding to the original image, 9 anchor boxes of different shapes and sizes are generated according to the ratios and scales parameters (each side length corresponds to 3 aspect ratios).
[0032] After filtering out some anchor boxes, the remaining anchor boxes are marked as positive samples (containing the target), negative samples (not containing the target) or useless samples, and the offset between each anchor box and the marked box in the training image is calculated for subsequent training. The gradient descent algorithm is used to perform back propagation training on the region extraction network RPN, and the loss function is: , (4) , (5) Where: i is the sequence number of the anchor frame; is the probability that the anchor box is a positive sample, is the true label of the anchor box (positive sample is 1, negative sample is 0); is the predicted offset of the anchor box, is the true offset; classification loss Use the logarithmic loss function for binary classification; regression loss Calculated by formula (5), R is the robust loss function (Smooth L1); and are the outputs of the classification layer and regression layer respectively; and Used to standardize output; To balance the weight.
[0033] (3) Classify and regress the candidate regions to distinguish abnormal targets, and preliminarily screen out potential abnormal targets in the image as the input of the next layer of support vector machine (SVM); A fully connected layer followed by a classifier is used to classify each candidate region to determine whether it contains an abnormal target. At the same time, bounding box regression is performed, that is, the bounding box of the candidate region is adjusted to more accurately locate the abnormal target. Finally, redundant candidate regions are removed through methods such as non-maximum suppression (NMS) to retain the final abnormal target detection results. These results are used as the input of the next layer of SVM.
[0034] Classification and bounding box regression of candidate regions include the following steps: The candidate regions are processed through the ROI pooling layer and input into the fully connected layer to classify and locate abnormal targets using the Softmax loss function and the Smooth L1 loss function. Use the Softmax loss function to classify the candidate area to determine whether it contains abnormal targets. The Softmax loss function expression is: , (6) in, represents the original output for the jth category, represents the sum of the original outputs of all categories after exponential operation, and k represents the total number of categories; The Smooth L1 loss function is used to regress the bounding box of the candidate area so that it can be more accurately located on the abnormal target. The Smooth L1 loss function expression is: , (7) in, is the Smooth L1 loss function value, u represents the error between the predicted bounding box and the true bounding box, ∣ u ∣: indicates u The absolute value of the error is not considered, that is, the positive and negative errors are not considered.
[0035] (4) Use the trained support vector machine (SVM) to classify potential abnormal targets into two categories, identify whether there are abnormalities, and mark the detected anomalies in the graph; After initially screening out potential abnormal targets through Faster R-CNN, in order to further improve the accuracy and reliability of detection, this embodiment uses support vector machine (SVM) for fine binary classification. SVM divides samples into different categories by finding an optimal hyperplane in the sample space, maximizing the interval between samples, thereby enhancing the generalization ability of the model. The optimization goal of the support vector machine is to find a hyperplane in the multidimensional sample space that can correctly divide the samples into two categories and maximize the interval between the two categories of samples.
[0036] The equation of the hyperplane is expressed as: , (8) in, Represents the horizontal coordinate of a sample point in the multidimensional sample space; is the normal vector, which determines the direction of the hyperplane; is the displacement term, which determines the distance between the hyperplane and the origin. and The combination can uniquely determine the hyperplane.
[0037] In order to make the classification correct and the interval maximum, the following conditions need to be met: for the sample point ( , ),when =1 ,when Sometimes In order to enhance its generalization ability, the interval between the two categories is enlarged so that the correct classification always or The interval between the two types of support vectors is .
[0038] Find the best hyperplane, that is, under the premise of satisfying the above constraints, find the interval r The largest parameter ω and b , the expression is: , (9) in m is the total number of samples. Equation (9) is a convex quadratic programming problem with inequality constraints. We can use the Lagrange multiplier method to obtain its dual problem and then solve it. By solving the dual problem, we can get the parameter ω and b , thereby determining the optimal classification hyperplane.
[0039] The present invention extracts a multi-dimensional feature map from the input power grid image through the first-level Faster-RCNN target detection algorithm based on the multi-dimensional residual attention mechanism, so that the model can more keenly capture the subtle abnormal changes in the power grid image, and then screen out potential subtle abnormal targets. Subsequently, the second-level SVM is used to conduct a more in-depth analysis and judgment of the potential abnormal targets. In this way, not only can the accuracy of power grid anomaly detection be improved, that is, the false detection and missed detection are reduced, making the detection results more reliable; it can also enhance the generalization ability of detection, that is, the model can maintain a high detection performance when facing new and unknown power grid anomaly scenarios.
[0040] Embodiment 2: This embodiment provides a power grid anomaly detection system based on a multi-dimensional residual attention mechanism, including a deep feature extraction module, a candidate region generation module, a candidate region screening module, and an anomaly detection module; Deep feature extraction module: input power grid image, extract deep features of power grid image through multi-dimensional residual attention mechanism, and generate feature map through convolutional neural network CNN; Candidate region generation module: inputs the feature map into the region extraction network RPN of Faster R-CNN to generate anchor boxes, which are used as candidate regions; Candidate region screening module: classifies candidate regions and performs bounding box regression to preliminarily screen out potential abnormal targets in the image as input for the next layer of support vector machine (SVM); Anomaly detection module: Use the trained support vector machine (SVM) to classify potential abnormal targets into two categories, identify whether there are anomalies, and mark the detected anomalies in the graph.
[0041] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0042] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A power grid anomaly detection method based on a multidimensional residual attention mechanism, characterized by: The detection method comprises the following steps: Input the power grid image, extract the deep features of the power grid image through the multi-dimensional residual attention mechanism, and generate the feature map through the convolutional neural network CNN; The feature map is input into the region extraction network RPN of Faster R-CNN to generate anchor boxes, which are used as candidate regions. Classify and regress the candidate regions, and preliminarily screen out potential abnormal targets in the image as the input of the next layer of support vector machine (SVM); Use the trained support vector machine (SVM) to classify potential abnormal targets into two categories to identify whether there are abnormalities, and mark the detected anomalies in the graph.
2. The power grid anomaly detection method based on multidimensional residual attention mechanism according to claim 1 is characterized in that: The deep features of the power grid image are extracted through the multi-dimensional residual attention mechanism, which includes the following steps: The multidimensional residual attention mechanism consists of four branches. The first branch is the residual branch. The input tensor is x, which is used to retain the original feature information. The dimension of x is , is the channel dimension, , is the spatial dimension; The second branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the C axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the C axis Keep x the same dimensions as the original input; The third branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the W axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the W axis Keep x the same dimensions as the original input; The fourth branch build Dimensions and Interaction between dimensions, the input tensor x is rotated counterclockwise along the H axis , the rotation tensor is expressed as , The dimension is ,Then The output of the Z-pool layer is , then The number of channels becomes ,Then The kernel size is A standard convolutional layer of , and then a batch normalization layer, providing a dimension of The intermediate output of the tensor is then passed through a sigmoid activation layer to generate attention weights , and then pay attention to the weights Application , then rotate clockwise along the H axis Keep x the same dimensions as the original input; The calculation process expression of the Z-pool pooling layer is: , (1) in represents the input tensor, Indicates the maximum pooling operation on the 0th dimension. Indicates that an average pooling operation is performed on the 0th dimension; From the input tensor The process expression of obtaining the refined attention tensor y in the multi-dimensional residual attention mechanism is: , (2) In the formula represents the original input shape, σ represents the sigmoid activation function; in the three branches of the multidimensional residual attention mechanism, , and The kernel size is The standard convolutional layer of ; simplifying formula (2) to obtain: , (3) in , , The three cross-dimensional attention weights calculated in the multi-dimensional residual attention mechanism; , and represents a 90° clockwise rotation to keep the same shape of the original input of (C × H × W).
3. The power grid anomaly detection method based on multidimensional residual attention mechanism according to claim 2 is characterized in that: Generating feature maps through convolutional neural network CNN includes the following steps: The image processed by the multi-dimensional residual attention mechanism is input into the convolutional neural network CNN. CNN gradually extracts the deep features of the image through multi-layer convolution operations and finally generates a feature map. Each pixel or area in the feature map corresponds to an area in the original image and contains the deep feature representation of the area.
4. The power grid anomaly detection method based on multidimensional residual attention mechanism according to claim 3 is characterized by: The feature map is input into the region extraction network RPN of Faster R-CNN to generate an anchor frame, including the following steps: After the feature map passes through the region extraction network RPN, each pixel in the original image corresponds to a 16x16 pixel area; the generation parameters of the anchor frame are: ratios=[0.5, 1, 2], which means generating three anchor frames with different aspect ratios, that is, changing the aspect ratio to 0.5, 1, and 2 respectively; scales=[8, 16, 32], which means magnifying by 8 times, 16 times, and 32 times respectively, that is, the side length becomes 256, 512, and 1024; for each pixel in the feature map, in the 16x16 area corresponding to the original image, 9 anchor frames of different shapes and sizes are generated according to the ratios and scales parameters; After filtering out some anchor boxes, the remaining anchor boxes are marked as positive samples, negative samples or useless samples. Positive samples contain targets, and negative samples do not contain targets. The offset between each anchor box and the marked box in the training image is calculated, and the gradient descent algorithm is used to perform back propagation training on the region extraction network RPN. The loss function is: , (4) , (5) Where: i is the sequence number of the anchor frame; is the probability that the anchor box is a positive sample, is the true label of the anchor box, the positive sample is 1 and the negative sample is 0; is the predicted offset of the anchor box, is the true offset; classification loss Use the logarithmic loss function for binary classification; regression loss From formula (5), R is the robust loss function Smooth L1; and Used to standardize output; To balance the weight.
5. The power grid anomaly detection method based on multidimensional residual attention mechanism according to claim 4 is characterized in that: Classification and bounding box regression of candidate regions include the following steps: The candidate regions are processed through the ROI pooling layer and input into the fully connected layer to classify and locate abnormal targets using the Softmax loss function and the SmoothL1 loss function. Use the Softmax loss function to classify the candidate area to determine whether it contains abnormal targets. The Softmax loss function expression is: , (6) in, represents the original output for the jth category, represents the sum of the original outputs of all categories after exponential operation, and k represents the total number of categories; The Smooth L1 loss function is used to regress the bounding box of the candidate area. The Smooth L1 loss function expression is: , (7) in, is the Smooth L1 loss function value, u represents the error between the predicted bounding box and the true bounding box, ∣ u ∣: indicates u The absolute value of the error is not considered, that is, the positive and negative errors are not considered.
6. The power grid anomaly detection method based on multidimensional residual attention mechanism according to claim 5 is characterized by: Use the trained support vector machine SVM to classify potential abnormal targets into two categories to identify whether there are abnormalities, including the following steps: The optimization goal of the support vector machine (SVM) is to find a hyperplane in the multidimensional sample space to correctly divide the samples into two categories and maximize the interval between the two categories of samples. The equation of the hyperplane is expressed as: , (8) in, Represents the horizontal coordinate of a sample point in the multidimensional sample space; is the normal vector, which determines the direction of the hyperplane; is the displacement term, which determines the distance between the hyperplane and the origin; For the sample points ( , ),when =1 ,when Sometimes ; Increase the interval between the two categories so that the classification is always correct or holds; the interval between the planes where the two types of support vectors are located is ; Find the best hyperplane, that is, find the interval under the premise of satisfying the constraints. r The largest parameter ω and b , the expression is: , (9) in m is the total number of samples. Equation (9) is a convex quadratic programming problem with inequality constraints. The Lagrange multiplier method is used to obtain its dual problem. By solving the dual problem, the parameters are obtained. ω and b , thereby determining the optimal classification hyperplane.
7. A power grid anomaly detection system based on a multidimensional residual attention mechanism, used to implement the detection method according to any one of claims 1 to 6, characterized in that: It includes deep feature extraction module, candidate region generation module, candidate region screening module and anomaly detection module; Deep feature extraction module: input power grid image, extract deep features of power grid image through multi-dimensional residual attention mechanism, and generate feature map through convolutional neural network CNN; Candidate region generation module: inputs the feature map into the region extraction network RPN of Faster R-CNN to generate anchor boxes, which are used as candidate regions; Candidate region screening module: classifies candidate regions and performs bounding box regression to preliminarily screen out potential abnormal targets in the image as input for the next layer of support vector machine (SVM); Anomaly detection module: Use the trained support vector machine (SVM) to classify potential abnormal targets into two categories, identify whether there are anomalies, and mark the detected anomalies in the graph.
Citation Information
Patent Citations
Convolutional neural network-based substation equipment defect detection method
CN114882005A
Disc disk blade surface defect detection method based on improved Faster RCNN algorithm
CN115661072A
Camouflage target detection method based on improved YOLO algorithm
CN112801169A
Aluminum material surface defect detection method, storage medium and computer system
CN114663380A
Fire early warning method based on YOLOv7 network and linear support vector machine SVM
CN117253076A
Cited By
Needle mark detection method and system based on deep learning and image processing
CN119963553A