Insulator defect detection method based on improved YOLOV7 power transmission system

Through the optimization of the YOLOV7 algorithm, including data set enhancement and introduction of visual context networks and multi-scale attention mechanisms, the complexity and accuracy of insulator defect detection in power transmission systems are solved, and efficient and accurate insulator defect detection is achieved, improving the improvement of efficient and accurate insulator defect detection. The safety and operation efficiency of the power system.

CN119295834APending Publication Date: 2025-01-10EAST CHINA JIAOTONG UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411554557.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing insulator defect detection methods rely on manual detection, which is time-consuming and labor-intensive and has a high error rate. Traditional automation methods are difficult to cope with complex environments and variable conditions. The application of YOLOV7 in power transmission systems has challenges in detection accuracy and efficiency.

Method used

By performing multi-faceted optimization of the YOLOV7 algorithm, including data set collection and enhancement, introduction of visual context networks and multi-scale attention mechanisms, an efficient insulator defect detection model is built to improve the model's feature extraction and positioning accuracy.

Benefits of technology

It realizes efficient and accurate detection of power insulator defects, improves detection efficiency and system safety, reduces labor costs, and improves the reliability and operating efficiency of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295834A_ABST
    Figure CN119295834A_ABST
Patent Text Reader

Abstract

The invention discloses an insulator defect detection method based on an improved YOLOV7 power transmission system, and the method comprises the following steps: (1) collecting a plurality of high-resolution insulator images of three different defect types, and taking the high-resolution insulator images as original materials for model training; (2) performing data enhancement on an original data set material by randomly combining four geometric data enhancement technologies of image zooming and distortion, image filling, image overturning and color gamut transformation; (3) introducing a visual context network into a high-level feature extraction layer of the trunk feature extraction network; and (4) introducing an EMA attention mechanism into two output channels P4 and P5 of the trunk feature extraction network. Through a series of optimization and improvement, the method has remarkable beneficial effects in the aspects of detection precision, model robustness, detection efficiency, power system safety and the like, and has important practical application value and popularization significance for guaranteeing railway electrification facilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision target detection, and in particular to a method for detecting insulator defects in a power transmission system based on an improved YOLOV7. Background Art

[0002] As an important component of the power transmission system, insulators have two key tasks: one is to eliminate the mechanical stress between the high-voltage power conductors and the installation equipment; the other is to isolate the cables from the mechanical support members to prevent dielectric loss. Insulators are usually installed outdoors and exposed to various severe weather and complex environments, which causes dirt to accumulate on the surface of the insulators and makes them susceptible to damage such as corrosion, breakdown and cracking. These damages reduce the insulation performance of the insulators to a certain extent, which may eventually lead to accidents and failures in the power system, thereby adversely affecting the reliability and operating efficiency of the power system. Therefore, accurate and efficient detection of insulator defects has become a necessary measure to ensure the safe operation of the power transmission system.

[0003] Traditional insulator defect detection methods rely too much on professional technicians for detection, which is time-consuming and laborious, and has a high rate of false detection. In addition, high-voltage power transmission systems are usually built in sparsely populated suburbs and jungles, covering a wide area. Faced with such a complex working environment and huge workload, it is difficult to meet the detection needs by relying solely on manual inspection. Therefore, it is of great significance to develop an automated detection solution for insulator defect detection, which can improve detection efficiency, reduce labor costs and enhance the safety of the power system.

[0004] Among the existing automated detection methods, technologies based on image processing and machine learning are gradually being applied to insulator defect detection. However, traditional image processing methods usually require a lot of prior knowledge and complex preprocessing processes, and are difficult to cope with the changing conditions in the actual environment. With the development of deep learning technology, especially the widespread application of convolutional neural networks (CNN), target detection technology has made significant progress. As an efficient target detection method, the YOLO (You Only Look Once) series of algorithms have been widely used in the field of industrial detection due to their real-time and high-precision characteristics.

[0005] As the latest version of the YOLO series, YOLOV7 has been optimized in many aspects in terms of network structure and detection accuracy, and has stronger feature extraction capabilities and higher detection accuracy. However, there are still some challenges when YOLOV7 is applied to insulator defect detection in power transmission systems. For example, the appearance of insulators is complex, the defect types are diverse, and there are many background interferences in the detection environment. These problems need to be further improved on the basis of YOLOV7 to meet actual detection needs. Summary of the invention

[0006] The present invention aims to solve the problems existing in the prior art and provide a method for detecting insulator defects in a power transmission system based on an improved YOLOV7 algorithm. By optimizing and improving the YOLOV7 algorithm in many aspects, efficient and accurate detection of power insulator defects is achieved. The specific steps are as follows:

[0007] (1) Data collection: Collect multiple high-resolution images of insulators, which include three different defect types: flashover damaged insulator shell, broken insulator shell and good insulator shell, as the basic data for model training. The specific data comes from the "Insulator Defect Detection" project of the IEEE DataPort-Competition. These images include ceramic insulator images taken in various colors, different positions and background conditions. The dataset is divided into training set, validation set and test set in a ratio of 7:1:2, containing 1120, 160 and 320 images respectively, and annotated using Labelimg image annotation software. The annotated data is stored in an XML file in PASCAL VOC format.

[0008] (2) Data augmentation: Randomly combine and use four geometric data augmentation techniques, namely image scaling and distortion, image padding, image flipping, and color gamut transformation, to perform data augmentation on the original dataset material to increase the diversity of the dataset and the robustness of the model.

[0009] (3) Introduction of Visual Context Network (CoTNet): The visual context network, namely Contextual Transformer Networks (CoTNet), is introduced into the high-level feature extraction layer of the backbone feature extraction network. The self-attention mechanism is used to effectively capture static and dynamic context information, thereby improving the model's ability to represent vision.

