Insulator detection method and system based on rotary detection frame
By introducing a rotation detection frame and a global attention mechanism into insulator detection, the problem of inaccurate target area definition and excessive redundant information in horizontal detection frames when detecting slender insulators is solved, achieving higher detection accuracy and efficiency. .
Patent Information
- Application Number
- CN202410595085.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing online detection methods for insulators on high-voltage lines, when the horizontal detection frame detects slender and directional insulators, there are problems such as inaccurate target area definition and excessive redundant information, which increases the difficulty of defect detection.
Introduce the parameters of the rotation detection frame and the global attention mechanism, improve the YOLOv5 network, enhance the feature extraction capabilities through the rotation detection frame and the global attention module, and reduce the missed detection rate and redundant information.
It improves the accuracy and efficiency of insulator detection, reduces redundant information in detection results, reduces the missed detection rate, and improves detection efficiency.
Smart Images

Figure CN118537533A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an insulator detection method and system based on a rotating detection frame. Background Art
[0002] Insulators are basic equipment used for electrical isolation and mechanical fixation of wires in high-voltage transmission systems. The failure of insulators directly threatens the stability and safety of transmission lines. Therefore, the service condition of insulators is inspected to ensure the safe operation of the power system.
[0003] The existing online detection methods for insulators on high-voltage lines are mainly methods that combine machine vision and artificial intelligence. In the intelligent identification of insulator targets, a horizontal detection frame detection method is mostly used. However, when the horizontal detection frame detects slender and directional targets such as insulators, there is a problem of inaccurate definition of the insulator target area, which is manifested in that the detection frame often contains many background areas, which greatly increases the difficulty of subsequent defect detection.
[0004] Patents with publication numbers CN116402783A, CN116402783A and CN117036363B all use a horizontal detection frame detection method when detecting insulators. Insulators on transmission lines are distributed in strings along the line and have obvious directionality. When a horizontal detection frame detects such a slender and directional target, the detection frame often contains many background areas, resulting in an inaccurate representation of the insulator target range. This will not only greatly increase the difficulty of subsequent defect classification detection, but also cause a strong overlap between detection frames. Summary of the invention
[0005] In view of the shortcomings of the existing methods, the present invention adds a parameter for describing the rotation angle of the detection frame on the basis of the horizontal detection frame to solve the problem that the detection frame contains a large amount of redundant information during insulator detection; at the same time, a global attention mechanism is introduced to enhance the feature extraction capability to cope with the technical problem of missed detection of insulators during the detection process.
[0006] The technical solution adopted by the present invention is: an insulator detection method based on a rotating detection frame comprises the following steps:
[0007] Step 1: Construct an insulator image dataset, and perform annotation and dataset division;
[0008] As a preferred implementation of the present invention, when labeling the insulator image, the software tool X-Anylabeling is used to obtain the rotation angle parameter of the rotation detection frame.
[0009] Step 2: Improve the YOLOv5 network by introducing a global attention module after the SPPF module in the feature extraction layer to enhance the feature extraction capability and reduce the missed detection rate.
[0010] As a preferred embodiment of the present invention, the global attention module includes a channel attention module and a spatial attention module. The channel attention module performs dimensionality conversion on the input feature map F1, and then inputs it into the two-layer MLP to amplify the dependency between the channel and the space, and converts it to the original dimension and then performs Sigmoid normalization processing.
[0011] As a preferred embodiment of the present invention, the spatial attention module first reduces the number of channels through a 7×7 convolution; then increases the number of channels through a 7×7 convolution operation, and finally undergoes Sigmoid normalization processing.
[0012] Step 3: Replace the C3 module in the feature fusion layer with the C3_Fast module;
[0013] As a preferred embodiment of the present invention, the C3_Fast module reconstructs the residual module in the C3 module, converting the first or last continuous channel c of the feature map of the input size [h, w, c] p The entire feature map is considered for convolution.
[0014] Step 4: Divide the feature map of the input detection head into several grids, and each grid outputs a vector containing the coordinates of the center point of the horizontal detection box, the width and height of the horizontal detection box, and the detection box rotation angle and other predicted value information; use the predicted value of the detection box rotation angle to calculate the probability value of the angle; calculate the total loss;
[0015] As a preferred embodiment of the present invention, the probability value y corresponding to the rotation angle of the detection frame i The calculation formula is:
[0016]
[0017] Among them, θ is the angle value of the rotation of the annotated detection box, r is the radius of the angle classification error, and q i The predicted value of the current angle classification category.
[0018] As a preferred embodiment of the present invention, the calculation formula of the total loss is:
[0019] Loss=Loss bbox +Loss clas +Loss conf +Loss θ ;
[0020] Among them, Loss clasis the category classification loss, Loss conf is the confidence loss, Loss θ is the angle classification loss, Loss bbox is the horizontal detection box regression loss.
[0021] As a preferred implementation of the present invention, accuracy and recall are used as evaluation indicators of the improved YOLOv5 network.
[0022] As a preferred embodiment of the present invention, an insulator detection system based on a rotating detection frame includes: a memory for storing instructions executable by a processor; and a processor for executing the instructions to implement an insulator detection method based on a rotating detection frame.
[0023] As a preferred embodiment of the present invention, a computer readable medium stores a computer program code, and when the computer program code is executed by a processor, an insulator detection method based on a rotating detection frame is implemented.
[0024] Beneficial effects of the present invention:
[0025] 1. When detecting insulators, which are slender and directional, the horizontal detection frame often contains many background areas, resulting in a lot of redundant information in the detection results, which increases the difficulty of subsequent defect detection and classification tasks. The rotation detection frame angle parameter is introduced to transform the horizontal detection frame into a rotation detection frame that better fits the direction of the insulator, reducing the redundant information in the detection results.
[0026] 2. In the feature pyramid network, by changing the convolution mode of the residual structure to partial convolution, the model calculation complexity after adding angle parameters is effectively neutralized, thereby improving the detection efficiency;
[0027] 3. The images of insulators taken by drones often have complex backgrounds. Therefore, a global attention mechanism is embedded in the feature extraction network to enhance the feature extraction capability and reduce the missed detection rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is the improved YOLOv5 structure diagram of the present invention;
[0029] Figure 2 is a schematic diagram of the structure of the global attention module of the present invention;
[0030] Figure 3 It is a schematic diagram of the structure of the C3_Fast module of the present invention;
[0031] Figure 4 It is a comparison chart of the recognition effects of the original image, the YOLOv5 model and the improved YOLOv5 model of the present invention. DETAILED DESCRIPTION
[0032] The present invention is further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore it only shows the components related to the present invention.
[0033] like Figure 1 As shown, an insulator detection method based on a rotating detection frame includes the following steps:
[0034] Step 1: Construct an insulator image dataset, and perform annotation and dataset division;
[0035] The insulator image dataset consists of 600 normal insulator images from the China Power Line Insulator Dataset (CPLID) and 120 normal insulator images selected from the Insulator Dataset (SFID) based on synthetic fog and improved YOLOv5;
[0036] The constructed insulator dataset is rotated and labeled and divided into training set and test set. The rotation box is to add the rotation box angle parameter θ on the basis of the horizontal detection box, and the label format of the labeled XML file is converted into (x1, y1, x2, y2, x3, y3, x4, y4, category) as the input of the model. Among them, (x1, y1, x2, y2, x3, y3, x4, y4) are the coordinates of the four points of the rotation labeling box, and the labeling category is normal insulator (normal). The labeling box is used to label the insulator according to its direction, and the rotation detection box angle parameter θ is obtained by using the X-Anylabeling software tool. The labeled dataset is divided into training set and test set according to the ratio of 8:2.
[0037] Step 2: Improve the YOLOv5 network by introducing a global attention module after the SPPF module of the feature extraction layer;
[0038] Insulators are large targets. In order to improve the accuracy of detecting large targets and prevent missed detections, a global attention module is introduced to provide accurate insulator features for the feature fusion layer.
[0039] like Figure 2 (a) is the global attention module, Figure 2 (b) is the channel attention module and Figure 2 (c) is the spatial attention module. The channel attention module first performs dimension conversion on the input feature map F1. The dimension-converted feature map will be input into a two-layer MLP (multi-layer perceptron) to amplify the dependency between the channel and the space, and then converted to the original dimension and Sigmoid normalized to output M c (F1);
[0040] The spatial attention module uses two convolutional layers to fuse spatial information and focus on spatial information. First, a 7×7 convolution is used to reduce the number of channels and the amount of calculation. Then, a 7×7 convolution operation is performed to increase the number of channels and keep the number of channels consistent. Finally, the output M is processed by Sigmoid normalization. s (F2).
[0041] The implementation mechanism of the global attention mechanism is as follows:
[0042]
[0043]
[0044] Among them, M c and M s is the operation function of the channel attention module and the spatial attention module of the global attention mechanism, It represents element-wise multiplication; F2 and F3 are the output feature maps.
[0045] like Figure 3 As shown in step 3, the C3 module in the feature fusion layer is replaced by the C3_Fast module. The C3_Fast module reconstructs the residual module in the C3 module and converts the first or last continuous channel c of the feature map of the input size [h,w,c] p The entire feature map is considered for convolution, which reduces the computational complexity and improves the detection efficiency;
[0046] Step 4: In the detection head, the feature map input to the detection head will be divided into several grids, and each grid outputs a [x, y, w, h, p0, p1, q2, …, q 181 ], where the confidence and category prediction values are p0, p1; this vector is used to calculate the category classification loss Loss clas , confidence loss Loss conf , Angle classification loss Loss θ And the horizontal detection box regression loss Loss bbox , adding up all the losses gives the final total loss value Loss, the formula is:
[0047] Loss=Loss bbox +Loss clas +Loss conf +Loss θ ;
[0048] Among them, the horizontal detection box loss Loss bbox The calculation of takes into account the overlapping area loss of the detection box, the center point distance loss, and the height and width loss, which can be expressed as:
[0049]
[0050] Among them, x, y, w, and h are the coordinates of the center point of the predicted horizontal detection box and the width and height of the horizontal detection box respectively. IOU is the intersection-over-union ratio of the real detection box and the predicted detection box. gt ,y gt is the center point coordinate of the real detection box, h gt and w gt is the height and width of the real detection box, ρ 2 (·) indicates calculating the Euclidean distance, h c and w c The width and height of the smallest detection box that encloses two horizontal detection boxes.
[0051] Category classification loss Loss clas , confidence loss Loss conf , Angle classification loss Loss θ The loss function is used L calculate:
[0052]
[0053] Among them, N is the number of classification categories, and the probability value of the current category is y i * It represents the true value of the current category (0 or 1);
[0054] By dividing the entire defined angle range into categories, the tilt angle θ is divided into 1 to 180 categories, and the angle of the detection frame is predicted, that is, the predicted value of the current angle classification category is q2,…,q 181 , calculate the probability value y of the current angle i for:
[0055]
[0056] Where θ is the angle value of the rotation of the annotated detection box, r is the radius of the angle classification error, in this example r = 2; q i is the predicted value of the current angle classification category.
[0057] Use the training set to train the rotated object detection network model:
[0058] The experimental environment of the present invention is Ubuntu 20.04 system, 6vCPU Intel (R) Xeon (R) Platinum 8350C CPU @ 2.60GHz with 42GB memory and NVIDIA GeForce RTX 3090 graphics card with 24GB video memory, deep learning framework is Pytorch 1.10.0, CUDA version 11.3, Python version 3.8.11, specific parameters epoch during training are 200, Batch_size value is 8, optimizer is Adam gradient descent, and learning rate is set to 0.0001. The training set is input into the algorithm for training, and the weight file of the training iteration is saved.
[0059] The test set images are input into the trained rotating target detection network model to predict the rotating insulator detection results: In this paper, the accuracy P and recall R are selected as the evaluation indicators of the rotating insulator image detection effect. The specific expressions are as follows:
[0060]
[0061]
[0062] Among them, TP (true positive) is the number of accurately identified positive samples; FP (false positive) is the number of accurately identified negative samples; FN (false negative) is the number of unidentified positive samples.
[0063] The images of the test set are input into the detection model with the training weight file. The model accuracy P is 90.1%, the recall rate R is 85.3%, and the calculation amount is 1.75*10 10 ; The final instance detection effect is as follows Figure 4 As shown, the results show that Figure 4 As shown in Example 1, the insulator detected using the rotating detection frame has less redundant information, and the reasoning time of Example 1 after improvement is 4.1ms, which is 8.9ms shorter than the 13ms before improvement. The improved C3_Fast module effectively improves the detection efficiency; Figure 4 The embedded global attention mechanism shown in Example 2 also has a good detection effect on smaller targets, effectively reducing the missed detection rate.
[0064] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.
Claims
1. An insulator detection method based on a rotating detection frame, It is characterized in that The following steps are involved: Step 1: Construct an insulator image dataset, and perform annotation and dataset division; Step 2: Improve the YOLOv5 network by introducing a global attention module after the SPPF module in the feature extraction layer to enhance the feature extraction capability and reduce the missed detection rate. Step 3: Replace the C3 module in the feature fusion layer with the C3_Fast module; Step 4: Divide the feature map of the input detection head into several grids, and each grid outputs a vector containing the coordinates of the center point of the horizontal detection box, the width and height of the horizontal detection box, and the predicted value of the rotation angle of the detection box; The predicted value of the rotation angle of the detection box is used to calculate the probability value of the angle; and the total loss is calculated.
2. The insulator detection method based on the rotating detection frame according to claim 1, It is characterized in that The global attention module includes a channel attention module and a spatial attention module. The channel attention module is used to input the feature map F 1 After dimensionality conversion, the image is input into the two-layer MLP to amplify the dependency between channels and space, and then converted to the original dimension and subjected to Sigmoid normalization.
3. The insulator detection method based on the rotating detection frame according to claim 2, It is characterized in that The spatial attention module first reduces the number of channels through a 7×7 convolution; then increases the number of channels through a 7×7 convolution operation, and finally undergoes Sigmoid normalization.
4. The insulator detection method based on the rotating detection frame according to claim 1, It is characterized in that The C3_Fast module reconstructs the residual module in the C3 module and converts the first or last continuous channel c of the feature map of the input size [h,w,c] p The entire feature map is considered for convolution.
5. The insulator detection method based on the rotating detection frame according to claim 1, It is characterized in that The probability value y of the angle corresponding to the rotation angle of the detection box i The calculation formula is: Among them, θ is the angle value of the rotation of the annotated detection box, r is the radius of the angle classification error, and q i The predicted value of the current angle.
6. The insulator detection method based on the rotating detection frame according to claim 1, It is characterized in that The formula for total loss is: Loss=Loss bbox +Loss clas +Loss conf +Loss θ ; Among them, Loss clas is the classification loss, Loss conf is the confidence loss, Loss θ is the angle classification loss, Loss bbox is the horizontal detection box regression loss.
7. The insulator detection method based on the rotating detection frame according to claim 1, It is characterized in that When labeling the insulator image, X-Anylabeling is used to obtain the rotation angle parameters of the rotation detection box.
8. The insulator detection method based on the rotating detection frame according to claim 1, It is characterized in that Use precision and recall as evaluation indicators for the improved YOLOv5 network.
9. Insulator detection system based on rotating detection frame, It is characterized in that include: a memory for storing instructions executable by a processor; A processor, configured to execute instructions to implement the insulator detection method based on a rotating detection frame as described in any one of claims 1 to 8.
10. A computer readable medium storing computer program code, It is characterized in that When the computer program code is executed by a processor, the computer program code implements the insulator detection method based on a rotating detection frame as described in any one of claims 1 to 8.
