Insulator defect rapid detection method and system based on YOLO-MID
Patent Information
- Application Number
- CN202311454947.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-03
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2043-11-03
AI Technical Summary
[0005]本发明提供了一种基于YOLO-MID的绝缘子缺陷快速检测方法和系统,用于解决现有的绝缘子缺陷检测方法对于小目标缺陷的检测能力较差,且对于导致绝缘子锈蚀与污闪缺陷情况检测精度较低的技术问题
[0045]本发明提供的基于YOLO-MID的绝缘子缺陷快速检测方法,一方面,基于ALCNet数据增强方法构建绝缘子缺陷图像数据集,可以实现绝缘子污闪、锈蚀等缺陷区域对比度增强的同时增广样本,从而提高模型实际应用下的检测精度,提高了绝缘子锈蚀与污闪缺陷检测精度;另一方面,基于混合加权注意力机制改进YOLOv7-tiny模型的特征提取网络,基于混合加权注意力机制与深度可分离卷积改进YOLOv7-tiny模型的特征融合网络,然后引入AD-Head自适应解耦检测头实现特征解码预测,得到了基于混合加权注意力机制改进的YOLOv7-tiny缺陷检测模型,改进的YOLOv7-tiny缺陷检测模型实现了准确快速的绝缘子检测,解决了现有的绝缘子缺陷检测方法对于小目标缺陷的检测能力较差,且对于导致绝缘子锈蚀与污闪缺陷情况检测精度较低的技术问题。
Smart Images