[0010] (4) Introduction of multi-scale attention mechanism (EMA): In order to help the model better handle targets of different scales and sizes, the EMA (Efficient Multi-Scale Attention Module with Cross-Spatial Learning) attention mechanism is introduced in the two output channels P4 and P5 of the backbone feature extraction network. The multi-scale parallel sub-network is used to establish long-distance and short-distance dependencies, and the output feature maps of different parallel sub-networks are fused to improve the positioning accuracy of the target detection algorithm.

[0011] (5) Model training: The improved YOLOv7 model is trained using an enhanced dataset and adopts a multi-task loss function, including classification loss, bounding box regression loss, and target confidence loss, to optimize the classification and positioning capabilities of the model. During the training process, each batch of data is first forward propagated to calculate the loss function, and then the network weights are updated through backpropagation. The training process will be divided into multiple epochs, and each epoch will traverse the entire training set.

[0012] (6) Model testing and application: The trained and verified model is tested on the test set to evaluate its performance in practical applications. The evaluation indicators used in the test phase include mean average precision (mAP), accuracy, and recall, to ensure that the model has good classification and positioning capabilities in the insulator detection task with different defect types. The optimized model can accurately detect the defect type of the insulator and be applied in the power transmission system to realize the automatic detection of insulator defects and improve the safety and operation efficiency of the power system.

[0013] In the above-mentioned method for detecting insulator defects in a power transmission system based on the improved YOLOV7, the step (1) specifically comprises:

[0014] This experimental data set was collected from the "Insulator Defect Detection" project of the IEEE DataPort-Competition. These insulators are made of ceramic, have a variety of colors, and were photographed in different positions and background conditions. The data set contains a total of 1,600 images, divided into three subcategories: flashover damaged insulator casings, broken insulator casings, and good insulator casings. The data set is divided into training, validation, and test sets in a ratio of 7:1:2, containing 1,120, 160, and 320 images, respectively. Labelimg image annotation software is used for annotation, and the annotation data is stored in an XML file in PASCAL VOC format.

[0015] In the above-mentioned method for detecting insulator defects in a power transmission system based on the improved YOLOV7, the step (2) specifically comprises:

[0016] The present invention uses a data set containing 1,600 high-resolution insulator defect images, and adopts geometric data enhancement techniques such as image scaling and distortion, image filling, image flipping and color gamut transformation, which are randomly combined to increase the diversity of data without changing the semantic content of the image, enhance the model's ability to learn features, reduce the risk of overfitting, and improve its generalization performance and robustness. By randomly combining the above-mentioned geometric data enhancement methods, the data set is expanded to 7,980 high-resolution insulator defect images. According to the ratio of 7:2:1, the data set is randomly divided into a training set, a validation set and a test set, specifically divided into 5,580 training sets, 800 validation sets and 1,600 test sets.

[0017] In the above-mentioned method for detecting insulator defects in a power transmission system based on the improved YOLOV7, the step (3) specifically comprises:

[0018] The Visual Context Transformer Network (CoTNet) is introduced into the high-level feature extraction layer of the backbone feature extraction network, so that the model can effectively capture the static context between neighboring keys and mine the dynamic context through the self-attention mechanism, thereby improving the model's ability of visual representation.

[0019] In the above-mentioned method for detecting insulator defects in a power transmission system based on the improved YOLOV7, the step (4) specifically comprises:

[0020] The EMA (Efficient Multi-Scale Attention Module with Cross-Spatial Learning) attention mechanism is introduced into the two output channels P4 and P5 of the backbone feature extraction network. The long-distance and short-distance dependencies are established through multi-scale parallel sub-networks, and the output feature maps of different parallel sub-networks are fused to effectively capture pixel-level target information, thereby improving the positioning accuracy of the target detection algorithm.

[0021] In the above-mentioned method for detecting insulator defects in a power transmission system based on the improved YOLOV7, the step (5) specifically comprises:

[0022] For the training strategy, the image input size of the present invention is 640×640; the batch size is set to 16; the learning rate adjustment method is cosine annealing decay; the training data set is iterated for 150 times in total, and no frozen training is performed; the initial learning rate is set to 0.001, the learning momentum is set to 0.937, and the weight decay rate is set to 0.0005. During training, the performance of the model will be evaluated through the validation set, and the hyperparameters of the model will be adjusted to avoid overfitting.

[0023] In the above-mentioned method for detecting insulator defects in a power transmission system based on the improved YOLOV7, the step (6) specifically comprises:

[0024] After training, the model is evaluated using the test set, and the performance of the model is measured mainly by indicators such as mean average precision (mAP), accuracy, and recall. The optimized model performs well on the test set and can accurately detect the defect types of flashover damage, broken, and normal insulators. Ultimately, the model can be applied to power transmission systems to achieve automated detection of insulator defects and improve the system's operational safety and efficiency.

[0025] According to the improved YOLOV7 power transmission system insulator defect detection method provided by the present invention, high-resolution images of different types of insulators are first collected and data enhanced, and then a visual context network and a multi-scale attention mechanism are introduced to construct an efficient insulator defect detection model, thereby achieving accurate detection of insulator defects. This method can effectively improve the safety and operating efficiency of the power system and has important reference significance for other target detection tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0027] Figure 1 This is a network architecture diagram of the insulator defect detection model based on the improved YOLOv7 algorithm, showing the improved network architecture of introducing the CoTNet module in the high-level feature extraction layer of the backbone extraction network and the EMA attention mechanism in the two output channels P4 and P5 of the backbone feature extraction network;

[0028] Figure 2 It is a partial image after data enhancement implemented in the present invention. Among them, Figure 2 (a) is the original image 01, Figure 2 (b) is the original image 02. Figure 2 (c) is image scaling + image filling 01, Figure 2 (d) is image scaling + color gamut transformation 02, Figure 2 (e) is image flipping + color gamut transformation 01, Figure 2 (f) is after image distortion + color gamut transformation 02;

[0029] Figure 3 is the detailed structure of the traditional self-attention block and context transformer (CoT) block. Figure 3 (a) is the detailed structure of the traditional self-attention block. Figure 3 (b) is the detailed structure of the context transformer (CoT) block;

