Power transmission line foreign matter detection method based on improved YOLOv8
By improving the YOLOv8 network, introducing the receptive field attention convolution module and BRA-n attention mechanism, and replacing the loss function with Shape-IoU, the problem of poor detection accuracy of foreign objects in transmission lines has been solved, and higher detection accuracy and Faster model convergence.
Patent Information
- Application Number
- CN202411470729.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art has poor accuracy in the detection of foreign matter in transmission lines, especially under conditions of diverse morphology and complex distribution environment.
Using a detection method based on improved YOLOV8, by introducing the experience of the wild attention convolution module (RFCNAMCONV), add the BRA-N attention mechanism to the neck of the YOLOV8 network, and replace the loss function as Shape-Iou to enhance the feature extraction and detection accuracy. Essence
It significantly improves the accuracy of foreign object detection in transmission lines, enhances the detection capability of foreign objects of different scales, and speeds up the convergence of the model.
Smart Images

Figure CN119339147A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of foreign object recognition in high-voltage transmission lines, and in particular to a foreign object detection method for transmission lines based on improved YOLOv8. Background Art
[0002] In recent years, China's power transmission line loops have increased year by year, and the country's power transmission and distribution capacity has been continuously enhanced. However, there are certain safety hazards in the power transmission and distribution process of power transmission lines, which will affect the safe operation of power transmission lines, thus causing fires or major power outages.
[0003] With the continuous development and progress of transmission line inspection technology, target detection technology based on deep learning has been widely used in the field of transmission lines. The convolutional neural network (CNN) algorithm based on deep learning requires a large amount of data for training in order to extract the characteristics of the target more accurately. However, the simple CNN algorithm has a poor effect on foreign object detection in transmission lines. The one-stage detection algorithm YOLOv8 can be well applied to foreign object detection in transmission lines, but due to the characteristics of foreign objects in transmission lines such as diverse shapes and complex distribution environments, the accuracy of foreign object detection in transmission lines is poor. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention proposes a transmission line foreign object detection method based on improved YOLOv8 to solve the problems existing in the above-mentioned background technology.
[0005] The foreign object detection method for transmission lines based on improved YOLOv8 specifically includes the following steps.
[0006] Step 1: Use a drone or camera to collect image information of foreign objects (bird nests, floating objects, illegal construction) on the transmission lines and mark the images.
[0007] Step 2: Screen and process the foreign body images annotated in step 1, and then divide them into training set, test set and validation set.
[0008] Step 3. The present invention designs a new receptive field attention convolution module RFCNAMConv to replace the standard convolution in the YOLOv8 network and adds the RFCBAMConv module to the C2f module, which is combined with the feature fusion module in the detection network. It enhances the feature position information while taking into account the extraction of deeper feature information, and can accurately extract features of different scales.
[0009] Step 4: Add the BRA-n attention mechanism to the neck network of the YOLOv8 network structure to enhance the extraction of small target features. This attention mechanism can improve the accuracy of model detection without increasing the complexity of the model.
[0010] Step 5: Replace the loss function CIoU in the YOLOv8 network with Shape-IoU to improve the prediction box regression speed and accelerate the convergence of the model, thereby improving the detection accuracy.
[0011] Step 6: Input the data set divided in step 2 into the improved network model in step 5, and set the initial parameters such as the number of iterations, learning rate, momentum factor, batch size, etc. Use the optimizer to adjust the network parameters, and save the best weight parameters when the training is completed for the set number of iterations.
[0012] Step 7: Use the best weight parameter saved in step 6 as the pre-training weight, then detect the foreign body image of the transmission line to be detected and check the detection effect.
[0013] The present invention has the following beneficial effects.
[0014] Compared with other detection methods, the present invention has better improved the detection accuracy of the model by introducing improved schemes. The receptive field attention convolution module (RFCNAMConv) is used to improve the model's ability to detect foreign objects of different scales in the transmission line. The addition of the dynamic sparse attention strategy attention mechanism (BRA-n) can enhance the model's ability to extract important features of foreign objects and improve the model's detection accuracy for small foreign objects. The loss function is replaced by the Shape-IoU loss function, which can speed up the convergence of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is a flow chart of a method for detecting foreign objects in a power transmission line based on improved YOLOv8 proposed by the present invention.
[0016] Figure 2 This is a network structure diagram of the improved YOLOv8 in the present invention.
[0017] Figure 3 This is the structural diagram of the receptive field attention convolution module in the present invention.
[0018] Figure 4 This is a module structure diagram of the dynamic sparse attention mechanism (BRA-n) in the present invention.
[0019] Figure 5 Schematic diagram of the Shape-IoU loss function in the present invention. DETAILED DESCRIPTION
[0020] The method and advantages of the present invention are further described below in conjunction with the accompanying drawings.
[0021] like Figure 1 As shown, the present invention proposes a method for detecting foreign objects in a power transmission line based on improved YOLOv8, comprising the following steps:
[0022] Step 1: Collect images of foreign objects on the transmission lines and construct an experimental data set.
[0023] Step 2: Manually annotate the dataset and divide it into training set, validation set and test set.
[0024] Step 3: Use the training set to train the improved YOLOv8 model to obtain a transmission line foreign object detection model.
[0025] Step 4: Use the obtained transmission line foreign object detection model to perform transmission line foreign object detection.
[0026] Furthermore, the step 1 is specifically as follows: The present invention takes foreign bodies in the high-voltage transmission and distribution lines of the State Grid as the research object. During the inspection of the transmission lines, inspection drones and cameras are used to collect three common foreign bodies in the transmission lines, namely, bird nests, floating objects, and illegal construction vehicles.
[0027] Furthermore, step 2 is specifically as follows: a total of 3110 images of the three diseases are collected and divided into a training set, a validation set and a test set in a ratio of 8:1:1, wherein there are 2490 images in the training set, 310 images in the validation set and 310 images in the test set, and then the data set is manually annotated using LabelImg.
[0028] Furthermore, the step 3 is specifically as follows: the present invention designs a receptive field attention convolution module RFCBAMConv, as shown in the attached Figure 3 , add the RFCBAMConv module to the C2f module, combine it with the feature fusion module in the detection network, and replace the feature fusion module in the YOLOv8 network.
[0029] At present, standard convolution is used in the YOLOv8 network. It is difficult to extract important foreign body features in the complex environment of foreign body detection on power transmission lines. Moreover, the C2f module is simply added and lacks global features in the extracted information. Therefore, this paper designs a new feature extraction module C2f-RFCBAMConv, in which the scope of RFCBAMConv is expanded through feature vector transformation and multi-layer nested convolution. The module adopts the split strategy to segment the feature map in the channel dimension, thereby opening up multiple information paths for parallel processing. To overcome the common feature degradation problem of deep networks, three RFC-Bottleneck modules with integrated residual mechanism are connected in series after the split operation, which helps to reduce information loss in deep networks. By implementing a cross-stage output fusion strategy, the feature information extracted at different levels is integrated to enhance the comprehensive expression ability of the model. Compared with the original C2f module, C2f-RFCBAMConv can effectively learn multi-scale foreign body target features and expand the scope of the receptive field through feature vector transfer and multi-layer nested convolution in its module.
[0030] Furthermore, the step 3 is specifically as follows: adding a BRA-n attention mechanism to the neck network of YOLOv8.
[0031] As a dynamic sparse attention strategy, the BRA-n attention mechanism adopts a two-level attention architecture: first, irrelevant information is filtered out at the coarse region level, and only a small number of key routing regions are retained to reduce redundant interference and strengthen the interaction of effective information; then, at the fine-grained level, the feature extraction in these key regions is further focused through deep interaction between tokens, as shown in the attached figure. Figure 4 This mechanism can dynamically adjust the attention distribution according to the specific content of the input image, showing a high degree of flexibility and adaptability, and improving the efficiency of small target detection in the complex environment of power transmission lines.
[0032] Furthermore, the step 3 is specifically: replacing the loss function CIOU in the YOLOv8 network with Shape-IoU.
[0033] The Shape-IoU loss function used in this invention considers the shape and scale of the prediction box boundary itself on the basis of CIOU. First, the characteristics of boundary regression are analyzed, and the influence of the shape factor and scale factor of the boundary itself on the regression result is obtained. By paying attention to the shape and scale of the boundary itself to calculate the loss, the accuracy of the detection model is improved. The Shape-IoU loss function consists of three parts: fixed attributes of the true value box, distance loss, and shape loss, as shown in the attached figure. Figure 5 The formula of Shape-IoU loss function is shown below.
[0034] The fixed attribute expression of the truth box is It makes the shape of the predicted box close to the real box, and then dynamically adjusts the predicted box according to the size of the foreign object detected in the data set, thereby speeding up the calculation of the distance between the two boxes. Among them, ww and hh are the weight coefficients in the horizontal and vertical directions respectively, and scale is the scale factor; the distance loss refers to the distance between the center point of the predicted box and the real box, and the calculation formula is That and is the coordinate of the center point of the GT frame, x c and c is the coordinate of the center point of the prior frame; the shape loss takes into account the aspect ratio between the predicted box and the real box, making the shapes of the two boxes more similar. The calculation formula is Among them, θ represents the degree of attention to shape loss, which prevents excessive attention to shape loss in calculation and reduces the movement of the prediction box by selecting a moderate aspect ratio between the prediction box and the true box. Among them, w, h represent the length and width of the prediction box; w gt ,h gt Represents the length and width of the real box; finally, the Shape-IoU loss function calculation formula is L Shape-IoU =1-IoU+distance shape +0.5×Ω shape .
[0035] Furthermore, step 4 is specifically as follows: the experimental environment is Windows 10 system, the graphics card uses NVIDIA GetForce RTX3060, the Pycharm version is 22.3, the python version is 3.8, the pytorch version is 1.10.0, and the CUDA version is 11.3. The experiment of the present invention uses a data set in YOLO format to train the transmission line foreign body detection model, and the input image size is 640×640. Through multiple experiments, it was found that the model can converge within 250 rounds, and the parameters of the model are set as follows: epoch=250, batch_size=16; using the Adam optimizer, the initial learning rate is set to 0.01.
[0036] Comparison of model test data before and after improvement. P(%) R(%) mAP(%) Single image detection speed (ms) YOLOv8 90.3 83.3 88.6 8 YOLO_ours 94.6 85.6 92.1 5
[0037] P is precision, R is recall rate, and mAP represents the mean average precision of recognition. It can be seen that the YOLOv8 network model improved by this application has higher recognition effect and recognition accuracy of foreign objects.
[0038] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for detecting foreign objects in a power transmission line based on improved YOLOv8, characterized in that: The following steps are involved: Step 1: Use a drone or camera to collect image information of foreign objects (bird nests, floating objects, illegal construction) on the transmission line and mark the images; Step 2: Screen the foreign body images annotated in step 1 and divide them into a training set, a test set, and a validation set; Step 3: Use the training set to train the improved YOLOv8 model to obtain a transmission line foreign object detection model; Step 4: Use the obtained transmission line foreign object detection model to perform transmission line foreign object detection.
2. A method for detecting foreign objects in a power transmission line based on improved YOLOv8 as claimed in claim 1, characterized in that: In step 1, common foreign objects in the transmission line include bird nests, floating objects, and construction vehicles, and the LanelImg tool is used to annotate the image.
3. A method for detecting foreign objects in a power transmission line based on improved YOLOv8 as claimed in claim 1, characterized in that: In step 2, remove the images in the dataset that are poorly presented due to lighting and shooting techniques, and divide them into training set, test set, and validation set according to the ratio of 8:1:
1.
4. A method for detecting foreign objects in a power transmission line based on improved YOLOv8 as claimed in claim 1, characterized in that: In step 3, a new receptive field attention convolution module RFCNAMConv is designed to replace the standard convolution in the YOLOv8 network and the RFCBAMConv module is added to the C2f module, which is combined with the feature fusion module in the detection network. It enhances the feature position information while taking into account the extraction of deeper feature information, and can accurately extract features of different scales.
5. A method for detecting foreign objects in a power transmission line based on improved YOLOv8 as claimed in claim 1, characterized in that: In step 3, the BRA-n attention mechanism is added to the neck network of the YOLOv8 network structure to enhance the extraction of small target features. This attention mechanism can improve the accuracy of model detection without increasing the complexity of the model.
6. A method for detecting foreign objects in a power transmission line based on improved YOLOv8 as claimed in claim 1, characterized in that: In step 3, replace the loss function CIoU in the YOLOv8 network with Shape-IoU to improve the prediction box regression speed and accelerate the convergence of the model, thereby improving the detection accuracy.
7. A method for detecting foreign objects in a power transmission line based on improved YOLOv8 as claimed in claim 1, characterized in that: In step 3, the training parameters of the improved YOLOv8 model are set to: epoch = 250, batch_size = 16; the Adam optimizer is used, and the initial learning rate is set to 0.01.