Figure CN117437204B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of insulator defect detection technology, and in particular to a rapid insulator defect detection method and system based on YOLO-MID. Background Technology
[0002] The ever-increasing demand for electricity has brought significant challenges to power grid maintenance and repair. Insulators, as an indispensable component of the power system, provide electrical insulation and mechanical support, and are key components of high-voltage transmission and distribution lines. However, due to various factors such as atmospheric conditions and mechanical stress, insulators often suffer from defects such as spontaneous explosion, breakage, flashover, corrosion, and string failure. Failure to address these issues promptly can easily lead to simultaneous multi-point tripping in a region, causing widespread power outages.
[0003] Currently, in manual inspections, the rates of false positives and missed positives for insulator faults remain high, and actual preventative measures are still insufficient, failing to effectively curb the rising trend of insulator faults. Therefore, while balancing power grid safety with the high efficiency of manual inspections, power grid maintenance personnel need to strengthen cleaning and maintenance efforts against factors such as bird droppings and dirt that may cause insulator faults in specific areas, and propose differentiated prevention and control measures for high-frequency insulator faults in different areas. Accurately locating insulator faults in complex inspection images, and thus assisting line inspection personnel in accurately identifying insulator faults, is of great significance for regional line maintenance.
[0004] Insulators come in a variety of styles, but insulator defects are often small in size, and the contrast between corrosion and flashover defects and insulators made of the same color material is low. This leads to decreased detection accuracy for corrosion and flashover defects, making it difficult to meet the inspection requirements of practical engineering applications. Existing insulator defect detection methods have poor detection capabilities for small-target defects and low accuracy in detecting corrosion and flashover defects. Therefore, improving the detection accuracy for corrosion and flashover defects and for small-target defects is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] This invention provides a rapid insulator defect detection method and system based on YOLO-MID, which solves the technical problems of existing insulator defect detection methods having poor detection capability for small target defects and low detection accuracy for defects that cause corrosion and flashover in insulators.
[0006] In view of this, the first aspect of the present invention provides a rapid insulator defect detection method based on YOLO-MID, comprising:
[0007] A dataset of insulator defect images was constructed using the Fmix data enhancement method based on ALCNet local contrast enhancement processing.
[0008] Construct a hybrid weighted attention mechanism module;
[0009] The feature extraction and feature fusion networks of the YOLOv7-tiny network are improved based on the hybrid weighted attention mechanism module. An adaptive decoupled detection head is used to perform feature decoding and prediction of the YOLOv7-tiny network, resulting in an improved YOLOv7-tiny defect detection model.
[0010] The improved YOLOv7-tiny defect detection model was trained and tested based on the insulator defect image dataset to obtain the target insulator defect detection model.
[0011] The collected images of the insulators to be inspected are input into the target insulator defect detection model to obtain the insulator defect detection results.
[0012] Optionally, a hybrid weighted attention mechanism module is constructed, including:
[0013] By setting random probabilities and adaptively obtaining a set of optimal weight parameters based on the particle swarm optimization algorithm, the optimal weight parameters are used as inputs to the CBAM attention mechanism and / or CA attention mechanism to construct a hybrid weighted attention mechanism module.
[0014] Optionally, the feature extraction and feature fusion networks of the YOLOv7-tiny network are improved based on a hybrid weighted attention mechanism module, and an adaptive decoupled detection head is used for feature decoding and prediction of the YOLOv7-tiny network to obtain an improved YOLOv7-tiny defect detection model, including:
[0015] The insulator defect images in the insulator defect image dataset are input into the feature extraction network of the YOLOv7-tiny network;
[0016] The shallow, medium, and deep features extracted by the feature extraction network are respectively input into the feature fusion network of the YOLOv7-tiny network for feature enhancement;
[0017] The enhanced features obtained after feature fusion network feature enhancement are input into the adaptive decoupled detection head for decoding and prediction.
[0018] Optionally, the adaptive decoupled detection head includes four 1×1 convolutional layers and four 3×3 convolutional layers. The first convolutional layer is used to unify the input features to 128 dimensions. The four 3×3 convolutional layers are paired up to independently and in parallel process the target classification and localization tasks of insulator defects. The last three 1×1 convolutional layers output the detection target category vector, the detection box coordinate vector, and the detection box confidence vector, respectively.
[0019] Optionally, the improved YOLOv7-tiny defect detection model is trained and tested based on an insulator defect image dataset to obtain a target insulator defect detection model, including:
[0020] The insulator defect image dataset constructed based on the ALCNet data augmentation module was divided into training set, validation set and test set in a ratio of 8:1:1, and the training set, validation set and test set were normalized to a size of 640×640.
[0021] The K-means clustering algorithm was used to obtain the target box size in the training set sample labels. The target box size includes the width and height of the target box. There are 9 clusters.
[0022] The improved YOLOv7-tiny defect detection model was trained using the COCO dataset to obtain the pre-trained model;
[0023] The pre-trained model was trained and validated using training and validation sets. During the first 100 training rounds, the batch size was set to 8 and the learning rate to 10. -2 The feature fusion network and adaptive decoupling detection head of the improved YOLOv7-tiny defect detection model were trained and validated based on the weights of the pre-trained model. In the last 100 training rounds, the batch size was set to 2 and the learning rate to 10. -3 The improved YOLOv7-tiny defect detection model was trained and validated.
[0024] The improved YOLOv7-tiny defect detection model after training is tested using a test set. If the test is passed, the target insulator defect detection model is obtained. If the test is failed, the insulator defect image dataset is reconstructed.
[0025] A second aspect of the present invention provides an embodiment of a rapid insulator defect detection system based on YOLO-MID, comprising:
[0026] A dataset construction unit is used to construct an insulator defect image dataset based on the Fmix data augmentation method, which is based on ALCNet local contrast enhancement processing.
[0027] Attention mechanism building unit, used to build hybrid weighted attention mechanism modules;
[0028] The detection model improvement unit is used to improve the feature extraction network and feature fusion network of the YOLOv7-tiny network based on the hybrid weighted attention mechanism module. It adopts an adaptive decoupled detection head to perform feature decoding and prediction of the YOLOv7-tiny network, thereby obtaining an improved YOLOv7-tiny defect detection model.
[0029] The detection model training unit is used to train and test the improved YOLOv7-tiny defect detection model based on the insulator defect image dataset to obtain the target insulator defect detection model.
[0030] The defect detection unit is used to input the acquired image of the insulator to be detected into the target insulator defect detection model to obtain the insulator defect detection result.
[0031] Optionally, the attention mechanism building unit is specifically used for:
[0032] By setting random probabilities and adaptively obtaining a set of optimal weight parameters based on the particle swarm optimization algorithm, the optimal weight parameters are used as inputs to the CBAM attention mechanism and / or CA attention mechanism to construct a hybrid weighted attention mechanism module.
[0033] Optionally, the detection model improvement unit is specifically used for:
[0034] The insulator defect images in the insulator defect image dataset are input into the feature extraction network of the YOLOv7-tiny network;
[0035] The shallow, medium, and deep features extracted by the feature extraction network are respectively input into the feature fusion network of the YOLOv7-tiny network for feature enhancement;
[0036] The enhanced features obtained after feature fusion network feature enhancement are input into the adaptive decoupled detection head for decoding and prediction.
[0037] Optionally, the adaptive decoupled detection head includes four 1×1 convolutional layers and four 3×3 convolutional layers. The first convolutional layer is used to unify the input features to 128 dimensions. The four 3×3 convolutional layers are paired up to independently and in parallel process the target classification and localization tasks of insulator defects. The last three 1×1 convolutional layers output the detection target category vector, the detection box coordinate vector, and the detection box confidence vector, respectively.
[0038] Optionally, the detection model training unit is specifically used for:
[0039] The insulator defect image dataset constructed based on the ALCNet data augmentation module was divided into training set, validation set and test set in a ratio of 8:1:1, and the training set, validation set and test set were normalized to a size of 640×640.
[0040] The K-means clustering algorithm was used to obtain the target box size in the training set sample labels. The target box size includes the width and height of the target box. There are 9 clusters.
[0041] The improved YOLOv7-tiny defect detection model was trained using the COCO dataset to obtain the pre-trained model;
[0042] The pre-trained model was trained and validated using training and validation sets. During the first 100 training rounds, the batch size was set to 8 and the learning rate to 10. -2 The feature fusion network and adaptive decoupling detection head of the improved YOLOv7-tiny defect detection model were trained and validated based on the weights of the pre-trained model. In the last 100 training rounds, the batch size was set to 2 and the learning rate to 10. -3 The improved YOLOv7-tiny defect detection model was trained and validated.
[0043] The improved YOLOv7-tiny defect detection model after training is tested using a test set. If the test is passed, the target insulator defect detection model is obtained. If the test is failed, the insulator defect image dataset is reconstructed.
[0044] As can be seen from the above technical solutions, the rapid insulator defect detection method based on YOLO-MID provided by this invention has the following advantages:
[0045] The present invention provides a fast insulator defect detection method based on YOLO-MID. On the one hand, it constructs an insulator defect image dataset based on the ALCNet data augmentation method, which can enhance the contrast of defect areas such as insulator pollution flashover and corrosion while broadening the sample, thereby improving the detection accuracy of the model in practical applications and improving the detection accuracy of insulator corrosion and pollution flashover defects. On the other hand, it improves the feature extraction network of the YOLOv7-tiny model based on a hybrid weighted attention mechanism, and improves the feature fusion network of the YOLOv7-tiny model based on a hybrid weighted attention mechanism and depthwise separable convolution. Then, it introduces an AD-Head adaptive decoupled detection head to realize feature decoding prediction, resulting in a YOLOv7-tiny defect detection model improved based on a hybrid weighted attention mechanism. The improved YOLOv7-tiny defect detection model achieves accurate and fast insulator detection, solving the technical problems of poor detection capability of existing insulator defect detection methods for small target defects and low detection accuracy for insulator corrosion and pollution flashover defects.
[0046] The YOLO-MID-based rapid insulator defect detection system provided by this invention is used to execute the YOLO-MID-based rapid insulator defect detection method provided by this invention. Its principle and the technical effects achieved are the same as those of the YOLO-MID-based rapid insulator defect detection method provided by this invention, and will not be repeated here. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a flowchart illustrating the rapid insulator defect detection method based on YOLO-MID provided in this embodiment of the invention.
[0049] Figure 2 This is a schematic diagram of the hybrid weighted attention mechanism module provided in an embodiment of the present invention;
[0050] Figure 3 This is a schematic diagram of the structure of the improved YOLOv7-tiny defect detection model provided in this embodiment of the invention;
[0051] Figure 4 This is a schematic diagram of the adaptive decoupling detection head network structure provided in an embodiment of the present invention;
[0052] Figure 5This is a schematic diagram of the structure of the YOLO-MID-based rapid insulator defect detection system provided in an embodiment of the present invention. Detailed Implementation
[0053] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0054] YOLO-MID: YOLOv7-tiny for Multiple Insulator Defect, a model for detecting multiple insulator defects based on the YOLOv7-tiny model.
[0055] For easier understanding, please refer to Figure 1 This invention provides an embodiment of a rapid insulator defect detection method based on YOLO-MID, comprising:
[0056] Step 101: Construct an insulator defect image dataset using the Fmix data augmentation method based on ALCNet local contrast enhancement processing.
[0057] It should be noted that the daily inspection record image samples were obtained through drones, cameras, and other equipment, including various styles, shooting angles, lighting conditions, and weather conditions of insulator defect images. 200 images of various insulator defects, including spontaneous explosion, breakage, flashover, corrosion, and string drop, were selected. LabelImg was used to create tags, sequentially labeling the defect areas of each type of insulator image as "zibao,posun,wushan,xiushi,diaochuan", automatically generating .xml tag files.
[0058] To enhance the local contrast of insulator defect regions and expand the data sample, the Attentional Local Contrast Networks with Fmix (ALCNF) data augmentation method, which uses ALCNet for local contrast enhancement, is employed for image augmentation. Specifically:
[0059] (1) Constructing an expanded local contrast module: For an insulator feature map F with input size C×H×W, at any position (c,i,j) and expansion rate d, the scalar local contrast is... Defined as:
[0060]
[0061] The final local contrast enhancement map (DFL) under the expansion ratio d condition is as follows:
[0062]
[0063] in, For the directional scalar local contrast at any position (c,i,j), F [c,i,j] D is the characteristic diagram of the insulator at position (c,i,j). (x,y) This is a local contrast enhancement image under the condition of expansion ratio d, S (x,y) Let F be the linear transformation function used to transform (x,y) into (y,x). [c,i-x,j-y] For the insulator characteristic diagram at position (c,ix,jy), F [c,i+x,j+y] Let DLC(F,d) be the feature map of the insulator at position (c,i+x,j+y). The local contrast enhancement maps under different expansion rates d are concat-stacked, and then dimensionality is reduced using scale max-pooling. Finally, the final local contrast enhancement map DFL is output after compression (squeeze).
[0064] (2) Construct a cross-layer BLAM (Bottom-up LocalAttentionalModule): Perform two point-wise convolutions on the input insulator feature map X, process it with the Sigmoid activation function, and then multiply it with the upsampled feature map Y to obtain a local aggregated feature map. Then, stack it with the feature map X to obtain a cross-layer feature fusion image.
[0065] (3) Constructing the ALCNet (Attentional Local Contrast Networks) local contrast enhancement module: For the input insulator image, firstly, dimensionality reduction is performed using ordinary convolution Conv, then downsampling and feature extraction are performed through three Stage modules, and the output of each Stage module is processed by DLC (dilated local contrast) and then feature fusion is performed using a cross-layer BLAM module, finally outputting the insulator image with enhanced local contrast.
[0066] (4) Randomly select two different images A and B from the images after ALCNet local contrast enhancement processing, and randomly determine their weights λ from the β distribution.
[0067] (5) Randomly crop image A and stack it with image B with weight λ to obtain mixed image C. Then apply random transformation to mixed image C to obtain image enhanced by ALCNF.
[0068] (6) Call the CreateXML function to create the XML tag file after the image has been transformed.
[0069] Finally, augmented insulator defect images and labels based on the ALCNF data augmentation method were obtained. Together with the original 1,000 collected insulator defect images, they were used to construct the insulator defect detection network model training and testing dataset, totaling 2,000 images.
[0070] Step 102: Construct a hybrid weighted attention mechanism module.
[0071] It should be noted that this embodiment of the invention designs a hybrid weighted attention mechanism module (PSO2C module for short), which can adaptively find the optimal weight as the input of the attention mechanism based on each vector feature. Furthermore, by randomly selecting the attention mechanism, it can overcome the imbalance between global and local information, achieving adaptive adjustment of the importance of local regions. The specific structure is as follows: Figure 2 As shown. The hybrid weighted attention mechanism module consists of a weighted CBAM attention mechanism and a CA attention mechanism. A random probability α is set to 0.5, and a set of optimal weight parameters is adaptively obtained using the PSO algorithm as input to the CBAM attention mechanism and / or the CA attention mechanism. This hybrid attention mechanism enhances the model's focus on the insulator image feature layer. Specifically:
[0072] The process of adaptively obtaining a set of optimal weight parameters using the PSO algorithm is as follows:
[0073] S1. In the particle swarm optimization algorithm, each particle is represented by a weight vector using real number encoding, and the size of each weight vector is defined.
[0074] S2. Initialize a particle swarm randomly using a normal distribution, and determine the position and velocity of each particle. The position represents the current weight vector, and the velocity represents the search direction and speed.
[0075] S3. Using the weight vector of each particle as indirect input, the value of the objective function calculated based on the minimum loss function is used as the fitness function, reflecting the performance of each weight vector. The fitness function calculation formula is:
[0076]
[0077] Where y is the true label, p is the predicted value, and N is the number of target categories;
[0078] S4. Based on the historical best position and the global best position of each particle, update the velocity and position of each particle to move it closer to the global best position. Simultaneously, introduce an inertia weight to balance the impact of the two update methods, thus avoiding premature entry into local optima.
[0079] The formulas for updating particle velocity and position are:
[0080]
[0081] in, c1 and c2 are learning factors, usually set to 2. `rand()` generates a random number between 0 and 1. `pbest` is the inertia factor. i and gbest i Let v be the extreme value during the tracking process of the i-th particle. i Let x be the velocity of the i-th particle. i Let G be the current position of the i-th particle, i.e., the weight vector. k Let g be the maximum number of iterations, and g be the current number of iterations. and The initial inertia weight and the inertia weight at the maximum number of iterations are 0.9 and 0.4, respectively.
[0082] S5. Iteratively update the velocity and position of each particle, calculate the fitness function, and find the global optimal solution;
[0083] S6. After the iteration is complete, the weight vector corresponding to the global optimal position can be used as the optimal weight parameters of the attention module.
[0084] The CBAM attention mechanism consists of channel attention and spatial attention mechanisms. In the CBAM channel attention network, the weighted insulator feature map with input size H×W×C is processed by global max pooling and global average pooling to obtain a feature map with size 1×1×C. This 1×1×C feature map is then input into a shared MLP neural network, processed, activated by the Sigmoid activation function, and multiplied by the input H×W×C feature map to obtain the insulator feature map processed by the channel attention mechanism. In the spatial attention network, the insulator feature map processed by the channel attention mechanism is used as input, and it is sequentially processed by global max pooling and global average pooling. The resulting pooled feature map is then reduced in dimensionality using a 7×7 convolution, activated by the Sigmoid activation function, and multiplied by the input channel attention-processed insulator feature map to obtain the insulator feature map processed by the weighted CBAM attention mechanism.
[0085] The principle of the CA attention mechanism is to utilize features in the horizontal (W direction) and vertical (H direction) directions to obtain spatial location information and its attention, thereby enhancing the model's focus on insulator defect regions. The processing involves using global pooling with kernel sizes of (H,1) and (1,W) to extract location information for each channel along the horizontal and vertical directions, respectively. The calculation formula is as follows:
[0086]
[0087] Where, x c (i,j) represents the feature information at position i and j in the c-th channel, which also represents the original input feature map of the CA attention module; x c (j, w) represents the feature information at the c-th channel with width w; z c For the positional features on channel c, x c (h,i) represents the feature information at the c-th channel with height h; the total height of the feature map is H, and the total width is W. and These represent the positional features of the width w and the c-th channel, respectively, and the positional features of the height h and the c-th channel.
[0088] Then, the spatial location features in the horizontal and vertical directions are fused and convolutionally transformed. The calculation formula is as follows:
[0089] f = δ(f1[cat(z) h ,z w )])
[0090] Where δ is a nonlinear activation function, f∈R c / r×(H+W) This is an intermediate feature map encoding spatial information in the horizontal and vertical directions. r controls the reduction ratio of the feature channel size c, f1 represents a 1×1 convolution operation, cat(·) represents concatenated stacking of features, and z... h For the positional features in the vertical direction, z w The horizontal positional feature is then segmented into two independent vectors f along the horizontal and vertical directions. w and f h Then, two 1×1 convolutions and a sigmoid activation function are used to process the data to obtain the attention weights in the horizontal and vertical directions. Finally, these weights are multiplied by the original input to obtain the final output y of the CA attention module. The calculation formula is as follows:
[0091]
[0092] in, and Let represent the vertical and horizontal attention directions on channel c, respectively, and σ be the sigmoid activation function; and These represent the 1×1 convolution operations used in the vertical and horizontal directions, respectively; y c (i,j) represents the final output of the CA attention module. Let be the attention weight in the vertical direction at position i. Let j be the attention weight in the horizontal direction at position j.
[0093] Step 103: Improve the feature extraction network and feature fusion network of YOLOv7-tiny network based on the hybrid weighted attention mechanism module, and use the adaptive decoupled detection head to perform feature decoding and prediction of YOLOv7-tiny network to obtain the improved YOLOv7-tiny defect detection model.
[0094] It should be noted that, to improve the small target detection capability of the YOLOv7-tiny model, this invention improves the feature extraction network (Backbone) based on the hybrid weighted attention mechanism module (i.e., the PSO2C module) constructed in step 102, and improves the feature fusion network (Neck) based on the PSO2C module and depthwise separable convolution. Finally, an adaptive decoupled detection head (AD-Head) is used to achieve feature decoding and prediction. Based on the above three methods, the basic YOLOv7-tiny model is improved, resulting in an improved YOLOv7-tiny defect detection model for detecting various insulator defects. The improved YOLOv7-tiny defect detection model is as follows: Figure 3 As shown.
[0095] Specifically, the model improvement process is as follows:
[0096] T1. Input the insulator defect image into the feature extraction network (Backbone). First, it passes through two CBL modules (Conv layer, BN layer, Leaky_ReLU activation function) for feature compression. Then, it passes through an MCB multi-branch connection module for feature enhancement. After passing through an MCB module and a max pooling MP layer, shallow features FL are obtained. After passing through an MCB module and an MP layer, the mid-level features FM are extracted. Finally, deep features FS are extracted through an MP layer and a PSO2C module.
[0097] T2. The shallow, mid-level, and deep features FL, FM, and FS extracted by the feature extraction network (Backbone) are input into the feature fusion network (Neck) for feature enhancement. First, feature FS is enhanced by SPC (Spatial Pyramid Pooling) to obtain F′S. Then, it is processed by the DBL module (DConv layer, BN layer, Leaky_ReLU activation function) and the PSO2C module. It is then stacked with FM processed by the DBL module and processed by the MCB module to obtain feature map F′M. Then, it is processed by the DBL module and the PSO2C module. The processed feature map is stacked with FL processed by the PSO2C module and processed by the MCB module to obtain enhanced feature Y1. Subsequently, the enhanced feature Y1 is downsampled by the PSO2C module, stacked with feature map F′M, and processed by the MCB module to obtain enhanced feature Y2. Finally, the enhanced feature Y2 is downsampled by the PSO2C module, stacked with deep feature F′S, and processed by the MCB module to obtain enhanced feature Y3.
[0098] T3. The enhanced features Y1, Y2, and Y3 obtained through the feature fusion network are all input into the adaptive decoupling detection head (AD-Head) for decoding and prediction. In this embodiment of the invention, the adaptive decoupling detection head includes four 1×1 convolutional layers and four 3×3 convolutional layers. The first convolutional layer is used to unify the input features to 128 dimensions. The four 3×3 convolutional layers are paired up to independently and in parallel process the target classification and localization tasks of insulator defects. The last three 1×1 convolutional layers output the detection target category vector, the detection box coordinate vector, and the detection box confidence vector, respectively. Figure 4 As shown, the input features are first unified to 128 dimensions through a 1×1 convolutional layer to fuse feature information and reduce computation. Then, two 3×3 convolutional layers are used independently and in parallel to process the target classification and localization tasks of insulator defects. This achieves feature decoupling and channel attention, allowing the model to better capture the global and local features of the insulator target, thereby better distinguishing the target from the background and improving the model's detection accuracy and robustness. The target localization branch also includes the calculation of the prediction box confidence. Finally, three 1×1 convolutions are used to output the detected target category (Cls) vector, the detection box coordinates (Obj) vector, and the detection box confidence (Reg) vector, respectively.
[0099] Step 104: Train and test the improved YOLOv7-tiny defect detection model based on the insulator defect image dataset to obtain the target insulator defect detection model.
[0100] It should be noted that the improved YOLOv7-tiny defect detection model was trained and tested based on an insulator defect image dataset. The specific process is as follows:
[0101] The insulator defect image dataset constructed based on the ALCNet data augmentation module was divided into training set, validation set and test set in a ratio of 8:1:1, and the training set, validation set and test set were normalized to a size of 640×640.
[0102] The K-means clustering algorithm is used to obtain the target box size in the training set sample labels. The target box size includes the width and height of the target box. There are 9 clusters, which determines the size of the prior box during model training, corresponding to three scales: deep, medium and shallow, to assist the model in target localization.
[0103] The improved YOLOv7-tiny defect detection model was trained using the COCO dataset to obtain the pre-trained model;
[0104] The pre-trained model was trained and validated using training and validation sets. During the first 100 training rounds, the batch size was set to 8 and the learning rate to 10. -2 The feature fusion network and adaptive decoupling detection head of the improved YOLOv7-tiny defect detection model were trained and validated based on the weights of the pre-trained model. In the last 100 training rounds, the batch size was set to 2 and the learning rate to 10. -3 The improved YOLOv7-tiny defect detection model was trained and validated.
[0105] The improved YOLOv7-tiny defect detection model after training is tested using a test set. If the test is passed, the target insulator defect detection model is obtained. If the test is failed, the insulator defect image dataset is reconstructed.
[0106] Step 105: Input the acquired image of the insulator to be inspected into the target insulator defect detection model to obtain the insulator defect detection result.
[0107] It should be noted that after determining the target insulator defect detection model, the collected image of the insulator to be detected is input into the target insulator defect detection model to obtain the insulator defect detection result.
[0108] The present invention provides a fast insulator defect detection method based on YOLO-MID. On the one hand, it constructs an insulator defect image dataset based on the ALCNet data augmentation method, which can enhance the contrast of defect areas such as insulator pollution flashover and corrosion while broadening the sample, thereby improving the detection accuracy of the model in practical applications and improving the detection accuracy of insulator corrosion and pollution flashover defects. On the other hand, it improves the feature extraction network of the YOLOv7-tiny model based on a hybrid weighted attention mechanism, and improves the feature fusion network of the YOLOv7-tiny model based on a hybrid weighted attention mechanism and depthwise separable convolution. Then, it introduces an AD-Head adaptive decoupled detection head to realize feature decoding prediction, resulting in a YOLOv7-tiny defect detection model improved based on a hybrid weighted attention mechanism. The improved YOLOv7-tiny defect detection model achieves accurate and fast insulator detection, solving the technical problems of poor detection capability of existing insulator defect detection methods for small target defects and low detection accuracy for insulator corrosion and pollution flashover defects.
[0109] For easier understanding, please refer to Figure 5 This invention provides an embodiment of a rapid insulator defect detection system based on YOLO-MID, comprising:
[0110] A dataset construction unit is used to construct an insulator defect image dataset based on the Fmix data augmentation method, which is based on ALCNet local contrast enhancement processing.
[0111] Attention mechanism building unit, used to build hybrid weighted attention mechanism modules;
[0112] The detection model improvement unit is used to improve the feature extraction network and feature fusion network of the YOLOv7-tiny network based on the hybrid weighted attention mechanism module. It adopts an adaptive decoupled detection head to perform feature decoding and prediction of the YOLOv7-tiny network, thereby obtaining an improved YOLOv7-tiny defect detection model.
[0113] The detection model training unit is used to train and test the improved YOLOv7-tiny defect detection model based on the insulator defect image dataset to obtain the target insulator defect detection model.
[0114] The defect detection unit is used to input the acquired image of the insulator to be detected into the target insulator defect detection model to obtain the insulator defect detection result.
[0115] The attention mechanism building unit is specifically used for:
[0116] By setting random probabilities and adaptively obtaining a set of optimal weight parameters based on the particle swarm optimization algorithm, the optimal weight parameters are used as inputs to the CBAM attention mechanism and / or CA attention mechanism to construct a hybrid weighted attention mechanism module.
[0117] The detection model improvement unit is specifically used for:
[0118] The insulator defect images in the insulator defect image dataset are input into the feature extraction network of the YOLOv7-tiny network;
[0119] The shallow, medium, and deep features extracted by the feature extraction network are respectively input into the feature fusion network of the YOLOv7-tiny network for feature enhancement;
[0120] The enhanced features obtained after feature fusion network feature enhancement are input into the adaptive decoupled detection head for decoding and prediction.
[0121] The adaptive decoupled detection head consists of four 1×1 convolutional layers and four 3×3 convolutional layers. The first convolutional layer unifies the input features to 128 dimensions. The four 3×3 convolutional layers are paired up to independently and in parallel process the target classification and localization tasks of insulator defects. The last three 1×1 convolutional layers output the detection target category vector, the detection box coordinate vector, and the detection box confidence vector, respectively.
[0122] The detection model training unit is specifically used for:
[0123] The insulator defect image dataset constructed based on the ALCNet data augmentation module was divided into training set, validation set and test set in a ratio of 8:1:1, and the training set, validation set and test set were normalized to a size of 640×640.
[0124] The K-means clustering algorithm was used to obtain the target box size in the training set sample labels. The target box size includes the width and height of the target box. There are 9 clusters.
[0125] The improved YOLOv7-tiny defect detection model was trained using the COCO dataset to obtain the pre-trained model;
[0126] The pre-trained model was trained and validated using training and validation sets. During the first 100 training rounds, the batch size was set to 8 and the learning rate to 10. -2 The feature fusion network and adaptive decoupling detection head of the improved YOLOv7-tiny defect detection model were trained and validated based on the weights of the pre-trained model. In the last 100 training rounds, the batch size was set to 2 and the learning rate to 10. -3The improved YOLOv7-tiny defect detection model was trained and validated.
[0127] The improved YOLOv7-tiny defect detection model after training is tested using a test set. If the test is passed, the target insulator defect detection model is obtained. If the test is failed, the insulator defect image dataset is reconstructed.
[0128] The YOLO-MID-based rapid insulator defect detection system provided by this invention is used to execute the YOLO-MID-based rapid insulator defect detection method provided by this invention. Its principle and the technical effects achieved are the same as those of the YOLO-MID-based rapid insulator defect detection method provided by this invention, and will not be repeated here.
[0129] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A rapid insulator defect detection method based on YOLO-MID, characterized in that, include: A dataset of insulator defect images was constructed using the Fmix data enhancement method based on ALCNet local contrast enhancement processing. Construct a hybrid weighted attention mechanism module; The feature extraction and feature fusion networks of the YOLOv7-tiny network are improved based on the hybrid weighted attention mechanism module. An adaptive decoupled detection head is used to perform feature decoding and prediction of the YOLOv7-tiny network, resulting in an improved YOLOv7-tiny defect detection model. The improved YOLOv7-tiny defect detection model was trained and tested based on the insulator defect image dataset to obtain the target insulator defect detection model. The collected images of the insulators to be inspected are input into the target insulator defect detection model to obtain the insulator defect detection results; Construct a hybrid weighted attention mechanism module, including: By setting random probabilities and adaptively obtaining a set of optimal weight parameters based on the particle swarm optimization algorithm, the optimal weight parameters are used as inputs to the CBAM attention mechanism and / or CA attention mechanism to construct a hybrid weighted attention mechanism module. The adaptive decoupled detection head consists of four 1×1 convolutional layers and four 3×3 convolutional layers. The first convolutional layer unifies the input features to 128 dimensions. The four 3×3 convolutional layers are paired up to independently and in parallel process the target classification and localization tasks of insulator defects. The last three 1×1 convolutional layers output the detection target category vector, the detection box coordinate vector, and the detection box confidence vector, respectively.
2. The rapid insulator defect detection method based on YOLO-MID according to claim 1, characterized in that, An improved YOLOv7-tiny defect detection model is obtained by improving the feature extraction and feature fusion networks of the YOLOv7-tiny network based on a hybrid weighted attention mechanism module, and using an adaptive decoupled detection head for feature decoding and prediction of the YOLOv7-tiny network, including: The insulator defect images in the insulator defect image dataset are input into the feature extraction network of the YOLOv7-tiny network; The shallow, medium, and deep features extracted by the feature extraction network are respectively input into the feature fusion network of the YOLOv7-tiny network for feature enhancement; The enhanced features obtained after feature fusion network feature enhancement are input into the adaptive decoupled detection head for decoding and prediction.
3. The rapid insulator defect detection method based on YOLO-MID according to claim 1, characterized in that, The improved YOLOv7-tiny defect detection model was trained and tested based on an insulator defect image dataset to obtain a target insulator defect detection model, including: The insulator defect image dataset constructed based on the ALCNet data augmentation module was divided into training set, validation set and test set in a ratio of 8:1:1, and the training set, validation set and test set were normalized to a size of 640×640. The K-means clustering algorithm was used to obtain the target box size in the training set sample labels. The target box size includes the width and height of the target box. There are 9 clusters. The improved YOLOv7-tiny defect detection model was trained using the COCO dataset to obtain the pre-trained model; The pre-trained model was trained and validated using training and validation sets. During the first 100 training rounds, the batch size was set to 8, and the learning rate was [missing information]. The feature fusion network and adaptive decoupling detection head of the improved YOLOv7-tiny defect detection model were trained and validated based on the weights of the pre-trained model. During the last 100 training rounds, the batch size was set to 2, and the learning rate was [missing information]. The improved YOLOv7-tiny defect detection model was trained and validated. The improved YOLOv7-tiny defect detection model after training is tested using a test set. If the test is passed, the target insulator defect detection model is obtained. If the test is failed, the insulator defect image dataset is reconstructed.
4. A rapid insulator defect detection system based on YOLO-MID, characterized in that, include: A dataset construction unit is used to construct an insulator defect image dataset based on the Fmix data augmentation method, which is based on ALCNet local contrast enhancement processing. Attention mechanism building unit, used to build hybrid weighted attention mechanism modules; The detection model improvement unit is used to improve the feature extraction network and feature fusion network of the YOLOv7-tiny network based on the hybrid weighted attention mechanism module. It adopts an adaptive decoupled detection head to perform feature decoding and prediction of the YOLOv7-tiny network, thereby obtaining an improved YOLOv7-tiny defect detection model. The detection model training unit is used to train and test the improved YOLOv7-tiny defect detection model based on the insulator defect image dataset to obtain the target insulator defect detection model. The defect detection unit is used to input the acquired image of the insulator to be detected into the target insulator defect detection model to obtain the insulator defect detection result; The attention mechanism building unit is specifically used for: By setting random probabilities and adaptively obtaining a set of optimal weight parameters based on the particle swarm optimization algorithm, the optimal weight parameters are used as inputs to the CBAM attention mechanism and / or CA attention mechanism to construct a hybrid weighted attention mechanism module. The adaptive decoupled detection head consists of four 1×1 convolutional layers and four 3×3 convolutional layers. The first convolutional layer unifies the input features to 128 dimensions. The four 3×3 convolutional layers are paired up to independently and in parallel process the target classification and localization tasks of insulator defects. The last three 1×1 convolutional layers output the detection target category vector, the detection box coordinate vector, and the detection box confidence vector, respectively.
5. The rapid insulator defect detection system based on YOLO-MID according to claim 4, characterized in that, The detection model improvement unit is specifically used for: The insulator defect images in the insulator defect image dataset are input into the feature extraction network of the YOLOv7-tiny network; The shallow, medium, and deep features extracted by the feature extraction network are respectively input into the feature fusion network of the YOLOv7-tiny network for feature enhancement; The enhanced features obtained after feature fusion network feature enhancement are input into the adaptive decoupled detection head for decoding and prediction.
6. The rapid insulator defect detection system based on YOLO-MID according to claim 4, characterized in that, The detection model training unit is specifically used for: The insulator defect image dataset constructed based on the ALCNet data augmentation module was divided into training set, validation set and test set in a ratio of 8:1:1, and the training set, validation set and test set were normalized to a size of 640×640. The K-means clustering algorithm was used to obtain the target box size in the training set sample labels. The target box size includes the width and height of the target box. There are 9 clusters. The improved YOLOv7-tiny defect detection model was trained using the COCO dataset to obtain the pre-trained model; The pre-trained model was trained and validated using training and validation sets. During the first 100 training rounds, the batch size was set to 8, and the learning rate was [missing information]. The feature fusion network and adaptive decoupling detection head of the improved YOLOv7-tiny defect detection model were trained and validated based on the weights of the pre-trained model. During the last 100 training rounds, the batch size was set to 2, and the learning rate was [missing information]. The improved YOLOv7-tiny defect detection model was trained and validated. The improved YOLOv7-tiny defect detection model after training is tested using a test set. If the test is passed, the target insulator defect detection model is obtained. If the test is failed, the insulator defect image dataset is reconstructed.
Citation Information
Patent Citations
Insulator defect detection model construction method and system
CN115063648A
Aerial insulator image defect detection method based on YOLOv5 algorithm
CN116468730A