Substation equipment defect detection method and device
Through the improved Yolov9 model, combining space and channel reconstruction convolution, attention mixing module and depth separation convolution layer, the problem of rapid accuracy of defect detection of substation equipment is solved and detection efficiency and safety is improved.
Patent Information
- Application Number
- CN202510183579.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-07-22
AI Technical Summary
The prior art is difficult to quickly and accurately detect defects and hidden dangers of substation equipment, and manual inspection efficiency is low and harmful to the health of inspectors.
Build an improved Yolov9 model, introduce the RepNCSPELAN4 module, convolution and attention mixing module, reconstruct the convolution layer using space and channels, combine the depth separation convolution layer, and perform slice training for small targets to improve detection accuracy and speed.
It realizes rapid and accurate detection of substation equipment defects, improves detection accuracy and alarm efficiency, and reduces the health risks to patrol personnel.
Smart Images

Figure CN120356054A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent security monitoring, and particularly relates to a method and device for detecting defects in substation electrical equipment. Background Art
[0002] Substation equipment is an important part of the power system. When substation equipment operates, it often fails due to various reasons, leading to power accidents. How to quickly and accurately detect the defects and potential hazards existing in substation equipment is an important means to avoid and reduce power accidents. Traditional detection methods mainly rely on manual detection, but the understanding of the industry by inspection personnel, the accumulation of work experience, and work attitudes, etc. will all affect the inspection work. In addition, the high-voltage and high-radiation environment of the substation will also have an impact on human health. Therefore, the manual inspection method is difficult to meet the protection and monitoring requirements for substation equipment. Therefore, how to quickly and accurately detect the defects and potential hazards existing in substation equipment has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0003] In view of the above problems, the present application provides a method for detecting defects in substation equipment, which is used to quickly and accurately detect the defects and potential hazards existing in substation equipment.
[0004] To achieve the above object, the present application provides a method for detecting defects in substation equipment, including the following steps:
[0005] Collect high-definition image data of substation equipment with defects to be monitored, classify and count according to the defect data categories, and establish a defect data set of substation equipment;
[0006] Construct an improved Yolov9 model, the Yolov9 model includes: RepNCSPELAN4 module, a convolution and attention hybrid module, and depthwise separable convolutional layers with different dilation rates; use spatial and channel reconstruction convolution to improve the RepNCSPELAN4 module to reduce redundant feature information and improve the expressiveness of features; add a convolution and attention hybrid module between the last RepNCSPELAN4 module and the SPPELAN module to enhance the ability to extract local features;
[0007] Use the defect data set to train the Yolov9 model;
[0008] Apply the trained Yolov9 model to the visual defect detection of the appearance of electrical equipment. Among them, the RepNCSPELAN4 module normalizes the input feature F, generates weights from the normalized feature map through the Sigmoid activation function, and forms two weights W1 and W2 according to the threshold T. Multiply the weights with the original image to obtain the weighted feature maps X1 and X2; divide the weighted feature map X1 into two parts X11 and X12, and divide the feature map X2 into two parts X21 and X22. Obtain the new feature maps X1_new and X2_new through addition, X1_new = X11 + X22, X2_new = X12 + X21. Concatenate and reconstruct the X1_new and X2_new to obtain the spatially refined feature F1;
[0009] Pass the spatially refined feature F1 through a channel reconstruction unit to reduce redundancy between features, including: dividing the spatially refined feature F1 into two parts proportionally; performing 1x1 convolution processing on the two divided parts to obtain K1 and K2. Perform feature transformation on the K1 and K2 feature matrices through global convolution and point convolution respectively, then pass through the pooling layer respectively, and finally perform weighted fusion with the Softmax function to obtain the final channel-refined feature F2.
[0010] To solve the above technical problems, the present application also provides another technical solution:
[0011] A substation equipment defect detection device, including:
[0012] A sample construction module for multi-dimensionally collecting samples of the scene where there are defects in substation equipment using a high-definition camera, and constructing a substation equipment defect sample library;
[0013] A network construction module for constructing an improved Yolov9 model. The Yolov9 model includes: a RepNCSPELAN4 module, a convolution and attention hybrid module, and depthwise separable convolutional layers with different dilation rates; use spatial and channel reconstruction convolutions to improve the RepNCSPELAN4 module to reduce redundant feature information and improve the expressiveness of features; add a convolution and attention hybrid module between the last RepNCSPELAN4 module and the SPPELAN module to enhance the ability to extract local features;
[0014] A network training module for training the Yolov9 model using the defect data set;
[0015] The timing monitoring module is used to apply the trained Yolov9 model to the visual defect detection of the appearance of power equipment. Among them, the RepNCSPELAN4 module normalizes the input feature F, generates weights from the normalized feature map through the Sigmoid activation function, and forms two weights W1 and W2 according to the threshold T. Multiply the weights with the original image to obtain the weighted feature maps X1 and X2; divide the weighted feature map X1 into two parts X11 and X12, and divide the feature map X2 into two parts X21 and X22. Obtain the new feature maps X1_new and X2_new through addition, X1_new = X11 + X22, X2_new = X12 + X21, and splice and reconstruct the X1_new and X2_new to obtain the spatially refined feature F1;
[0016] Pass the spatially refined feature F1 through a channel reconstruction unit to reduce redundancy between features, including: dividing the spatially refined feature F1 into two parts proportionally; performing 1x1 convolution processing on the two divided parts to obtain K1 and K2, and passing the K1 and K2 feature matrices through global convolution and point convolution for feature transformation respectively, then passing through the pooling layer respectively, and finally weighted fusion with the Softmax function to obtain the final channel-refined feature F2.
[0017] Different from the prior art, this technical solution aims at the situation where the target area of substation equipment defects is small and the features are not prominent in high-definition images. It optimizes the yolov9 model. First, a spatial and channel reconstruction convolution module is introduced in RepNCSPELAN4 to remove feature redundancy and improve the feature expression of the module; at the same time, a convolution and attention hybrid structure is introduced into the network, which combines convolution operations and self-attention mechanisms to enhance the representation learning ability. This module adopts a concurrent structure to retain local features and global representations to the greatest extent. Finally, a depthwise separable convolution layer with different dilation rates is added before feature prediction, and the feature representation is enhanced through channel segmentation and recombination; during the model training process, aiming at the problem that the proportion of the detected target object in the whole high-definition photo is very small, the original image is divided into multiple modules for training and prediction using slicing, and finally converted back to the original coordinate scale, effectively improving the detection effect of small target samples, and the block processing improves the detection speed; the improved model and solution of this patent optimize the detection accuracy and actual alarm efficiency.
[0018] The above description of the invention content is only an overview of the technical solution of this application. In order to enable those of ordinary skill in the art to understand the technical solution of this application more clearly, and then to implement it according to the content recorded in the description and the drawings, and in order to make the above objects, other objects, features and advantages of this application more easily understood, the following is combined with the specific implementation manners and drawings of this application for description. Brief Description of the Drawings
[0019] The accompanying drawings are only used to illustrate the principles, implementation methods, applications, features, effects, etc. of the specific embodiments of the present invention and other related contents, and should not be considered as a limitation to this application.
[0020] In the accompanying drawings of the specification:
[0021] Figure 1 is a flowchart of a substation equipment defect detection method for the method of the present invention;
[0022] Figure 2 is a block diagram of modules of a substation equipment defect detection device for the method of the present invention;
[0023] Figure 3 is a schematic diagram of the model structure of yolov9;
[0024] Figure 4 is a flowchart of an improved RepNCSPELAN4 module;
[0025] Figure 5 is a schematic diagram of a convolution and attention hybrid module;
[0026] Figure 6 is a schematic diagram of a depthwise separable convolutional layer;
[0027] The descriptions of the reference numerals involved in the above-mentioned accompanying drawings are as follows:
[0028] 200, substation equipment defect detection device; 201, sample construction module; 202, network construction module; 203, network training module; 204, timing monitoring module; 205, alarm module. Specific Embodiments
[0029] To describe in detail the possible application scenarios, technical principles, specific implementable solutions, achievable purposes and effects, etc. of this application, the following will be described in detail in conjunction with the specific examples listed and with reference to the accompanying drawings. The embodiments described herein are only used to more clearly illustrate the technical solutions of this application, so they are only used as examples and cannot be used to limit the protection scope of this application.
[0030] Referring to "embodiments" in this context means that the specific features, structures or characteristics described in connection with the embodiments can be included in at least one embodiment of this application. The term "embodiment" that appears in various positions in the specification does not necessarily refer to the same embodiment, nor is it particularly limited to the independence or relevance between other embodiments. In principle, in this application, as long as there is no technical contradiction or conflict, the technical features mentioned in each embodiment can be combined in any way to form the corresponding implementable technical solutions.
[0031] Unless otherwise defined, the meanings of technical terms used herein are the same as those commonly understood by those skilled in the technical field to which this application belongs; the use of relevant terms herein is only for describing specific embodiments and is not intended to limit this application.
[0032] In the description of this application, the term "and / or" is an expression used to describe the logical relationship between objects, indicating that three relationships can exist. For example, A and / or B means: there is A, there is B, and there is both A and B at the same time. In addition, the character " / " herein generally represents an "or" logical relationship between the associated objects before and after.
[0033] In this application, terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual quantity, primary-secondary or order relationship, etc. between these entities or operations.
[0034] Without more limitations, in this application, the open expressions such as "comprising", "including", "having" or other similar ones used in the statement are intended to cover non-exclusive inclusion. These expressions do not exclude that there may be additional elements in the process, method or product including the said elements, so that the process, method or product including a series of elements may not only include those defined elements, but also include other elements not explicitly listed, or also include elements inherent to this process, method or product.
[0035] The same as the understanding in the "Examination Guidelines", in this application, expressions such as "greater than", "less than", "exceeding" are understood not to include the number itself; expressions such as "above", "below", "within" are understood to include the number itself. In addition, in the description of the embodiments of this application, the meaning of "a plurality of" is two or more (including two), and similar expressions related to "many" are also understood in this way, such as "multiple groups", "multiple times", etc., unless otherwise specifically defined.
[0036] In the description of the embodiments of this application, the spatially related expressions used, such as "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "perpendicular", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., the indicated orientation or positional relationship is based on the orientation or positional relationship shown in the specific embodiment or the drawings, and is only for the convenience of describing the specific embodiments of this application or for the convenience of the reader to understand, rather than indicating or implying that the device or component referred to must have a specific position, a specific orientation, or be constructed or operated in a specific orientation, so it cannot be understood as a limitation to the embodiments of this application.
[0037] Unless otherwise clearly specified or defined, in the description of the embodiments of this application, terms such as "installation", "connection", "linkage", "fixation", "setting" shall be understood in a broad sense. For example, the "connection" may be a fixed connection, a detachable connection, or an integral setting; it may be a mechanical connection, an electrical connection, or a communication connection; it may be a direct connection or an indirect connection through an intermediate medium; it may be the communication inside two components or the interaction relationship between two components. For those skilled in the art to which this application pertains, the specific meanings of the above terms in the embodiments of this application can be understood according to specific circumstances.
[0038] Please refer to Figure 1 , this embodiment provides a substation equipment defect detection method. This substation equipment defect detection method is applied to the real-time monitoring and detection of substation equipment through artificial intelligence technology to timely discover problems and defects existing in substation equipment, so as to process them in a timely manner. This embodiment conducts relevant research and improvement on the neural network algorithm based on actual project requirements and applies it to substation equipment defect detection.
[0039] As Figure 1 shown, the substation equipment defect detection method includes the following steps:
[0040] S101. Collect high-definition image data of substation equipment with defects to be monitored, classify and count according to the defect data categories, and establish a defect data set of substation equipment;
[0041] S102. Construct an improved Yolov9 model, and the Yolov9 model includes: a RepNCSPELAN4 module, a convolution and attention hybrid module, and depthwise separable convolutional layers with different dilation rates; use spatial and channel reconstruction convolution to improve the RepNCSPELAN4 module to reduce feature redundant information and improve the expressiveness of features; add a convolution and attention hybrid module between the last RepNCSPELAN4 module and the SPPELAN module to enhance the ability to extract local features;
[0042] S103. Use the defect data set to train the Yolov9 model;
[0043] S104. Use the trained Yolov9 model for visual defect detection of the appearance of power equipment. Among them, the RepNCSPELAN4 module normalizes the input feature F, generates weights from the normalized feature map through the Sigmoid activation function, and forms two weights W1 and W2 according to the threshold T. Multiply the weights with the original image to obtain the weighted feature maps X1 and X2; divide the weighted feature map X1 into two parts X11 and X12, and divide the feature map X2 into two parts X21 and X22. Obtain new feature maps X1_new and X2_new through addition, where X1_new = X11 + X22, X2_new = X12 + X21, and splice and reconstruct the X1_new and X2_new to obtain the spatially refined feature F1;
[0044] Pass the spatially refined feature F1 through a channel reconstruction unit to reduce redundancy between features, including: dividing the spatially refined feature F1 into two parts proportionally; performing 1x1 convolution processing on the two divided parts to obtain K1 and K2, and passing the K1 and K2 feature matrices through global convolution and point convolution for feature transformation respectively, then passing through pooling layers respectively, and finally weighted fusion with the Softmax function to obtain the final channel-refined feature F2.
[0045] In this embodiment, the RepNCSPELAN4 module is improved using spatial and channel reconstruction convolutions to reduce redundant feature information and improve the expressiveness of features; a convolution and attention hybrid module is introduced into the model to enhance the detection effect of small targets; finally, depthwise separable convolution layers with different dilation rates are introduced before feature prediction to enhance feature representation; and aiming at the poor detection effect of small objects in high-resolution images, slicing assistance is used for fine-tuning training, and the original image is segmented into multiple overlapping slices to enhance the dataset and improve the model's detection ability for small target defect types.
[0046] The model structure of the Yolov9 model is as Figure 3 shown. The RepNCSPELAN4 module is a feature extraction - fusion module in the Yolov9 model. As Figure 4 shown, the RepNCSPELAN4 module is mainly composed of Conv and ReoNCSP. ReoNCSP is composed of Conv and an unequal number of RepNBottlenecK modules. The number of RepNBottlenecK is determined by the width factor of the model. RepNBottlenecK is a basic module with a residual structure.
[0047] SPPELAN is a module in the Yolov9 model, which is used to generate predictions of the location and size of the target. In the SPPELAN module, first, pooling layers with different scales are used to pool the feature map, then the outputs of these pooling results are concatenated, and finally, the location and size are predicted through a fully connected layer. In this embodiment, a convolution and attention hybrid module is added between the RepNCSPELAN4 module and the SPPELAN module, which can enhance the ability to extract local features, specifically as Figure 5 shown.
[0048] In this embodiment, the RepNCSPELAN4 module is improved by using spatial and channel reconstruction convolution to reduce the spatial and channel redundancy between features, thereby compressing the network model and improving performance. In step S104, after the RepConvN convolution output, the feature F is input into the spatial reconstruction unit SRU; first, the input feature F is normalized to reduce the scale difference between different feature maps, and through the Sigmoid activation function, weights are generated from the normalized feature map, and two parts of weights W1 and W2 are formed according to the threshold T. The weights are multiplied by the original image to obtain the weighted feature maps X1 and X2; the weighted feature maps are respectively divided into two parts, X1 is divided into X11 and X12, and X2 is divided into X21 and X22. Finally, two new feature maps are obtained through addition, X1_new = X11 + X22, X2_new = X12 + X21. The two parts of X1_new and X2_new are concatenated and reconstructed to obtain the spatially refined feature F1; the spatially refined feature F1 passes through the channel reconstruction unit CRU, which can reduce the redundancy between features and make the extracted features more expressive; first, the input feature F1 is divided into two parts, with a ratio of α to 1 - α; the two parts are processed by 1x1 convolution to obtain K1 and K2. The feature matrices K1 and K2 are respectively subjected to feature transformation through global convolution (GWC) and point convolution (PWC), then passed through the pooling layer respectively, and finally weighted and fused by the Softmax function to obtain the final channel-refined feature F2.
[0049] And in this embodiment, before finally generating the classification prediction and the bounding box coordinate regression prediction, multiple depthwise separable convolution layers DSC-layer with different dilation rates are introduced to capture spatial features of a series of receptive field sizes, model the differences between objects and backgrounds in more detail, and enhance its ability to distinguish small objects. The specific process is as Figure 6 shown.
[0050] Introducing the convolution and attention hybrid module ACmix includes the following
[0051] The convolutional and attention hybrid structure ACmix combines convolutional operations and self-attention mechanisms to enhance representation learning capabilities. This module adopts a concurrent structure to maximize the retention of local features and global representations. Among them, the concurrent structure refers to the simultaneous parallel transformation processing of two parts, followed by fusion.
[0052] In the convolutional path, the input feature data is linearly projected using three 1x1 convolutions to obtain a set of rich intermediate features containing 3×N feature maps. The projected feature maps are shifted according to the positions of the convolutional kernels and finally aggregated together. The convolutional formula and displacement formula are as follows:
[0053]
[0054] Where K p,q represents the convolutional kernel, f i,j represents the feature input, Shift represents the feature displacement operation, and K represents the convolutional kernel size;
[0055] In the self-attention path, the intermediate features are grouped into N groups, each group containing three features, and each feature comes from a 1×1 convolution. The corresponding three feature maps are used as query, Key, and value respectively, following the traditional multi-head self-attention module. For the convolutional path with kernel K, a lightweight fully connected layer is used to generate feature maps. Therefore, by shifting and aggregating the generated features, the input features are convolved and information is collected from the local receptive field as in the traditional way. The output of the self-attention module is calculated as:
[0056]
[0057] Where f i,j , O i,j represent the corresponding tensors of the input and output feature pixels (i, j). Among them, || is the concatenation of the outputs of N attention heads (assuming the self-attention module has N heads), and are the projection matrices of the query, key, and value respectively, N k (i, j) represents the pixel (i, j) in the local area with K as the spatial range, is the corresponding attention weight regarding the features within N k (i, j). Softmax is the activation function, where d is the feature size of.
[0058] Finally, the outputs of the two paths are added together, and the intensity is controlled by two learnable scalars:
[0059] F out = αF att + βF conv ;
[0060] Furthermore, the depthwise separable convolutional layer DSC-layer introducing different expansion rates includes:
[0061] Assume the input matrix F ∈ R H×W×C , the input matrix is divided into four parts along the channel dimension to generate
[0062] Each part of the data is separately subjected to depthwise separable dilated convolution with different dilation rates to produce
[0063] The features of the obtained four parts are separately subjected to feature separation, and finally Then the channels are recombined to obtain Thereby enhancing the diversity of multi-scale features and strengthening the feature representation;
[0064] Use pointwise convolution to fuse information of different groups to obtain the final output F out ∈ R H×W×C , thereby achieving lightweight and efficient aggregation effect.
[0065]
[0066] F out = ReLU(BN(W2[h1, h2, h3…h j ));
[0067] Where W1 and W2 are the weight matrices used in pointwise convolution. Here, ReLU represents the ReLU activation function, and BN represents the batch normalization operation;
[0068] Furthermore, the use of slicing assistance for fine-tuning training includes the following steps:
[0069] Collect high-definition image data of substation equipment with defects to be monitored, classify according to the defect data category, establish a defect danger level, and divide the defect category;
[0070] Select a part from the constructed sample dataset as the training sample and perform fine-tuning. Among them, the pictures are cut into smaller overlapping segments or patches, and then these segments are resized to a larger unified size;
[0071] Perform data augmentation on the picture slice data, and then the augmented picture segments are used to fine-tune the pre-trained model to generate a fine-tuned model;
[0072] The original query image is cut into multiple overlapping small segments. After each small segment is resized, object detection inference is performed separately to generate prediction results;
[0073] The prediction results of all small segments are screened through non-maximum suppression (NMS) and converted back to the coordinate scale of the original image.
[0074] As Figure 2 shown, in another embodiment, a substation equipment defect detection device 200 is provided. The substation equipment defect detection device 200 includes: a sample construction module 201, a network construction module 202, a network training module 203, a timing monitoring module 204, and an alarm module 205.
[0075] The sample construction module 201 is used to collect multi-dimensional samples of the scene where the substation equipment has defects using a high-definition camera, and construct a substation equipment defect sample library;
[0076] The network construction module 202 is used to construct an improved Yolov9 model. The Yolov9 model includes: a RepNCSPELAN4 module, a convolution and attention hybrid module, and depthwise separable convolutional layers with different dilation rates; the RepNCSPELAN4 module is improved using spatial and channel reconstruction convolution to reduce feature redundant information and improve the expressiveness of features; a convolution and attention hybrid module is added between the last RepNCSPELAN4 module and the SPPELAN module to enhance the ability to extract local features;
[0077] The network training module 203 is used to train the Yolov9 model using the defect data set;
[0078] The timing monitoring module 204 is used to use the trained Yolov9 model for visual defect detection of the appearance of power equipment. Among them, the RepNCSPELAN4 module normalizes the input feature F, generates weights from the normalized feature map through the Sigmoid activation function, and forms two weights W1 and W2 according to the threshold T. Multiply the weights with the original image to obtain the weighted feature maps X1 and X2; divide the weighted feature map X1 into two parts X11 and X12, and divide the feature map X2 into two parts X21 and X22. Obtain new feature maps X1_new and X2_new through addition, X1_new = X11 + X22, X2_new = X12 + X21. Concatenate and reconstruct the X1_new and X2_new to obtain the spatially refined feature F1;
[0079] Pass the spatial refinement feature F1 through the channel reconstruction unit to reduce redundancy between features, including: dividing the spatial refinement feature F1 into two parts proportionally; performing 1x1 convolution on the two divided parts to obtain K1 and K2, respectively performing feature transformation on the K1 and K2 feature matrices through global convolution and point convolution, then passing through a pooling layer respectively, and finally weighted fusion with the Softmax function to obtain the final channel refined feature F2.
[0080] The alarm module 205 is used to generate an alarm message when a device defect is detected in the monitored area, where the alarm message includes the defect detection result and the defect danger level.
[0081] In the above embodiment, the convolution and attention hybrid module includes a convolution operation and a self-attention mechanism in a concurrent structure;
[0082] When the Yolov9 model performs visual defect detection on the appearance of power equipment, in the convolution path of the convolution and attention hybrid module, the input feature data is linearly projected with 3 1x1 convolutions to obtain a set of intermediate features containing 3×N feature maps; the feature maps of the linear projection are shifted according to the position of the convolution kernel and finally aggregated together; the convolution formula and displacement formula are as follows:
[0083]
[0084] Among them, K p,q represents the convolution kernel, f i,j represents the feature input, Shift represents the feature displacement operation, and K represents the convolution kernel size;
[0085] In the self-attention path of the convolution and attention hybrid module, the set of intermediate features is grouped into multiple groups, each group contains 3 features, and each feature comes from a 1×1 convolution; the three feature maps corresponding to the 3 features in each group are used as query, Key, and value respectively; for the convolution path with a kernel of K, a lightweight fully connected layer is used to generate feature maps; therefore, by shifting and aggregating the generated features, the input features are convolved and information is collected from the local receptive field for use; the output calculation of the self-attention mechanism is:
[0086]
[0087]
[0088] Among them, f i,j , O i,j represent the corresponding tensors of the input and output feature pixels (i, j); "||" is the concatenation of the outputs of multiple attention heads, and They are the projection matrices of query, key, and value, respectively, N k (i, j) represents the pixel (i, j) of the local area with K as the spatial range, is about N k the corresponding attention weight of the feature within (i, j); Softmax is the activation function, where d is the feature size of
[0089] Finally, the outputs of the convolutional path and the self-attention path are added together.
[0090] When the Yolov9 model performs visual defect detection on the appearance of power equipment, the depthwise separable convolutional layer divides the input matrix F ∈ R H×W×C along the channel dimension into four parts, generating
[0091] Performs separate depthwise separable dilated convolutions on each generated part of the data with different dilation rates, generating four features
[0092] Performs feature separation on the four obtained features respectively, and finally obtains Then recombines the channels to obtain a group to enhance the diversity of multi-scale features and strengthen the feature representation;
[0093] Uses pointwise convolution for information fusion of different said groups to obtain the final output F out ∈R H×W×C ; where:
[0094]
[0095] F out = ReLU(BN(W2[h1, h2, h3…h j ));
[0096] W1 and W2 are the weight matrices used in pointwise convolution, ReLU represents the Relu activation function, and BN represents the batch normalization operation.
[0097] When training the Yolov9 model using the said defect dataset, for small objects in the defect dataset, the original images of the defect dataset are segmented into multiple overlapping slices for training to improve the model's detection ability for small target defect types.
[0098] In view of the situation that the target area of substation equipment defects is small and the features are not prominent in high-definition images, this solution optimizes the yolov9 detection model. First, a spatial and channel reconstruction convolutional module is introduced in RepNCSPELAN4 to remove feature redundancy and improve the feature expression effect. At the same time, a convolutional and attention hybrid structure is introduced into the network, combining convolutional operations and self-attention mechanisms to enhance the representation learning ability. This module adopts a concurrent structure to retain local features and global representations to the greatest extent. Finally, a depthwise separable convolutional layer with different dilation rates is added before feature prediction to enhance feature representation through channel segmentation and recombination. During the model training process, in view of the problem that the proportion of the detected target object in the whole photo is very small, the original image is sliced into multiple modules for training and prediction, and then converted back to the original coordinate scale, effectively improving the detection effect of small target samples and enhancing the detection speed through block processing. The improved model and solution optimize the detection accuracy and actual alarm efficiency.
[0099] Finally, it should be noted that although the above embodiments have been described in the text and drawings of the specification of this application, the patent protection scope of this application cannot be limited thereby. Any technical solutions obtained by equivalent structure or equivalent process substitution or modification based on the essential concept of this application and using the content recorded in the text and drawings of the specification of this application, as well as any technical solutions directly or indirectly implementing the above embodiments in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A substation equipment defect detection method, characterized in that, It includes the following steps: Collect high-definition image data of substation equipment with defects to be monitored, classify and count according to the defect data categories, and establish a defect data set of substation equipment; Construct an improved Yolov9 model, where the Yolov9 model includes: RepNCSPELAN4 module, a convolution and attention hybrid module, and depthwise separable convolutional layers with different dilation rates; use spatial and channel reconstruction convolution to improve the RepNCSPELAN4 module to reduce redundant feature information and improve the expressiveness of features; add a convolution and attention hybrid module between the last RepNCSPELAN4 module and the SPPELAN module to enhance the ability to extract local features; Use the defect data set to train the Yolov9 model; Use the trained Yolov9 model for visual defect detection of the appearance of power equipment. Among them, the RepNCSPELAN4 module normalizes the input feature F, generates weights from the normalized feature map through the Sigmoid activation function, and forms two weights W1 and W2 according to the threshold T. Multiply the weights by the original image to obtain the weighted feature maps X1 and X2; divide the weighted feature map X1 into two parts X11 and X12, and divide the feature map X2 into two parts X21 and X22. Obtain new feature maps X1_new and X2_new through addition, X1_new = X11 + X22, X2_new = X12 + X21. Concatenate and reconstruct the X1_new and X2_new to obtain the spatially refined feature F1; Pass the spatially refined feature F1 through a channel reconstruction unit to reduce redundancy between features, including: proportionally divide the spatially refined feature F1 into two parts; perform 1x1 convolution processing on the two divided parts to obtain K1 and K2, perform feature transformation on the K1 and K2 feature matrices through global convolution and point convolution respectively, then pass through the pooling layer respectively, and finally use the Softmax function for weighted fusion to obtain the final channel-refined feature F2.
2. The substation equipment defect detection method according to claim 1, wherein The convolution and attention hybrid module includes a concurrent structure of convolution operations and a self-attention mechanism; When the Yolov9 model performs visual defect detection on the appearance of power equipment, in the convolution path of the convolution and attention hybrid module, linearly project the input feature data with 3 1x1 convolutions to obtain a set of intermediate features containing 3×N feature maps; shift the linearly projected feature map according to the position of the convolution kernel, and finally aggregate them together. The convolution formula and displacement formula are as follows: Among them, K p,q represents the convolution kernel, f i,j represents the feature input, Shift represents the feature displacement operation, and K represents the convolution kernel size; In the self-attention path of the convolution and attention hybrid module, the intermediate features are grouped into multiple groups, with each group containing 3 features, and each feature comes from a 1×1 convolution; the three feature maps corresponding to the 3 features in each group are used as query, Key, and value respectively; for the convolution path with a kernel of K, a lightweight fully connected layer is used to generate feature maps; therefore, by shifting and aggregating the generated features, the input features are convolved and information is collected from the local receptive field for use; the output of the self-attention mechanism is calculated as: where f i,j , O i,j represents the corresponding tensors of the input and output feature pixels (i, j); "||" is the concatenation of the outputs of multiple attention heads, and are the projection matrices of the query, key, and value respectively, N k (i, j) represents the pixel (i, j) of the local region with a spatial range of K, is the corresponding attention weight for the features within N k (i, j); Softmax is the activation function, where d is the feature size; Finally, the outputs of the convolution path and the self-attention path are added together.
3. The substation equipment defect detection method according to claim 1, wherein When the Yolov9 model performs visual defect detection on the appearance of power equipment, the depthwise separable convolutional layer divides the input matrix F ∈ R H×W×C into four parts along the channel dimension, generating Perform depthwise separable dilated convolutions on each generated part of the data at different dilation rates to produce four features The four obtained features are respectively subjected to feature separation, and finally Then the channels are recombined to obtain groups to enhance the diversity of multi-scale features and strengthen the feature representation; Use pointwise convolution to fuse information of different said groups to obtain the final output F out ∈R H×W×C ; where: F out = ReLU(BN(W2[h1, h2, h3…h j )); W1 and W2 are weight matrices used in pointwise convolution, ReLU represents the Relu activation function, and BN represents the batch normalization operation.
4. The substation equipment defect detection method according to claim 1, wherein When training the Yolov9 model using the defect dataset, for small objects in the defect dataset, the original images in the defect dataset are segmented into multiple overlapping slices for training to improve the model's detection ability for small target defect types.
5. The substation equipment defect detection method according to claim 4, characterized in that, Regarding small objects in the defect dataset, segmenting the original images in the defect dataset into multiple overlapping slices for training includes: Selecting a part from the defect dataset as training samples and performing fine-tuning, cutting the selected pictures into smaller overlapping segments, and magnifying these segments to a unified size; Performing data augmentation on the segments, and then using the augmented segments to fine-tune the pre-trained Yolov9 model; The original query image is cut into multiple overlapping segments; after the size of each segment is adjusted, object detection inference is performed separately, and prediction results are generated; The prediction results of all segments are screened through non-maximum suppression and converted back to the coordinate scale of the original image.
6. A substation equipment defect detection device, characterized in that, Including: A sample construction module for using a high-definition camera to collect multi-dimensional samples of the scenarios where there are defects in substation equipment and constructing a substation equipment defect sample library; A network construction module for constructing an improved Yolov9 model, where the Yolov9 model includes: a RepNCSPELAN4 module, a convolution and attention hybrid module, and depthwise separable convolutional layers with different dilation rates; using spatial and channel reconstruction convolution to improve the RepNCSPELAN4 module to reduce feature redundant information and improve the expressiveness of features; adding a convolution and attention hybrid module between the last RepNCSPELAN4 module and the SPPELAN module to enhance the ability to extract local features; A network training module for training the Yolov9 model using the defect dataset; The timing monitoring module is used to apply the trained Yolov9 model to the visual defect detection of the appearance of power equipment. Among them, the RepNCSPELAN4 module normalizes the input feature F, generates weights from the normalized feature map through the Sigmoid activation function, and forms two weights W1 and W2 according to the threshold T. Multiply the weights with the original image to obtain the weighted feature maps X1 and X2; divide the weighted feature map X1 into two parts X11 and X12, and divide the feature map X2 into two parts X21 and X22. Obtain the new feature maps X1_new and X2_new through addition, X1_new = X11 + X22, X2_new = X12 + X21, and splice and reconstruct the X1_new and X2_new to obtain the spatially refined feature F1; Pass the spatially refined feature F1 through a channel reconstruction unit to reduce redundancy between features, including: dividing the spatially refined feature F1 into two parts proportionally; performing 1x1 convolution processing on the two divided parts to obtain K1 and K2, respectively perform feature transformation on the K1 and K2 feature matrices through global convolution and point convolution, then pass through the pooling layer respectively, and finally weighted fusion with the Softmax function to obtain the final channel-refined feature F2.
7. The substation equipment defect detection device according to claim 6, wherein It also includes an alarm module, which is used to generate alarm information when a device defect is detected in the monitoring area. Among them, the alarm information includes the defect detection result and the defect danger level.
8. The substation equipment defect detection device according to claim 6, characterized in that, The convolution and attention hybrid module includes a convolution operation and a self-attention mechanism with a concurrent structure; When the Yolov9 model performs visual defect detection on the appearance of power equipment, in the convolution path of the convolution and attention hybrid module, linearly project the input feature data with 3 1x1 convolutions to obtain a set of intermediate features containing 3×N feature maps; shift the linearly projected feature map according to the position of the convolution kernel, and finally aggregate them together; the convolution formula and displacement formula are as follows: Among them, K p,q represents the convolutional kernel, f i,j represents the feature input, Shift represents the feature displacement operation, and K represents the convolutional kernel size; In the self-attention path of the convolution and attention hybrid module, group the intermediate features into multiple groups, each group contains 3 features, and each feature comes from a 1x1 convolution; the three feature maps corresponding to the 3 features in each group are used as query, Key, and value respectively; for the convolution path with a kernel of K, use a lightweight fully connected layer to generate feature maps; therefore, by shifting and aggregating the generated features, perform convolution processing on the input features, and collect information from the local receptive field for use; the output calculation of the self-attention mechanism is: where, f i,j , O i,j represents the corresponding tensors of the input and output feature pixels (i, j); "||" is the concatenation of the outputs of multiple attention heads, and are the projection matrices of the query, key, and value respectively, N k (i, j) represents the pixel (i, j) of the local region with a spatial range of K, is the corresponding attention weight for the features within N k (i, j); Softmax is the activation function, where d is the feature size; Finally, add the outputs of the convolution path and the self-attention path.
9. The substation equipment defect detection device according to claim 6, wherein When the Yolov9 model performs visual defect detection on the appearance of power equipment, the depthwise separable convolutional layer divides the input matrix F∈R H×W×C into four parts along the channel dimension, generating Perform separate depthwise separable dilated convolutions on each generated part of the data at different dilation rates to produce four features The four obtained features are respectively subjected to feature separation, and finally Then the channels are recombined to obtain groups to enhance the diversity of multi-scale features and strengthen the feature representation; Use pointwise convolution to fuse information of different said groups to obtain the final output F out ∈R H×W×C ; where: F out = ReLU(BN(W2[h1, h2, h3…h j )); W1 and W2 are weight matrices used in pointwise convolution, ReLU represents the Relu activation function, and BN represents the batch normalization operation.
10. The substation equipment defect detection device according to claim 6, characterized in that, When training the Yolov9 model with the defect dataset, for small objects in the defect dataset, the original images of the defect dataset are segmented into multiple overlapping slices for training to improve the model's detection ability for small target defect types.
Citation Information
Cited By
Welding quality detection method and device based on machine vision
CN120908185A
