A method and system for detecting multiple defects in transmission lines based on improved YOLOv8s
By improving the combination of the YOLOv8s network model and the SAM large model, the problems of time-consuming, labor-intensive, and error-prone manual inspection in transmission line testing have been solved, achieving efficient and accurate transmission line defect detection, especially the identification of insulators and bird nests, and improving the detection accuracy and lightweight nature of the model.
Patent Information
- Application Number
- CN202411615854.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-11-13
AI Technical Summary
Traditional methods for detecting transmission line faults require manual or robotic inspection, which consumes a lot of human resources and is prone to detection errors, making it difficult to efficiently and accurately detect transmission line defects in complex environments.
An improved YOLOv8s network model is adopted, combined with the SAM large model for data preprocessing and feature extraction. The backbone network is improved through C2f-M2SA-CGLU, CAFM and LDConv modules to achieve efficient detection of transmission line defects.
It improves the accuracy of power transmission line defect detection, avoids missed detections and false detections, the model is lightweight and can efficiently and accurately detect in dense target backgrounds, and enhances the ability to extract features of small targets.
Smart Images

Figure CN119559479B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically to a method and system for detecting multiple defects in power transmission lines based on an improved YOLOv8s. Background Technology
[0002] In recent years, with the continuous development of the power industry, the number of power grid equipment built in complex environments has been increasing day by day, which has also put forward higher requirements for the safety maintenance of power system equipment.
[0003] However, with the continuous expansion of the power grid, transmission lines are prone to failure due to external environmental factors. Traditional transmission line operational faults include insulator disconnection, bird nests on power tower tops, and pollution flashover faults. Insulators, as crucial components ensuring the normal operation of transmission lines, are also the most likely to fail. Long-term exposure to complex environments makes insulators susceptible to damage from ice, wind, lightning, and other adverse factors, leading to varying degrees of failure. Severe faults can affect the operation of the entire power system, causing large-scale blackouts and resulting in huge economic losses. Traditional fault classification methods based on mathematical modeling and signal processing typically require manual or robotic inspection, which not only consumes significant human resources but is also prone to detection errors.
[0004] Therefore, it is necessary to provide new methods and systems for detecting multiple defects in transmission lines based on the improved YOLOv8s. Summary of the Invention
[0005] Based on the aforementioned problems in the existing technology, the purpose of this invention is to provide a method and system for detecting multiple defects in transmission lines based on an improved YOLOv8s. This method can efficiently and accurately detect and extract defects in transmission lines in a dense target environment, avoiding the problems of missed and false detections, improving the detection accuracy of the model while also keeping the model lightweight.
[0006] To achieve the above objectives, the technical solution adopted by this invention is: a multi-defect detection method for transmission lines based on an improved YOLOv8s, comprising:
[0007] S1. Collect images of insulator defects and bird nests on the transmission line to obtain the initial dataset;
[0008] S2, The initial dataset is preprocessed using the SAM large model to obtain the target dataset;
[0009] S3, the target dataset is divided into a training set, a validation set, and a test set;
[0010] S4. An improved YOLOv8s network model is constructed based on the YOLOv8s network model as a baseline model to serve as a multi-defect detection network model for transmission lines.
[0011] S5. Input the training set into the transmission line multi-defect detection network model for model training, and improve the parameters of the transmission line multi-defect detection network model based on the training results to obtain the trained transmission line multi-defect detection network model.
[0012] S6. Input the validation set into the trained transmission line multi-defect detection network model for model evaluation;
[0013] S7. Input the test set into the trained transmission line multi-defect detection network model to obtain the transmission line defect detection results.
[0014] Furthermore, in S1, the acquisition of images of insulator defects and bird nests on the transmission line yields an initial dataset, including:
[0015] The drone is equipped with a high-resolution camera to clearly capture details on the power transmission line. All the collected images are then transmitted to a local storage device or server. The images are initially screened to remove those that are too poor in quality to be used due to shooting errors such as blurriness, overexposure or underexposure, or poor shooting angle. Finally, the remaining images are classified and organized according to the recorded metadata information, and images of insulator defects and bird nests are stored in folders or database tables to form the initial dataset.
[0016] Furthermore, in S2, the initial dataset is preprocessed using the SAM large model to obtain the target dataset, including: using the SAM large model to segment the images in the initial dataset, extracting the mask of defects in the original image, and then randomly pasting the segmented object onto another image using copy-paste.
[0017] The specific formula for randomly pasting the segmented object onto another image and blending them together is as follows:
[0018] y = I1*α + I2*(1-α)
[0019] Where y is the output image, I1 is the image where the pasted object is located, I2 is the main image, and α is the mask.
[0020] Furthermore, in S4, the construction of an improved YOLOv8s network model based on the YOLOv8s network model as a multi-defect detection network model for transmission lines includes:
[0021] Step S41: Replace the C2f modules in layers 7 and 9 of the backbone network with C2f-M2SA-CGLU modules;
[0022] Step S42: Add the 11th layer CAFM module to the backbone network;
[0023] Step S43: Replace the Conv modules in layers 18 and 21 of the neck network with LDConv modules.
[0024] Furthermore, the feature extraction process of the LDConv module includes:
[0025] Step S431: Based on the size of N, generate the initial sampling coordinates P of the convolution kernel using an arbitrary-size convolution algorithm. N The original coordinates (P) are obtained. o +P N );
[0026] Step S432: Obtain the offset of the corresponding kernel through convolution operation. Its dimension is (B, 2N, H, W). Add the offset to the original coordinates to generate new sampling coordinates corresponding to the convolution.
[0027] Step S433: Obtain the features at the corresponding positions through interpolation and resampling.
[0028] Furthermore, the CAFM module is divided into a global branch and a local branch. The global branch uses a self-attention mechanism to capture a wider range of hyperspectral data information, while the local branch focuses on extracting local features for comprehensive denoising. Convolution and attention complement each other.
[0029] Furthermore, in S6, the step of inputting the validation set into the trained transmission line multi-defect detection network model for model evaluation includes: inputting the test set into the trained transmission line multi-defect detection network model, and evaluating the model based on its precision P, recall R, false positive rate F, mean precision AP, and mean mean precision mAP. The formula for evaluating model performance is as follows:
[0030]
[0031]
[0032]
[0033]
[0034] Where TP is the number of positive samples correctly identified as positive samples, FP is the number of negative samples incorrectly identified as positive samples, FN is the number of positive samples incorrectly identified as negative samples, N is the total number of categories of detected targets, AP is the area under the PR curve, and mAP is the average AP of the total detected faults.
[0035] A multi-defect detection system for transmission lines based on an improved YOLOv8s is applied to the aforementioned multi-defect detection method for transmission lines based on an improved YOLOv8s. The system includes:
[0036] The dataset acquisition module is used to collect images of insulator defects and bird nests on transmission lines to obtain the initial dataset;
[0037] The dataset preprocessing module is used to preprocess the initial dataset using the SAM large model to obtain the target dataset;
[0038] The dataset partitioning module is used to partition the target dataset into a training set, a validation set, and a test set;
[0039] An improved modeling module is used to construct an improved YOLOv8s network model based on the YOLOv8s network model as a multi-defect detection network model for transmission lines.
[0040] The model training module is used to input the training set into the transmission line multi-defect detection network model for model training, and improve the parameters of the transmission line multi-defect detection network model based on the training results to obtain the trained transmission line multi-defect detection network model.
[0041] The model validation and evaluation module is used to input the validation set into the trained transmission line multi-defect detection network model for model evaluation.
[0042] The detection result generation module is used to input the test set into the trained transmission line multi-defect detection network model to obtain the transmission line defect detection results.
[0043] Embodiments of the present invention also provide a network-side server, comprising:
[0044] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described method for detecting multiple defects in transmission lines based on the improved YOLOv8s.
[0045] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described method for detecting multiple defects in transmission lines based on the improved YOLOv8s.
[0046] The beneficial effects of this invention are as follows: The multi-defect detection method for transmission lines based on improved YOLOv8s includes acquiring images of insulator defects and bird nests on the transmission line to obtain an initial dataset; preprocessing the initial dataset using a large SAM model to obtain a target dataset; dividing the target dataset into a training set, a validation set, and a test set; constructing an improved YOLOv8s network model as the transmission line multi-defect detection network model using the YOLOv8s network model as the baseline model; inputting the training set into the transmission line multi-defect detection network model for model training, and improving the parameters of the transmission line multi-defect detection network model based on the training results to obtain the trained transmission line multi-defect detection network model; inputting the validation set into the trained transmission line multi-defect detection network model for model evaluation; and inputting the test set into the trained transmission line multi-defect detection network model to obtain the transmission line defect detection results. The improved YOLOv8s-based multi-defect detection method for power transmission lines in this invention can efficiently and accurately detect and extract defects in densely packed targets like power transmission lines, avoiding missed and false detections, improving the model's detection accuracy while maintaining its lightweight nature. The initial dataset is preprocessed using a large SAM model, including image segmentation and image overlay to balance the number of labels, thus preventing overfitting caused by an excessive number of labels of a particular type. An improved C2f-M2SA-CGLU module is used in the backbone, which can focus on more effective features and better extract features from small targets. By adding an 11th-layer CAFM module to the backbone network, combining convolution and attention, the model can comprehensively model global and local features, thereby improving denoising performance. The LDConv module can effectively perform irregular convolution feature extraction and can flexibly adjust the sampling shape according to the offset, providing more options for exploring convolution sampling shapes. The LDConv module can easily replace convolution operations in some efficient modules, thereby improving network performance. Attached Figure Description
[0047] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0048] In the picture:
[0049] Figure 1 The flowchart is a process for a multi-defect detection method for transmission lines based on an improved YOLOv8s provided in Embodiment 1 of the present invention.
[0050] Figure 2 A schematic diagram of the data preprocessing flow provided in Embodiment 1 of the present invention;
[0051] Figure 3 A schematic diagram of the improved YOLOv8s provided in Embodiment 1 of the present invention;
[0052] Figure 4 This is a schematic diagram of the structure of the M2SA module provided in Embodiment 1 of the present invention;
[0053] Figure 5 This is a schematic diagram of the CGLU module provided in Embodiment 1 of the present invention;
[0054] Figure 6 This is a schematic diagram of the structure of the C2f-M2SA-CGLU module provided in Embodiment 1 of the present invention;
[0055] Figure 7 This is a schematic diagram of the CAFM module provided in Embodiment 1 of the present invention;
[0056] Figure 8 This is a schematic diagram of the LDConv module provided in Embodiment 1 of the present invention;
[0057] Figure 9 A schematic diagram of a multi-defect detection system for transmission lines based on an improved YOLOv8s, provided in Embodiment 2 of the present invention;
[0058] Figure 10 This is a schematic diagram of the network-side server provided according to the third embodiment of the present invention. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, 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.
[0060] For ease of understanding, the technical terms appearing in the following embodiments are explained here:
[0061] SAM (Segment Anything Model) is an artificial intelligence image segmentation model.
[0062] The M2SA module, Multi-Scale Self-Attention, is a module used in deep learning to handle multi-scale features and enhance self-attention mechanisms.
[0063] GLU: Gated Linear Unit.
[0064] CAFM module: Convolution and Attention Fusion Module.
[0065] Conv module: Convolutional Module.
[0066] The LDConv module, or Low-Dimensional Convolution, is a convolutional module used in deep learning architectures.
[0067] First implementation method:
[0068] The first embodiment of the present invention provides a method for detecting multiple defects in transmission lines based on an improved YOLOv8s, comprising: acquiring images of insulator defects and bird nests on the transmission line to obtain an initial dataset; preprocessing the initial dataset using a large SAM model to obtain a target dataset; dividing the target dataset into a training set, a validation set, and a test set; constructing an improved YOLOv8s network model as a transmission line multiple defect detection network model using the YOLOv8s network model as a baseline model; inputting the training set into the transmission line multiple defect detection network model for model training, and improving the parameters of the transmission line multiple defect detection network model based on the training results to obtain a trained transmission line multiple defect detection network model; inputting the validation set into the trained transmission line multiple defect detection network model for model evaluation; and inputting the test set into the trained transmission line multiple defect detection network model to obtain transmission line defect detection results. The multi-defect detection method for transmission lines based on the improved YOLOv8s of this invention can efficiently and accurately detect and extract defects in transmission lines in the context of dense targets, avoiding the problems of missed and false detections of defects, improving the detection accuracy of the model while taking into account the lightweight nature of the model.
[0069] The following details the implementation of the improved YOLOv8s-based multi-defect detection method for transmission lines in this embodiment. The following details are provided for ease of understanding and are not essential for implementing this solution. The specific process of this embodiment is as follows: Figure 1 As shown, this embodiment is applied to a multi-defect detection system for transmission lines based on an improved YOLOv8s.
[0070] Step S1: Collect images of insulator defects and bird nests on the transmission line to obtain the initial dataset.
[0071] Specifically, drones are equipped with high-resolution cameras, such as HD cameras with optical zoom, to clearly capture details along power transmission lines. The drones are also ensured to have good flight stability and maneuverability, enabling them to hover and capture images accurately within a safe distance from the power lines. All acquired images are then transmitted to local storage devices or servers. Initial image screening removes images of unusable quality due to shooting errors such as blurriness, overexposure, underexposure, or poor shooting angles. Finally, based on recorded metadata, the remaining images are categorized and organized, with insulator defect images and bird nest images stored in folders or database tables, forming the initial dataset.
[0072] Step S2: The initial dataset is preprocessed using the SAM large model to obtain the target dataset.
[0073] Specifically, due to the diverse types of defects in electrical equipment on transmission lines, embodiments of this invention primarily focus on multi-defect identification, including insulator breakage defects, insulator flashover defects, and bird nests. From a morphological perspective, the texture features exhibited in images differ depending on the type of defect. In cases of class imbalance, the classification boundary may encroach upon the minority class region, affecting the model's ability to learn more fundamental features and impacting its robustness. A balanced dataset approach addresses the issue of bias towards the majority class during actual prediction.
[0074] When the initial dataset has more than 3 types of labels, in order to balance the number of labels for transmission line defects, the SAM large model is used to segment the images in the initial dataset, extract the mask of the original image defects, and then copy-paste is used to randomly paste the segmented objects onto another image.
[0075] Furthermore, the segmented objects are randomly pasted onto another image. The specific formula for blending and pasting is as follows:
[0076] y = I1*α + I2*(1-α)
[0077] Where y is the output image, I1 is the image where the pasted object is located, I2 is the main image, and α is the mask.
[0078] During the pasting process, the random function is used to randomly paste the source and target images.
[0079] Specifically, the operation flowchart is as follows: Figure 2 As shown, first input an original image, such as... Figure 2Image (a) shows a bird's nest defect on a power transmission line; then the original image is... Figure 2 In the input SAM model (a), the encoder of the SAM model extracts feature maps from the reference image and the test image respectively. The feature map of the reference image is masked and pooled to obtain a feature vector. Then, by calculating the cosine similarity between the feature vector and each pixel of the feature map of the test image, the point with the highest similarity is used as the foreground cue point. Figure 2 In (b), the point with the lowest similarity is used as the background cue point, such as... Figure 2 (c) is then input into the Prompt encoder of the SAM model to achieve segmentation of specific targets, resulting in a mask as shown in Figure 1. Figure 2 (d) and visualizations as shown in the figure Figure 2 (e) in the image; finally, the segmented object is randomly pasted onto another image using copy-paste, as shown in the figure. Figure 2 (f) in the middle.
[0080] Furthermore, the initial dataset is preprocessed using the SAM large model, which includes balancing the number of labels by employing image segmentation and image overlay methods, thereby preventing overfitting caused by an excessive number of labels of one class.
[0081] Step S3: Divide the target dataset into a training set, a validation set, and a test set.
[0082] Specifically, the target dataset images are randomly divided into a training set, a validation set, and a test set in an approximate 8:1:1 ratio.
[0083] Step S4: Using the YOLOv8s network model as the baseline model, construct an improved YOLOv8s network model as the multi-defect detection network model for transmission lines.
[0084] Specifically, existing YOLOv8 models mainly consist of a backbone network, a neck network, and a detection head. The backbone network acts as a feature extractor, responsible for extracting meaningful features from the input image. The neck network acts as a bridge, connecting the backbone network and the detection head, performing feature fusion operations and integrating contextual information. The detection head is the final part of the network, used to generate the network's output, such as predicting the category and location of objects in the image. YOLOv8 adjusts the model size by controlling the network depth and width factors, resulting in five models ranging from small to large: v8n, v8s, v8m, v8l, and v8x.
[0085] The detailed network structure based on YOLOv8s is as follows: Figure 3 As shown, the specific steps are as follows:
[0086] Step S41: Replace the C2f modules in layers 7 and 9 of the backbone network with C2f-M2SA-CGLU modules.
[0087] Specifically, the M2SA module combines channel attention, multi-scale feature mechanisms, and multi-scale self-attention mechanisms. For example... Figure 4 As shown, a dual-branch structure is used to extract global features and channel information.
[0088] In one branch, the multi-attention scale branch undergoes dimensionality reduction via 1x1 convolution, followed by feature extraction via three dilated convolutions. The features from the three branches are then summed and fused, and finally, the 1x1 convolution result is connected to the residual. Multi-head attention is then calculated. In summary, the formula for the above process is:
[0089]
[0090]
[0091]
[0092] P = AdaptivePool(X) out )
[0093] Among them, X i (i = 1, 2, 3) represent the outputs of three depthwise separable subluminal convolutions, X is the original input feature, and Conv 1×1 For a 1×1 convolution, For a 3×3 depth-separable subluminal convolution, its subluminal rate is R. i X i (i = {1, 2, 3}) represents the output of three 1×1 convolution branches. For stepwise multiplication, X out This is the final output.
[0094] In the other branch, average pooling is first used to reduce dimensionality, followed by convolution to reduce the number of channels. After ReLU6 and convolution to increase dimensionality, the sigmoid function is used to obtain the attention score for each channel, which is then multiplied by the original input features to obtain the data features. Finally, the features from the two branches are fused by summation to obtain the final output features. The above process can be represented as:
[0095] X p =Avpool(X)
[0096] X c =ReLu6(Conv 1×1 (X p ))
[0097]
[0098] Among them, X p For channel attention mapping, Avpool is the average pooling layer, and X is the input feature. c For channel attention mapping, ReLU6 is the activation function. (ReLU6 activation function, Attention) c For output features, Conv 1×1 It is a 1×1 convolution.
[0099] Furthermore, the GLU is a channel mixer that has demonstrated superior performance to multilayer perceptrons in various natural language processing tasks. The GLU consists of two linear projections that are multiplied element-wise, with one projection activated by a gating function. However, adding a minimal 3×3 depthwise convolution before the activation function of the GLU's gating branch, introducing a 3×3 zero-padding convolution into the visual Transformer, can be viewed as a conditional positional encoding, effectively capturing the positional information introduced by the zero padding. The CGLU module is as follows... Figure 5 As shown, the value branches of this model still maintain the same depth as MLP and GLU, making it easy to backpropagate.
[0100] Feature extraction, or the backbone part, is a layer-by-layer mining process of image data. Standard convolution operations, due to their fixed kernels and small receptive fields, may lead to missed detections in multi-class transmission line fault detection. The overall structure of C2f-M2SA-CGLU is as follows: Figure 6 As shown, the improved C2f-M2SA-CGLU module is used in the backbone part. The C2f-M2SA-CGLU module can focus on more effective features and can also better extract features of small targets.
[0101] Step S42: Add the 11th layer CAFM module to the backbone network.
[0102] Specifically, the CAFM module, which is the convolution and attention fusion module, is divided into global branches and local branches, such as... Figure 7 As shown, the global branch employs a self-attention mechanism to capture broader hyperspectral data information, while the local branch focuses on extracting local features for comprehensive denoising. Convolution and attention complement each other.
[0103] The local branch first uses 1×1 convolutions to adjust the channel size. After this, a channel transformation operation is performed to further mix the channel information. Channel shuffling divides the input tensor into groups along the channel dimension, with each group using a depthwise separable convolution to induce channel shuffling. Subsequently, the output tensors of each group are concatenated along the channel dimension to generate a new output tensor. Finally, we extract features using 3×3×3 convolutions. The formula is expressed as:
[0104] F conv =W 3×3×3 (cs(W 1×1 (Y)))
[0105] Among them, F conv For local branch output, W 3×3×3 It is a 3×3×3 convolution, CS is the channel shuffling operation, W 1×1 It is a 1×1 convolution, and Y is the input feature.
[0106] In the global branch, we first generate three tensors—query Q, key K, and value V—using 1×1 and 3×3 depthwise convolutions. Then, we compute the attention map A through the interaction of Q and K, reducing computational cost. The output F of the global branch is... att Defined as:
[0107]
[0108]
[0109] Among them, F att For the output of the global branch, W 1×1 Q is a 1×1 convolution, Q is a 1×1 convolution and a 3×3 depthwise convolution to generate the query, K is a 1×1 convolution and a 3×3 depthwise convolution to generate the key, V is a 1×1 convolution and a 3×3 depthwise convolution to generate V, and α is a learnable scaling parameter used to control the size of the multiplication of matrices K and Q before applying the softmax function.
[0110] Finally, the output formula calculated by the CAFM module is:
[0111] F out =F att +F conv
[0112] Among them, F out F is the output calculated by the CAFM module. att For the output of the global branch, F conv This is for local branch output.
[0113] By adding an 11th-layer CAFM module to the backbone network, the design combining convolution and attention enables the model to comprehensively model global and local features, thereby improving denoising performance.
[0114] Step S43: Replace the Conv modules in layers 18 and 21 of the neck network with LDConv modules.
[0115] Specifically, standard convolution sampling positions are fixed, which means that convolution can only extract local information and cannot capture information from other locations. The LDConv module can effectively perform the feature extraction process for irregular convolutions and can flexibly adjust the sampling shape according to the offset, bringing more options for exploring the convolution sampling shape.
[0116] like Figure 8 As shown, the feature extraction process of the LDConv module includes the following steps:
[0117] Step S431: Based on the size of N, generate the initial sampling coordinates P of the convolution kernel using an arbitrary-size convolution algorithm. N The original coordinates (P) are obtained. o +P N ).
[0118] Step S432: Obtain the offset of the corresponding kernel through convolution operation. Its dimension is (B, 2N, H, W). Add the offset to the original coordinates to generate new sampling coordinates corresponding to the convolution.
[0119] Step S433: Obtain the features at the corresponding positions through interpolation and resampling.
[0120] The LDConv module completes the feature extraction process with an arbitrary number of parameters by generating initial sampling coordinates. Therefore, the LDConv module can easily replace the convolution operation in some efficient modules, thereby improving network performance.
[0121] Step S5: Input the training set into the transmission line multi-defect detection network model for model training, and improve the parameters of the transmission line multi-defect detection network model based on the training results to obtain the trained transmission line multi-defect detection network model.
[0122] Specifically, the experiment used the PyTorch framework and utilized the GPU. The experimental environment and basic training parameters are shown in Table 1 below.
[0123] Table 1 Experimental Environment
[0124]
[0125] The power transmission line fault detection dataset consists of two parts: images taken by drones during inspections and images augmented using image augmentation techniques. The collected insulator images were manually labeled using the LabelImg tool in a Python environment. The experiment required identifying three types of defects: broken insulators, flashover insulators, and bird nests. Therefore, four labels were set: insulator, broken, pollution-flashover, and nest.
[0126] Since the number of defect labels for a single image of a bird's nest defect is much smaller than that for the other two types of defects, an image segmentation and overlay method is used to randomly increase the number of labels for a single bird's nest image, thereby balancing the dataset and preventing overfitting. The dataset distribution is shown in Table 2 below, and the label distribution is shown in Table 3 below.
[0127] Table 2 Dataset Distribution
[0128]
[0129] Table 3 Label Distribution
[0130]
[0131] Step S6: Input the validation set into the trained transmission line multi-defect detection network model for model evaluation.
[0132] Specifically, the main evaluation metrics for object detection algorithms fall into two categories: detection accuracy and model complexity. To comprehensively and objectively evaluate the performance of the improved YOLOv8s model, the test set is input into the trained transmission line multi-defect detection network model. The model is evaluated based on its precision (P), recall (R), false positive rate (F), average precision (AP), and mean average precision (mAP). The formulas for evaluating model performance are as follows:
[0133]
[0134]
[0135]
[0136]
[0137] Where TP is the number of positive samples correctly identified as positive samples, FP is the number of negative samples incorrectly identified as positive samples, FN is the number of positive samples incorrectly identified as negative samples, N is the total number of target categories detected, AP is the area under the PR curve, and mAP is the average AP of all detected faults. A larger mAP indicates better network performance.
[0138] All ablation experiments were conducted on the same dataset, and all convolutional training was performed from scratch without using weight files. To verify the impact of the proposed improved module on detection performance, ablation experiments were conducted on CAFM, C2f-M2SA-CGLU, and LDConv using YOLOv8s as the baseline model, as detailed in Table 4 below.
[0139] Table 4 Ablation Experiment Results
[0140]
[0141] Table 5 below shows the detection results of 253 defect images in the test set. The improved YOLOv8 model is compared with the original model for the three types of defects. The mAP values of the improved model for each defect are higher than those of the original model.
[0142] Table 5. Data results for the three types of defects.
[0143]
[0144] Step S7: Input the test set into the trained transmission line multi-defect detection network model to obtain the transmission line defect detection results.
[0145] The first embodiment of the present invention provides a method for detecting multiple defects in transmission lines based on an improved YOLOv8s, comprising: acquiring images of insulator defects and bird nests on the transmission line to obtain an initial dataset; preprocessing the initial dataset using a large SAM model to obtain a target dataset; dividing the target dataset into a training set, a validation set, and a test set; constructing an improved YOLOv8s network model as a transmission line multiple defect detection network model using the YOLOv8s network model as a baseline model; inputting the training set into the transmission line multiple defect detection network model for model training, and improving the parameters of the transmission line multiple defect detection network model based on the training results to obtain a trained transmission line multiple defect detection network model; inputting the validation set into the trained transmission line multiple defect detection network model for model evaluation; and inputting the test set into the trained transmission line multiple defect detection network model to obtain transmission line defect detection results. The improved YOLOv8s-based multi-defect detection method for power transmission lines in this invention can efficiently and accurately detect and extract defects in densely packed targets like power transmission lines, avoiding missed and false detections. This improves the model's detection accuracy while maintaining its lightweight nature. The initial dataset is preprocessed using a large SAM model, including image segmentation and overlay to balance the number of labels, preventing overfitting due to an excessive number of labels of a particular type. An improved C2f-M2SA-CGLU module is used in the backbone, which can focus on more effective features and better extract features from small targets. An 11th-layer CAFM module is added to the backbone network, combining convolution and attention to enable the model to comprehensively model global and local features, thus improving denoising performance. The LDConv module effectively performs irregular convolution feature extraction and can flexibly adjust the sampling shape according to the offset, providing more options for convolution sampling shapes. The LDConv module can easily replace convolution operations in some efficient modules, thereby improving network performance.
[0146] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0147] Second implementation method:
[0148] like Figure 9As shown, the second embodiment of the present invention provides a multi-defect detection system for transmission lines based on improved YOLOv8s. The system includes: a dataset acquisition module 201, a dataset preprocessing module 202, a dataset partitioning module 203, an improved modeling module 204, a model training module 205, a model verification and evaluation module 206, and a detection result generation module 207.
[0149] Specifically, the dataset acquisition module 201 is used to acquire images of insulator defects and bird nests on the transmission line to obtain an initial dataset; the dataset preprocessing module 202 is used to preprocess the initial dataset using the SAM large model to obtain a target dataset; the dataset partitioning module 203 is used to partition the target dataset into a training set, a validation set, and a test set; the improved modeling module 204 is used to construct an improved YOLOv8s network model as a transmission line multi-defect detection network model based on the YOLOv8s network model; the model training module 205 is used to input the training set into the transmission line multi-defect detection network model for model training, and improve the parameters of the transmission line multi-defect detection network model based on the training results to obtain the trained transmission line multi-defect detection network model; the model validation and evaluation module 206 is used to input the validation set into the trained transmission line multi-defect detection network model for model evaluation; and the detection result generation module 207 is used to input the test set into the trained transmission line multi-defect detection network model to obtain the transmission line defect detection results.
[0150] It is not difficult to see that this embodiment is a system implementation corresponding to the first embodiment, and this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the first embodiment.
[0151] It is worth mentioning that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by this invention; however, this does not mean that other units are absent from this embodiment.
[0152] The third embodiment of the present invention relates to a network-side server, such as... Figure 10As shown, it includes at least one processor 302; and a memory 301 communicatively connected to at least one processor 302; wherein the memory 301 stores instructions executable by at least one processor 302, the instructions being executed by at least one processor 302 to enable at least one processor 302 to perform the above-described data processing method.
[0153] The memory 301 and processor 302 are connected via a bus, which may include any number of interconnecting buses and bridges. The bus connects various circuits of one or more processors 302 and memory 301 together. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 302 is transmitted over a wireless medium via an antenna, which further receives data and transmits it to processor 302.
[0154] Processor 302 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 301 can be used to store data used by processor 302 during operation.
[0155] The fourth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the multi-defect detection method for transmission lines based on the improved YOLOv8s described in the first embodiment.
[0156] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0157] The above descriptions are merely embodiments of the present invention. Commonly known structures and characteristics are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
[0158] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting multiple defects in transmission lines based on an improved YOLOv8s, characterized in that, include: S1. Collect images of insulator defects and bird nests on the transmission line to obtain the initial dataset; S2, The initial dataset is preprocessed using the SAM large model to obtain the target dataset; S3, the target dataset is divided into a training set, a validation set, and a test set; S4. An improved YOLOv8s network model is constructed based on the YOLOv8s network model as a baseline model to serve as a multi-defect detection network model for transmission lines. S5. Input the training set into the transmission line multi-defect detection network model for model training, and improve the parameters of the transmission line multi-defect detection network model based on the training results to obtain the trained transmission line multi-defect detection network model. S6. Input the validation set into the trained transmission line multi-defect detection network model for model evaluation; S7. Input the test set into the trained transmission line multi-defect detection network model to obtain the transmission line defect detection results; The improved YOLOv8s network model, constructed based on the YOLOv8s network model, serves as a multi-defect detection network model for transmission lines, including: The C2f modules in layers 7 and 9 of the backbone network are replaced with C2f-M2SA-CGLU modules. The M2SA module combines channel attention, multi-scale feature mechanism, and multi-scale self-attention mechanism, and adopts a dual-branch structure to extract global features and channel information. The CGLU module adds a minimal 3×3 depthwise convolution before the activation function of the gated branch of GLU. An 11th-layer CAFM module is added to the backbone network. The CAFM module is divided into a global branch and a local branch. The global branch adopts a self-attention mechanism to capture a wider range of hyperspectral data information, while the local branch focuses on extracting local features for comprehensive denoising. Convolution and attention complement each other. Replace the Conv modules in layers 18 and 21 of the neck network with LDConv modules; The feature extraction process of the LDConv module includes: Based on the size of N, the initial sampling coordinates of the convolution kernel are generated by a convolution algorithm of arbitrary size. , obtain the original coordinates ( + ); The offset of the corresponding kernel is obtained through convolution operation, and its dimension is (B, 2N, H, W). The offset is added to the original coordinates to generate new sampling coordinates corresponding to the convolution. Features at the corresponding locations are obtained through interpolation and resampling.
2. The method for detecting multiple defects in transmission lines based on improved YOLOv8s according to claim 1, characterized in that, In S1, the acquisition of images of insulator defects and bird nests on the transmission line yields an initial dataset, including: The drone is equipped with a high-resolution camera to clearly capture details on the power transmission line; then all the collected images are transmitted to a local storage device or server; the images are initially screened to remove blurry, overexposed or underexposed images, or images of poor quality due to poor shooting angles; finally, based on the recorded metadata information, the remaining images are classified and organized, and images of insulator defects and bird nests are stored in folders or database tables to form the initial dataset.
3. The method for detecting multiple defects in transmission lines based on improved YOLOv8s according to claim 1, characterized in that, In S2, the initial dataset is preprocessed using the SAM large model to obtain the target dataset, including: using the SAM large model to segment the images in the initial dataset, extracting the mask of defects in the original image, and then randomly pasting the segmented object onto another image using copy-paste; The specific formula for randomly pasting the segmented object onto another image and blending them together is as follows: Where y is the output image. To paste the image containing the object, Main image, For masking.
4. The method for detecting multiple defects in transmission lines based on improved YOLOv8s according to claim 1, characterized in that, In S6, the step of inputting the validation set into the trained transmission line multi-defect detection network model for model evaluation includes: inputting the test set into the trained transmission line multi-defect detection network model, and evaluating the model based on its precision P, recall R, false positive rate F, mean precision AP, and mean mean precision mAP. The formula for evaluating model performance is as follows: Where TP is the number of positive samples correctly identified as positive samples, FP is the number of negative samples incorrectly identified as positive samples, FN is the number of positive samples incorrectly identified as negative samples, N is the total number of categories of detected targets, AP is the area under the PR curve, and mAP is the average AP of the total detected faults.
5. A multi-defect detection system for transmission lines based on an improved YOLOv8s, characterized in that, The system applied to the multi-defect detection method for transmission lines based on the improved YOLOv8s described in claim 1, the system comprising: The dataset acquisition module is used to collect images of insulator defects and bird nests on transmission lines to obtain the initial dataset; The dataset preprocessing module is used to preprocess the initial dataset using the SAM large model to obtain the target dataset; The dataset partitioning module is used to partition the target dataset into a training set, a validation set, and a test set; An improved modeling module is used to construct an improved YOLOv8s network model based on the YOLOv8s network model as a multi-defect detection network model for transmission lines. The model training module is used to input the training set into the transmission line multi-defect detection network model for model training, and improve the parameters of the transmission line multi-defect detection network model based on the training results to obtain the trained transmission line multi-defect detection network model. The model validation and evaluation module is used to input the validation set into the trained transmission line multi-defect detection network model for model evaluation. The detection result generation module is used to input the test set into the trained transmission line multi-defect detection network model to obtain the transmission line defect detection results.
6. A network-side server, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the transmission line multi-defect detection method based on the improved YOLOv8s as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the multi-defect detection method for transmission lines based on the improved YOLOv8s as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Power transmission line stockbridge damper image defect detection method based on YOLOv8s
CN118298159A
PCB small target defect detection method based on improved YOLOv8s
CN118587188A