[0030] Figure 4 Improved experiments for Backbone. Among them, Figure 4 (a) The baseline structure of the backbone feature extraction network. Figure 4 (b) The CoTNet module is introduced into the P5 extraction layer of the backbone feature extraction network. Figure 4 (c) The CoTNet module is introduced at the P4 and P5 extraction layers of the backbone feature extraction network. Figure 4 (d) The CoTNet module is introduced at the P3, P4 and P5 extraction layers of the backbone feature extraction network;

[0031] Figure 5 This is a structural comparison of different attention modules. Figure 5 (a) is the CA model, Figure 5 (b) is the EMA model;

[0032] Figure 6 Improved experiment for Neck. Among them, Figure 6 (a) is the baseline structure of feature fusion and enhancement network. Figure 6 (b) To introduce the EMA attention mechanism into the P5 output extraction layer, Figure 6 (c) To introduce the EMA attention mechanism into the P4 and P5 output extraction layers, Figure 6 (d) To introduce the EMA attention mechanism into the P3 and P5 output extraction layers, Figure 6 (e) To introduce the EMA attention mechanism into the P3 and P4 output extraction layers, Figure 6 (f) Introducing the EMA attention mechanism into the P3, P4, and P5 output extraction layers;

[0033] Figure 7 This is a comparison chart of indicators during the training of each model. Figure 7 (a) is the accuracy, Figure 7 (b) is the recall rate, Figure 7 (c) is mAP@[0.5], Figure 7 (d) is mAP@[0.5:0.95];

[0034] Figure 8 This is the thermal map of insulator defect detection. Figure 8 (a) is the flashover damage to the shell (unmodified model), Figure 8 (b) is the flashover damage to the shell (improved model), Figure 8 (c) is a damaged shell (unmodified model), Figure 8 (d) is a damaged shell (improved model), Figure 8 (e) is the normal shell (no improved model), Figure 8 (f) Normal shell (improved model);

[0035] Fig. 9 Insulator defect detection test results

[0036] Fig.10 The system flow chart for the implementation of the present invention shows the overall process of the insulator defect detection method based on the improved YOLOv7 algorithm. DETAILED DESCRIPTION

[0037] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings. Several embodiments of the present invention are shown in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0039] Figure 1 The network architecture diagram of the insulator defect detection model based on the improved YOLOv7 algorithm is shown. The network architecture diagram is mainly divided into two parts:

[0040] Backbone feature extraction network: A visual context Transformer network (CoTNet) is introduced in the high-level feature extraction layer to improve the model's ability to represent vision.

[0041] Multi-scale attention mechanism: The EMA (Efficient Multi-Scale Attention Module with Cross-Spatial Learning) attention mechanism is introduced in the two output channels P4 and P5 of the backbone feature extraction network to improve the positioning accuracy of the target detection algorithm.

[0042] The embodiment of the present invention provides a method for detecting insulator defects in a power transmission system based on an improved YOLO V7, comprising the following steps (1) to (6):

[0043] (1) Data collection: 1,600 high-resolution images of insulators were collected. These images include three different defect types: flashover damaged insulator shells, broken insulator shells, and good insulator shells, which serve as the basic data for model training. The specific data comes from the "Insulator Defect Detection" project of the IEEE DataPort-Competition. These images include ceramic insulator images taken in various colors, positions, and background conditions. The dataset is divided into training set, validation set, and test set in a ratio of 7:1:2, containing 1,120, 160, and 320 images, respectively. They are annotated using Labelimg image annotation software, and the annotated data is stored in an XML file in PASCAL VOC format. The specific dataset distribution is shown in Table 1.

[0044] Table 1 Dataset category distribution

[0045]

[0046] (2) Data enhancement: Figure 2 The original images of the dataset and the images processed by different data augmentation techniques are shown. Four geometric data augmentation techniques, image scaling and distortion, image padding, image flipping, and color gamut transformation, are randomly combined to enhance the original dataset materials to increase the diversity of the dataset and the robustness of the model.

[0047] In order to enhance the model's ability to learn features, reduce the risk of overfitting, and improve its generalization performance and robustness, the present invention performs geometric data enhancement on the original data set, including processing of various environmental conditions, scales, and angles. This method mainly increases the diversity of data by changing the geometric characteristics of the image, but does not change the semantic content of the image. Figure 2 (a) and (b) show some images of the original dataset; Figure 2 (c) shows the image after image scaling + image filling, which maintains the relative position of the target frame in the image; Figure 2 (d) shows the image after image scaling + color gamut transformation, which adjusts the hue, saturation and brightness of the image. Figure 2 (e) shows the image after image flipping + color gamut transformation, which increases the diversity of samples; Figure 2 (f) shows the image after image distortion + color gamut transformation, which further enhances the diversity of the data.

[0048] I. Image Scaling and Distortion

[0049] Image scaling and distortion refers to changing the size and aspect ratio of an image by a random scaling factor S and a randomly generated aspect ratio distortion factor D. The random scaling factor S of the present invention is generated by the function rand(0.25, 2), that is, a scaling factor is randomly selected between 0.25 and 2. During the image scaling process, the aspect ratio of the image will also be randomly distorted. The aspect ratio (AR) of the image can be described mathematically as follows:

[0050]

[0051] Among them, w is the image width, h is the image height, ε controls the degree of distortion, and its default value is 0.3. rand(a, b) is a random function that returns a random number in the range [a, b], which is used to generate a random aspect ratio distortion factor:

[0052]

[0053] II. Image Filling

[0054] After the image is scaled, the size will change. After random scaling, in order to maintain the relative position of the target frame in the image, the present invention fills the redundant part of the image with a gray background. In order to make the position of the filled image different from the original image, the present invention sets the offset of the image filling position to a random value, which is mathematically described as follows:

[0055] dx = rand (0, ww′) (2)

[0056] dy=rand(0,hh′) (3)

[0057] Among them, dx represents the horizontal offset, w represents the original width of the image, and w` represents the width of the image after scaling; dy represents the vertical offset, h represents the original height of the image, and h` represents the height of the image after scaling. rand(a, b) is a random function that returns a random number in the range [a, b].

[0058] III. Image Flip

[0059] In the present invention, the image is randomly flipped horizontally (left-right flipped) or vertically (up-down flipped) to increase the diversity of training samples.

[0060] IV. Color Gamut Transformation

[0061] Color gamut conversion is the conversion of an image from one color space to another, and is usually used to adjust the image's attributes such as hue, saturation, and brightness. The present invention increases the diversity and robustness of data by randomly adjusting the hue, saturation, and brightness of the image. Its mathematical representation is as follows:

[0062] [H, S, V] = [h×rand(-1,1), s×rand(-1,1), v×rand(-1,1)] (4)

[0063] Among them, H, S, V represent the color space after transformation, while h, s, v represent the color space before transformation. rand(a, b) is a random function that returns a random number in the range [a, b].

[0064] Based on the original data set, the present invention randomly combines and uses the above-mentioned geometric data enhancement method to expand the data set to 7980 high-resolution insulator defect images. According to the ratio of 7:2:1, the data set is randomly divided into a training set, a validation set and a test set, specifically divided into 5580 training sets, 800 validation sets and 1600 test sets. Figure 2 As shown, the comparison between the original image and the image after data enhancement is shown.

[0065] The original data set was processed by data enhancement technology, and combined with the above-mentioned improvement measures, the corresponding model training and testing were carried out. As shown in Table 2, the present invention adopts the improved final model, namely Model 4. Among them, mAP stands for mean average precision. Under this model, the accuracy rate increased by 0.6%, the recall rate increased by 1.8%, and mAP@[0.5], mAP@[0.75] and mAP@[0.5:0.95] increased by 0.6%, 2.1% and 4.4% respectively. This shows that after the improvement, the model has achieved significant improvements in classifying samples and capturing positive category samples. In addition, under different confidence conditions, the model has also achieved significant improvements, so that the algorithm shows higher accuracy and comprehensiveness in target detection tasks and better identifies targets.

[0066] Table 2 Statistical evaluation of each model test verification after introducing data augmentation

[0067]

[0068] Note: 1: YOLOV7X, 2: YOLOV7X+data enhancement, 3: YOLOV7X+CoTNet+EMA attention mechanism (adding P4 and P5 channels), 4: YOLOV7X+data enhancement+EMA attention mechanism (adding P4 and P5 channels).

[0069] (3) Introduction of Visual Context Network (CoTNet): The visual context network, namely Contextual Transformer Networks (CoTNet), is introduced into the high-level feature extraction layer of the backbone feature extraction network. The self-attention mechanism is used to effectively capture static and dynamic context information, thereby improving the model's ability to represent vision.

[0070] Convolutional neural networks (CNNs) effectively capture the local relationships and spatial structures of input data through discrete convolution operations. They are translationally invariant and have strong nonlinear modeling capabilities, making them perform well in tasks such as image classification, object detection, and face recognition. However, traditional CNNs have a limitation, namely that each convolution kernel can only see a local input area, and its receptive field of view is limited by the size of the convolution kernel and the number of network layers. Although the receptive field of view can be gradually expanded by increasing the number of network layers, it is still limited to the local area. This limitation of the local receptive field of view makes it difficult for CNNs to handle long-distance dependencies and global relationships.

[0071] In the high-resolution insulator dataset processed by the embodiments of the invention, since the extraction requirements for detail features are high and the small target prediction frame is mixed with a relatively large complex background, it is of great significance to introduce an appropriate Transformer model. This model can better capture global contextual information, establish long-distance dependencies, and provide a larger perception field of view, thereby improving target detection performance. By introducing the Transformer model, the present invention can surpass the local perception field of view limitations of traditional CNNs, effectively capture the associations and contextual semantics between targets, thereby improving the processing capabilities of detail features and complex backgrounds, and making the target detection model more accurate and robust in high-resolution images.

[0072] The scalable local multi-head self-attention in traditional visual backbone networks adopts a general formula, such as Figure 3 (a) shows the basic composition of the self-attention mechanism. Given an input 2D feature of size H×W×C (H: height, W: width, C: number of channels) Figure X , through the embedding matrix (W q , W k , W v ) to convert X into query Q = XW q , key K = XW k The sum V = XW v Each embedding matrix is ​​implemented by performing a 1×1 convolution on the space. Then, the local relationship matrix R∈R is calculated by key K and query Q H ×W×(k×k×C h ) to express the relationship between them as:

[0073]

[0074] Among them, C h Indicates the number of heads, represents a local matrix multiplication operation, which is used to measure the pairing relationship between each query and the corresponding key in the local k×k grid. Therefore, each feature R(i) at the i-th spatial position of the matrix R is a k×k×C h dimensional vector, which consists of all the heads of C h The local relationship matrix R further enriches the information of each k×k grid position:

[0075]

[0076] In formula (6), P∈R k ×k×C k represents the 2D relative position embedding within each k×k grid, and across all C h Next, by enhancing the spatially aware local relationship matrix Perform a Softmax operation and normalize along the channel dimension of each head to obtain the attention matrix A: Then, the eigenvector at each spatial position of A is reshaped into C h local attention matrices (of size k×k). The final output feature map is calculated by aggregating all values ​​within each k×k grid with the learned local attention matrix:

[0077]

[0078] In the above principle, the local attention matrix of each head is only used to aggregate the feature maps of V evenly divided along the channel dimension, and the final output Y is the concatenation of the aggregated feature maps of all heads.

[0079] In traditional self-attention blocks, all pairs of query-key relations are learned independently without exploring the rich contextual information between them. This severely limits the ability of self-attention to learn visual representations in 2D feature maps. To address this problem, the Contextual Transformer (CoT) block (e.g. Figure 3 (b) combines context information mining and self-attention learning into a unified architecture, effectively improving self-attention learning and enhancing the representation ability of the output aggregate feature map. Compared with the traditional self-attention block, the CoT block can more effectively capture static and dynamic context information.

[0080] In particular, assuming the same input 2D features Figure X ∈R H ×W×C. The keys, queries, and values ​​are defined as K=X, Q=X, and V=XW respectively. vDifferent from the typical self-attention mechanism, the CoT block first performs k×k grouped convolutions on all neighbor keys within a k×k grid in space to contextualize the representation of each key. The learned contextualized key K 1 ∈R H ×WXC naturally reflects the static context information between local neighbor keys and takes K1 as the static context representation of input X. After that, based on the contextualized key K 1 and the query Q as a condition, through two consecutive 1×1 convolutions (W with ReLU activation function θ and W without activation function δ ) to get the attention matrix:

[0081] A=[K 1 , Q]W θ W δ (8)

[0082] In other words, for each head, the attention matrix A is learned at each spatial position based on the query features and the contextualized key features, rather than the isolated query-key pair. This approach can be achieved by mining the static context K 1 The additional guidance of , enhances the learning ability of self-attention. Next, according to the contextualized attention matrix A, in a typical self-attention way, by aggregating all values ​​V, the attention feature map K is calculated 2 :

[0083]

[0084] Since we focus on the feature map K 2 Capturing the dynamic feature interaction between inputs, K 2 is called the dynamic context representation of the input. Therefore, the final output (Y) of the CoT block incorporates the static context K 1 and dynamic context K 2 Blend together for measurement.

[0085] In order to enhance the model's ability to perceive visual information of different scales, the present invention introduces the Visual Context Transformer Network (CoTNeT) into the backbone feature extraction network. This allows the context information to be reused and transferred between feature maps at different levels, effectively utilizing the multi-scale representation of features. Figure 4 The effect of introducing different positions of the CoTNet module in the backbone feature extraction network on the model performance is shown. Figure 4 (a) The baseline structure of the backbone feature extraction network. Figure 4 (b) The CoTNet module is introduced in the P5 extraction layer of the backbone feature extraction network. Figure 4(c) Introducing the CoTNet module at the P4 and P5 extraction layers of the backbone feature extraction network, Figure 4 (d) The CoTNet module is introduced at the P3, P4 and P5 extraction layers of the backbone feature extraction network.

[0086] The model performance evaluation and verification statistics are shown in Table 3 below. mAP stands for mean average precision. From the table data, it can be seen that when the CoTNet module is introduced into the P5 extraction layer of the backbone feature extraction network, its recall rate, mAP@[0.75] and mAP@[0.5:0.95] indicators are increased by 0.6%, 0.7% and 0.7% respectively compared with the benchmark. This shows that this improved module enhances the algorithm's perception ability and positioning accuracy for large-size targets, thereby improving the detection effect for larger targets. However, the mAP@[0.5] indicator decreased by 0.2%. This is because the improved model introduced some new computing operations or complexities, resulting in a decrease in the positioning and recognition performance of some smaller targets. For this reason, considering the comprehensive cost-effectiveness, this experiment introduced the CoTNet module into the P5 extraction layer of the backbone feature extraction network as the final improvement experiment.

[0087] Table 3. Statistical evaluation of each model test verification after the introduction of the CoTNet module

[0088]

[0089]

[0090] Note: 1: Benchmark (corresponding to Figure 4 (a)), 2: Introducing the P5 extraction layer (corresponding to Figure 4 (b)), 3: Introducing P4 and P5 extraction layers (corresponding to Figure 4 (c)), 4: Introducing P3, P4 and P5 extraction layers (corresponding to Figure 4 (d)).

[0091] (4) Introducing the multi-scale attention mechanism (EMA): In order to help the model better handle targets of different scales and sizes, the EMA (Efficient Multi-Scale Attention Module with Cross-Spatial Learning) attention mechanism is introduced in the two output channels P4 and P5 of the backbone feature extraction network. The multi-scale parallel sub-network is used to establish long-distance and short-distance dependencies, and the output feature maps of different parallel sub-networks are fused to improve the positioning accuracy of the target detection algorithm. Figure 5The structural differences of two different types of attention modules and their possible impact on model performance are shown and compared in detail. These two types of attention modules are the traditional Channel Attention (CA) module and our proposed Efficient Multi-Scale Attention Module with Cross-Spatial Learning (EMA) module.

[0092] In the object detection task, the introduction of the attention mechanism can improve the model's ability to understand important features and contextual information in the input data, thereby improving the performance of object detection. By dynamically adjusting the attention allocation, the model can more effectively utilize computing resources and focus on key target areas and detailed features, thereby obtaining more accurate detection results.

[0093] However, there are some limitations in traditional attention mechanisms, such as SE (Squeeze-and-Excitation) and CA (Coordinate attention). When establishing intra-channel interactions, they use dimensionality reduction operations such as global average pooling, resulting in the loss of some spatial information, thus affecting the model's ability to model pixel-level relationships. Figure 5 The channel attention (CA) module structure shown in (a) includes: an input feature map with a dimension of C×H×W, where C is the number of channels, H is the height, and W is the width; first, global average pooling is performed on each channel to obtain a 1×C vector, which contains the global information of each channel; then, a fully connected layer (or convolutional layer) and a ReLU activation function are used to process the global information and learn the dependencies between channels; then, the learned weights (or attention weights) are multiplied by the original feature map to recalibrate the feature map to emphasize important features and suppress unimportant features; after being processed by the channel attention mechanism, the feature map still has a dimension of C×H×W, but the importance of the features has been redistributed.

[0094] In addition, attention mechanisms such as CBAM (Convolutional block attention module) and ParNet (Parallel networks) require complex computational operations, especially when establishing channel and spatial interactions, and require complex pooling and convolution operations, resulting in high computational complexity. Some attention mechanisms may use simple average pooling or summation operations when fusing information of different scales or channels, but fail to fully explore the association between different information, resulting in unsatisfactory feature aggregation effects.

[0095] To this end, this paper introduces a new and efficient multi-scale attention mechanism, EMA, to address some limitations of the traditional attention mechanism. Figure 5 The EMA (Efficient Multi-Scale Attention Module with Cross-Spatial Learning) module structure shown in (b) includes: the input feature map is also C×H×W; the EMA module first performs multi-scale processing on the input feature map through multiple parallel convolutional layers (or pooling layers) to capture information at different scales; then, the features of different scales are fused through a specific interaction mechanism (such as cross attention or spatial pyramid pooling) to achieve cross-scale spatial information learning; then, based on the fused feature map, attention weights are generated, which not only consider the dependencies between channels, but also incorporate cross-scale spatial information; finally, the generated attention weights are multiplied by the original feature map for feature recalibration; the feature map processed by the EMA module still has a dimension of C×H×W, but the feature representation is richer and more accurate, which can better meet the needs of insulator defect detection tasks. The process is as follows:

[0096] First, EMA is improved based on the traditional attention modules SE (Squeeze-and-Excitation) and CA (Coordinate Attention), retaining more spatial information and improving the modeling ability of pixel-level relationships. At the same time, EMA avoids complex computational operations, especially when establishing channel and spatial interactions, using efficient pooling and convolution operations to reduce computational complexity. In addition, EMA introduces multi-scale parallel sub-networks, which can effectively capture feature information of different scales, and fuses the features learned by different sub-networks through cross-space learning methods to further improve feature representation capabilities.

[0097] like Figure 5 As shown, by comparing the EMA attention mechanism introduced in the present invention with the CA attention mechanism structure, it can be found that EMA introduces a multi-scale parallel sub-network, including a 1x1 branch and a 3x3 branch, to capture feature information of different scales. This parallel structure enables EMA to improve the feature representation capability without introducing more sequential processing and greater network depth, avoiding the high computational complexity that may be brought about by the traditional attention mechanism. In terms of processing dimension, CA adopts a global average pooling operation when establishing intra-channel interactions, which reduces the loss of some spatial information. On the contrary, EMA avoids the dimensionality reduction operation, retains more spatial information, improves the representation accuracy of features, and is conducive to better modeling pixel-level relationships. In addition, EMA fuses the features learned by sub-networks of different scales through a cross-space learning method, further improving the feature aggregation effect.

[0098] (5) Model training: The improved YOLOv7 model is trained using the enhanced dataset, with the input image size of 640×640 and the batch size set to 16 to ensure that an appropriate number of samples are processed in each iteration. During the training process, the model uses a multi-task loss function, including classification loss, bounding box regression loss, and object confidence loss, to optimize the classification and localization capabilities of the model. The training is not frozen, that is, all layers participate in parameter updates throughout the training process.

[0099] The learning rate of the model is adjusted using a cosine annealing decay strategy to ensure that the learning rate gradually decreases during training, thereby improving the convergence performance and stability of the model. The initial learning rate is set to 0.001, and the learning momentum is set to 0.937 to maintain the stability of the model weights during training. In order to prevent overfitting, a weight decay rate of 0.0005 is used so that the network weights will not be too large during training and the generalization ability of the model is maintained.

[0100] The entire training process iterates the data set 150 times (epoch), and each round traverses the training set. During the training process, the model performance is evaluated through the validation set, and the model hyperparameters are adjusted to ensure that the model can effectively learn and improve the detection accuracy. Finally, through this non-freezing training method, the model achieved good performance in classification and target positioning, achieving the goal of insulator defect detection in power transmission systems.

[0101] (6) Model testing and application: In order to evaluate the performance of the trained model, the present invention uses a test dataset containing 1,600 high-resolution insulator images to perform insulator defect detection analysis on the model. This dataset covers a variety of situations such as flashover damage, breakage, and good insulator casings. The batch size of the test phase is set to 16, the intersection over union (IOU) threshold is set to 0.5, and the confidence threshold is set to 0.001 to ensure the stability and accuracy of the model in practical applications.

[0102] During the test, key indicators were used to evaluate the model performance, including accuracy, recall, F1 score, and mean average precision (mAP). Among them, mAP@[0.5] represents the average precision at an IOU threshold of 0.5, mAP@[0.75] represents the precision at an IOU threshold of 0.75, and mAP@[0.5∶0.95] represents the comprehensive performance at different IOU thresholds. The test results show that the model has the highest accuracy of 98.5%, the highest recall of 97.6%, and the F1 score of 97.8%, while the performance on mAP@[0.5], mAP@[0.75], and mAP@[0.5∶0.95] are 99.3%, 98.4%, and 87.3%, respectively. These results show that the improved model has extremely high accuracy and robustness in object detection and defect recognition.

[0103] Compared with the unimproved model, the improved model has achieved significant improvements in all indicators. Specifically, the accuracy of the improved model increased by 0.6%, the recall rate increased by 1.8%, the F1 score increased by 0.8%, and the mAP@[0.5], mAP@[0.75] and mAP@[0.5∶0.95] increased by 0.6%, 2.1% and 4.4% respectively. These improvements show that through the introduction of the visual context network (CoTNet) and the multi-scale attention mechanism (EMA), the model performs well in dealing with objects of different scales, complex backgrounds and different types of defects, and significantly improves the classification and positioning accuracy.

[0104] Finally, after testing and verification, the improved YOLOv7 model can be successfully applied to actual power transmission systems for automatic detection of insulator defects. The model not only has high precision and high recall, but can also handle large-scale detection tasks in real time, which helps to significantly improve the maintenance efficiency of the power system, reduce the risk of accidents, and ensure the safe and stable operation of the system.

[0105] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

[0106] Figure 6 To investigate the effect of different positions of the EMA attention mechanism on model performance in feature fusion and enhancement networks. Figure 6 (a) is the baseline structure without introducing the EMA attention mechanism. Figure 6(b)-(f) introduce the EMA attention mechanism into different output layers (P5, P4 and P5, P3 and P5, P3 and P4, P3, P4 and P5) respectively. These experiments aim to find the best introduction position of the EMA attention mechanism to further improve the detection accuracy of the model. As shown in Table 4, the present invention conducts five sets of experimental analysis on the introduction of the EMA attention mechanism into the model structure. It can be found from the table that when the EMA attention mechanism is introduced into the P4 and P5 output extraction layers, the average accuracy reaches 98.0% and 96.2% when the Intersection over Union (IOU) thresholds are 0.5 and 0.75 respectively. Therefore, it is used as one of the improved experiments of the present invention. In addition, when the attention mechanism is introduced into the P3, P4 and P5 output extraction layers, its precision, recall rate and mAP@[0.5:0.95] all achieve the best results of this experiment, so it is used as another part of the improved experiment of the present invention.

[0107] Table 4 Statistical evaluation of each model test verification after introducing the EMA attention mechanism

[0108]

[0109] Note: 1: Introduce P5 output extraction layer; 2: Introduce P4 and P5 output extraction layer; 3: Introduce P3 and P5 output extraction layer; 4: Introduce P3 and P4 output extraction layer; 5: Introduce P3, P4 and P5 output extraction layer.

[0110] Ablation experiment after introducing CoTNet and EMA attention mechanism into YOLOV7X model. After 150 epochs training, Figure 7 As shown in Figure 1, the training results of the improved model are shown. It contains four sub-figures showing the evaluation of various indicators at different stages of the training phase.

[0111] from Figure 7 As can be seen in the figure, the model began to converge after 140 Epoch training, so the training results of 150 Epoch are shown. Figure 7 (a) and Figure 7 (b) shows the accuracy and recall during model training. After the model was trained for 150 epochs, the accuracy and recall of the improved combination adopted by the present invention - YOLOV7X + data enhancement + CoTNet + EMA attention mechanism (adding P4 and P5 channels) reached 98.6% and 97.6% respectively, which were 0.9% and 1.2% higher than those without improvement. This shows that the improved algorithm has improved the ability to identify positive samples while maintaining recognition accuracy, and more real positive samples have been captured more effectively, thereby improving the overall performance of the system; Figure 7(c) and Figure 7 (d) shows the average accuracy of the intersection-over-union ratio thresholds of 0.5 and 0.5:0.95 respectively. It can be clearly observed from the curves in the figure that after 150 epochs of training, the improved combination adopted by the present invention reaches 99.3% and 86.8% respectively under two accuracy evaluations, which is 0.9% and 3.6% higher than the unimproved results. This shows that when the intersection-over-union ratio threshold is looser (0.5), the accuracy of target detection is improved after the algorithm is improved, and the position and bounding box of the target object can be better captured. Although the improvement of 0.9% may not seem large, in the target detection task, even a small performance improvement may have an important impact on practical applications, especially when a large number of target detection tasks need to be processed. The performance improvement within different intersection-over-union ratio threshold ranges (0.5:0.95) shows that the algorithm has achieved better detection results on target objects of different sizes and shapes.

[0112] Figure 8 The thermal map visualization of the original model and the improved model is performed by the present invention. Figure 8 (a)- Figure 8 (c) It can be seen that the original model pays too much attention to the background in the feature extraction network, while the activation of different types of insulator strings is weak. This shows that the model fails to effectively capture the important features of a specific target in the feature extraction stage, resulting in excessive attention to the background and neglect of the target during the prediction process. The improved model introduces CoTNet in the feature extraction network, which enables the model to capture the static context between neighboring keys, thereby enhancing the focus on the target; in the feature fusion stage, the EMA multi-scale attention mechanism is introduced. From Figure 8 (d)- Figure 8 (f) It can be seen that this attention mechanism effectively reduces the model’s focus on the background during prediction, helping the model to better handle multi-scale and multi-level image features, thereby improving the applicability and accuracy of the model in practical applications.

[0113] Fig. 9 In order to evaluate the performance of the improved model in actual detection, the present invention uses a test data set to evaluate the model to obtain a test result diagram of insulator defect detection, marks different categories of insulator shells with different colors, and annotates the detection accuracy.

[0114] Fig.10The system flow chart for the implementation of the present invention shows the overall process of the insulator defect detection method based on the improved YOLOv7 algorithm. First, multiple high-resolution insulator images of three different defect types are collected as the original materials for model training; then, four geometric data enhancement techniques, namely image scaling and distortion, image filling, image flipping and color gamut transformation, are randomly combined to enhance the original data set materials; and the visual context network is introduced in the high-level feature extraction layer of the backbone feature extraction network; and the EMA attention mechanism is introduced in the two output channels P4 and P5 of the backbone feature extraction network, finally realizing the accurate detection of insulator defects.

[0115] In summary, the present invention provides a method for detecting insulator defects in a power transmission system based on an improved YOLOV7. The specific steps are as follows: First, 1600 high-resolution images of insulators are collected, including three types of defects: flashover damage, broken and intact insulator shells. The data comes from the "Insulator Defect Detection" project of the IEEE Data Port-Competition. The data set is divided into a training set, a validation set and a test set at a ratio of 7:1:2, and is annotated using Labelimg software. The data is stored in the PASCAL VOC format. Secondly, the original data set is expanded by four geometric data enhancement techniques: image scaling and distortion, image filling, image flipping and color gamut transformation. Finally, the data set is expanded to 7980 images and is again divided into a training set, a validation set and a test set at a ratio of 7:2:1. Then, the CoTNet module is introduced in the high-level feature extraction layer of the backbone feature extraction network, and the static and dynamic context information is captured through the self-attention mechanism to enhance the model's ability to extract detail features. Comparative experiments show that the CoTNet module introduced into the P5 extraction layer has the best effect. Finally, the EMA attention mechanism is introduced into the two output channels P4 and P5 of the backbone feature extraction network, and the positioning accuracy and feature representation ability of the model are enhanced through multi-scale parallel sub-networks and cross-space learning methods. Comparative experiments show that the best effect is achieved by introducing the EMA attention mechanism into the output extraction layers of P3, P4 and P5.

[0116] Finally, by introducing data enhancement, visual context network (CoTNet) and multi-scale attention mechanism (EMA), the model has significantly improved in accuracy, recall and mAP indicators, and can more accurately and comprehensively identify and detect insulator defects in power transmission systems, improve the robustness and generalization performance of the model, and provide an effective technical means for the maintenance and detection of power transmission systems.

[0117] The above embodiments only describe several implementation methods of the present invention. Although they are specific and detailed, they should not be understood as limiting the scope of the present invention. For those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the attached claims.

Claims

1. A method for detecting insulator defects in a power transmission system based on improved YOLOV7, characterized in that: The following steps are involved: (1) Collect multiple high-resolution insulator images of three different defect types, including flashover damaged insulator casings, broken insulator casings, and good insulator casings, as raw materials for model training; (2) Randomly combine four geometric data augmentation techniques, namely image scaling and distortion, image filling, image flipping, and color gamut transformation, to perform data augmentation on the original data set material; (3) Introducing the visual context network into the high-level feature extraction layer of the backbone feature extraction network; (4) Introduce the EMA attention mechanism in the two output channels P4 and P5 of the backbone feature extraction network; (5) Use the enhanced dataset for multiple rounds of training, optimize model performance through dynamic learning rate adjustment and multi-task loss function, and evaluate on the validation set to prevent overfitting; (6) The trained and verified model is tested on a test set to evaluate its performance in practical applications. The final optimized model can accurately detect the defect type of insulators and be applied to power transmission systems to achieve automated detection of insulator defects.

2. The method for detecting insulator defects in a power transmission system based on improved YOLOV7 according to claim 1 is characterized in that: The step (1) specifically comprises: The experimental data set was collected from the "Insulator Defect Detection" project of the IEEE DataPort-Competition. These insulators are made of ceramic and have a variety of colors. They were photographed at different locations and under different background conditions. The data set contains a total of 1,600 images, which are divided into three subcategories: flashover damaged insulator shells, broken insulator shells, and good insulator shells. Flashover damaged insulator shells refer to partial discharges on the insulator shells, resulting in damage to the insulation performance of the surface; broken insulator shells refer to insulator shells that have suffered physical damage, such as cracks, fragments, and falling pieces; normal insulator shells refer to insulator shells without flashover, breakage, or other physical damage; The dataset is divided into training set, validation set and test set in a ratio of 7:1:

2. The specific division results are as follows: the training set has 1120 images, the validation set has 160 images, and the test set has 320 images. The dataset is annotated using Labelimg image annotation software, and the annotated data is stored in an XML file in PASCAL VOC format.

3. The method for detecting insulator defects in a power transmission system based on improved YOLOV7 according to claim 1 is characterized in that: The step (2) specifically comprises: A dataset of 1600 high-resolution insulator defect images is used, in which samples of different categories are unevenly distributed and the proportion of images of damaged insulator shells is relatively low. Geometric data enhancement is performed on the original dataset, including processing of various environmental conditions, scales and angles. The diversity of data is increased by changing the geometric characteristics of the image, but the semantic content of the image is not changed. Four geometric data enhancement techniques, including image scaling and distortion, image filling, image flipping and color gamut transformation, are adopted and used in random combination.

4. The method for detecting insulator defects in a power transmission system based on improved YOLOV7 according to claim 1 is characterized in that: The step (3) specifically comprises: The visual context Transformer network is introduced in the high-level feature extraction layer of the backbone feature extraction network, so that the model can effectively capture the static context between adjacent keys and mine the dynamic context through the self-attention mechanism. The introduction of the visual context Transformer network enables the model to better combine context mining information and self-attention learning, thereby improving the model's ability to represent vision.

5. The method for detecting insulator defects in a power transmission system based on improved YOLOV7 according to claim 1 is characterized in that: The step (4) specifically comprises: The EMA attention mechanism is introduced in the two output channels P4 and P5 of the backbone feature extraction network. This mechanism uses a multi-scale parallel sub-network to establish dependencies between long distances and short distances, so that the model can capture the global correlation between features. At the same time, the mechanism fuses the output feature maps of different parallel sub-networks through a cross-space learning method to effectively capture pixel-level target information, thereby improving the target detection algorithm's positioning accuracy.

6. The method for detecting insulator defects in a power transmission system based on improved YOLOV7 according to claim 1 is characterized in that: The step (5) specifically comprises: The improved YOLOv7 model is trained using an enhanced dataset and adopts a multi-task loss function, including classification loss, bounding box regression loss, and target confidence loss, to optimize the classification and positioning capabilities of the model. During the training process, each batch of data is first forward propagated to calculate the loss function, and then the network weights are updated through backpropagation. The training process will be divided into multiple rounds, and each round will traverse the entire training set. For the training strategy, the image input size is 640×640; the Batch Size is set to 16; the learning rate adjustment method is cosine annealing decay; the training dataset is iterated for a total of 150 times, and no frozen training is performed; the initial learning rate is set to 0.001, the learning momentum is set to 0.937, and the weight decay rate is set to 0.0005. During training, the performance of the model will be evaluated through the validation set, and the hyperparameters of the model will be adjusted to avoid overfitting.

7. The method for detecting insulator defects in a power transmission system based on improved YOLOV7 according to claim 1 is characterized in that: The step (6) specifically comprises: After training and verification, the improved YOLOv7 model will be evaluated on the test set to verify its generalization ability and performance in practical applications. The evaluation indicators used in the test phase include average precision mean, accuracy and recall rate to ensure that the model shows good classification and positioning capabilities in insulator detection tasks with different defect types. After the test is completed, the model is deployed and applied in the actual scenario of the power transmission system to realize real-time defect detection of insulators.

Citation Information

Cited By

  • Insulator spontaneous explosion detection method and device based on improved YOLOv11

    CN120580208A

  • Composite robot assisted electric meter box material detection method and system

    CN121740895A