Defect detection method and system for power transmission line insulator based on improved YOLOv8n
By improving the YOLOv8n network model, combining CD_LSK, PConv, FocalModulation modules, and replacing the loss function, the accuracy problem of transmission line insulator defect detection in the context of target density is solved, and efficient and accurate detection and extraction effects are achieved.
Patent Information
- Application Number
- CN202411492947.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-07
AI Technical Summary
In the context of dense targets of transmission lines, it is difficult for the prior art to detect and extract insulator defects efficiently and accurately, resulting in unsatisfactory detection results.
Using the improved YOLOv8n network model, the PConv partial convolution module and FocalModulation module are introduced by embedding the CD_LSK module in the C2f module, and the CIoU loss function is replaced with the Powerful-Iou loss function, the model's detection ability of small objects and complex backgrounds is enhanced.
It improves the accuracy and efficiency of insulator defect detection, enhances the mobility and generalization of the model, and can efficiently and accurately detect and extract insulator defects in complex scenarios.
Smart Images

Figure CN119399164A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a defect detection method and system for transmission line insulators based on improved YOLOv8n. Background Art
[0002] With the continuous growth of electricity consumption in my country, high-voltage transmission lines are constantly expanding. In transmission lines, insulators are one of the important components, mainly used for electrical insulation and mechanical fixation. Since insulators are exposed to harsh environments for a long time, insulators on transmission lines are prone to burns, breakage and other faults. These faults will cause their insulation performance to deteriorate, thus seriously affecting the safe and stable operation of the power grid. In recent years, with the rapid development of artificial intelligence technology, insulator defect detection methods based on deep learning have gradually been applied to aerial insulator images, which not only improves detection efficiency but also saves manpower.
[0003] However, aerial insulator images are affected by some factors, such as shooting angle, shooting distance, and the complex environment in which the insulators are located. It is difficult to efficiently and accurately detect and extract insulator defects in the dense target background of transmission lines, which makes it difficult for insulator defect detection methods to achieve the expected results.
[0004] Therefore, it is necessary to provide a new defect detection method and system for transmission line insulators based on improved YOLOv8n. Summary of the invention
[0005] Based on the above-mentioned problems existing in the prior art, the purpose of an embodiment of the present invention is to provide a defect detection method and system for transmission line insulators based on improved YOLOv8n, which can efficiently and accurately detect and extract insulator defects in the target-dense background of transmission lines, thereby improving the accuracy of system detection.
[0006] To achieve the above object, the technical solution adopted by the present invention is: a defect detection method for transmission line insulators based on improved YOLOv8n, comprising:
[0007] S1, collects insulator defect images in transmission lines and preprocesses the images to obtain an initial data set;
[0008] S2, performing data enhancement on the images in the initial data set to obtain a target data set;
[0009] S3, dividing the target data set into a training set, a validation set and a test set;
[0010] S4, using the YOLOv8n network model as the benchmark model to build an improved YOLOv8n network model as the insulator defect detection network model;
[0011] S5, inputting the training set into the insulator defect detection network model for model training, and improving the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model;
[0012] S6, inputting the verification set into the trained insulator defect detection network model for model evaluation;
[0013] S7, inputting the test set into the trained insulator defect detection network model to obtain an insulator defect detection result.
[0014] Furthermore, in S1, the insulator defect images in the transmission line are collected and preprocessed to obtain an initial data set, including:
[0015] Unmanned aerial vehicles (UAVs) are used to collect insulator defect images of transmission lines and construct an insulator defect image dataset. In the dataset, the original images are preprocessed by the method of segmentation before labeling according to the characteristics of insulator defect images. The images are segmented into small blocks, and then the defects of the segmented small images are labeled to obtain the initial dataset.
[0016] Further, in S4, the improved YOLOv8n network model is constructed as the insulator defect detection network model based on the YOLOv8n network model as the benchmark model, including:
[0017] Step S41, embedding the C2f module into the CD_LSK module;
[0018] Step S42, introducing the PConv partial convolution module;
[0019] Step S43, introducing the FocalModulation module;
[0020] Step S44, replace the loss function CIoU in the original YOLOv8n with Powerful-Iou.
[0021] Furthermore, the embedding of the C2f module into the CD_LSK module includes: adding the CD_LSK module before passing it to the Botleneck block; the specific working process of the CD_LSK module includes: first, the feature map passed in previously is convolved with two large kernels to explicitly generate multiple features with various large receptive fields; second, sequential decomposition is more effective than simply applying a single larger kernel; finally, in order to enhance the network's ability to focus on the most relevant spatial context area to detect targets, a spatial selection mechanism is used to spatially select feature maps from large convolution kernels of different scales.
[0022] Furthermore, the introduction of the FocalModulation module includes: the working process of FocalModulation is as follows: first, the input image is subjected to feature extraction through the backbone network to generate a multi-layer feature map; then, the feature modulation module is applied to process these feature maps, and important features are enhanced by introducing a modulation factor, while irrelevant or interfering features are suppressed; then, the focusing mechanism acts on the feature map to dynamically adjust the weight of each position to ensure that the model pays more attention to difficult-to-detect objects or complex background areas; finally, after processing by the classification and regression heads, the category and position of the target are output to achieve target detection and segmentation tasks, thereby improving detection accuracy in challenging scenarios.
[0023] Furthermore, the loss function CIoU in the original YOLOv8n is replaced with Powerful-Iou, including that in insulator defect detection, the Powerful-Iou loss function fails to fully consider the feature differences of small targets; by introducing the width weight W_dw and height weight W_dh of the target box in the calculation of the penalty factor P, the modified penalty coefficient formula is as follows:
[0024]
[0025] Among them, dw1, dw2, dw2, dh2 are the absolute values of the distances between the predicted box and the corresponding edge of the target box, W gt is the width of the target box, h gt is the height of the target box, W_dw is the width weight of the target box, and W_dh is the height weight of the target box.
[0026] Further, in S6, the inputting of the validation set into the trained insulator defect detection network model for model evaluation includes: inputting the test set into the trained insulator defect detection network model, and evaluating the insulator defect detection network model based on its precision rate P, recall rate R and mean average precision mAP; the indicator formula for evaluating the model performance is as follows:
[0027]
[0028] Among them, TP is the number of correctly predicted positive samples, FN is the number of incorrectly predicted negative samples, and FP is the number of incorrectly predicted positive samples.
[0029] The defect detection system of the transmission line insulator based on the improved YOLOv8n is applied to the above-mentioned defect detection method of the transmission line insulator based on the improved YOLOv8n, and the system comprises:
[0030] The data set acquisition module is used to acquire insulator defect images in the transmission line and pre-process the images to obtain an initial data set;
[0031] A data set enhancement module, used to perform data enhancement on the images in the initial data set to obtain a target data set;
[0032] A data set partitioning module, used to partition the target data set into a training set, a validation set and a test set;
[0033] An improved modeling module is used to construct an improved YOLOv8n network model as an insulator defect detection network model using the YOLOv8n network model as a benchmark model;
[0034] A model training module is used to input the training set into the insulator defect detection network model for model training, and improve the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model;
[0035] A model verification and evaluation module, used for inputting a verification set into the trained insulator defect detection network model for model evaluation;
[0036] The detection result generation module is used to input the test set into the trained insulator defect detection network model to obtain the insulator defect detection result.
[0037] The embodiment of the present invention further provides a network side server, including:
[0038] 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, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned transmission line insulator defect detection method based on improved YOLOv8n.
[0039] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned defect detection method for transmission line insulators based on improved YOLOv8n.
[0040] The beneficial effects of the present invention are as follows: the defect detection method for transmission line insulators based on improved YOLOv8n of the present invention comprises collecting insulator defect images in the transmission line, and preprocessing the images to obtain an initial data set; performing data enhancement on the images in the initial data set to obtain a target data set; dividing the target data set into a training set, a validation set and a test set; constructing an improved YOLOv8n network model as an insulator defect detection network model with the YOLOv8n network model as a benchmark model; inputting the training set into the insulator defect detection network model for model training, and improving the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model; inputting the validation set into the trained insulator defect detection network model for model evaluation; and inputting the test set into the trained insulator defect detection network model. The insulator defect detection result is obtained in the model; the improved YOLOv8n network model of the present invention can more effectively integrate and process multi-scale features by embedding the CD_LSK module in the C2f module, thereby enhancing the ability to capture detail information and small targets; the PConv partial convolution module is introduced, and spatial features can be extracted more effectively while reducing redundant calculations; the FocalModulation module is introduced, which can not only process input images of different scales, but also more accurately identify and locate objects in the image, and is particularly suitable for processing difficult-to-detect objects and objects in complex backgrounds; the loss function CIoU in the original YOLOv8n is replaced by Powerful-Iou, so that the model pays more attention to the sensitivity of small targets, the model detects and extracts insulator defects efficiently and accurately, and the model has good migration and generalization. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0042] In the figure:
[0043] Figure 1 A flow chart of a method for detecting defects in transmission line insulators based on improved YOLOv8n provided in Embodiment 1 of the present invention;
[0044] Figure 2 A schematic diagram of the structure of the existing YOLOv8n provided in the first embodiment of the present invention;
[0045] Figure 3 A schematic diagram of the structure of the improved YOLOv8n provided in the first embodiment of the present invention;
[0046] Figure 4 A schematic diagram of the structure of a C2f module provided in Embodiment 1 of the present invention;
[0047] Figure 5 A schematic diagram of the structure of a CD_LSK module provided in Embodiment 1 of the present invention;
[0048] Figure 6 A schematic diagram of the structure of a CDK module provided in Embodiment 1 of the present invention;
[0049] Figure 7 A schematic diagram of the structure of the PConv partial convolution module provided in the first embodiment of the present invention;
[0050] Figure 8 A schematic diagram of the structure of the SPPF module provided in the first embodiment of the present invention;
[0051] Fig. 9 A schematic diagram of the structure of a FocalModulation module provided in Embodiment 1 of the present invention;
[0052] Fig.10 A schematic diagram of the structure of the CIou loss function provided in the first embodiment of the present invention;
[0053] Fig.11 A schematic diagram of a module of a transmission line insulator defect detection system based on improved YOLOv8n provided in the second embodiment of the present invention;
[0054] Fig.12 It is a schematic diagram of the structure of the network side server provided according to the third embodiment of the present invention. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] First embodiment:
[0057] The first embodiment of the present invention provides a defect detection method for transmission line insulators based on improved YOLOv8n, including: collecting insulator defect images in the transmission line, and preprocessing the images to obtain an initial data set; performing data enhancement on the images in the initial data set to obtain a target data set; dividing the target data set into a training set, a validation set, and a test set; using the YOLOv8n network model as a benchmark model to construct an improved YOLOv8n network model as an insulator defect detection network model; inputting the training set into the insulator defect detection network model for model training, and improving the insulator defect detection network model parameters based on the training results to obtain a trained insulator defect detection network model; inputting the validation set into the trained insulator defect detection network model for model evaluation; and inputting the test set into the trained insulator defect detection network model to obtain an insulator defect detection result. The improved YOLOv8n network model of the present invention efficiently and accurately detects and extracts insulator defects, and the model has good migration and generalization.
[0058] The following is a detailed description of the implementation details of the defect detection method for transmission line insulators based on improved YOLOv8n in this embodiment. The following content is only for the convenience of understanding the implementation details, which is not necessary for the implementation of this solution. The specific process of this embodiment is as follows: Figure 1 As shown, this embodiment is applied to a defect detection system for transmission line insulators based on improved YOLOv8n.
[0059] Step S1, collecting defect images of insulators in a transmission line, and preprocessing the images to obtain an initial data set.
[0060] Specifically, drones are used to collect insulator defect images of transmission lines and construct an insulator defect image dataset. In the dataset, the original images are preprocessed by first segmenting and then labeling according to the characteristics of insulator defect images. The images are segmented into small blocks, and then the defects of the segmented small images are labeled to obtain the initial dataset.
[0061] Step S2, performing data enhancement on the images in the initial data set to obtain a target data set.
[0062] Specifically, data enhancement of images in the initial data set includes image rotation, image brightness adjustment and image noise addition. Image rotation is to rotate the images in the initial data set around a certain center point by a certain angle, so that the model can learn the characteristics of the image at different angles. Image brightness adjustment is to increase or decrease the overall brightness of the image, which is achieved by linearly or nonlinearly adjusting the brightness channel of each pixel of the image, that is, the red, green, and blue channels in the RGB color space. Adding noise to the image can add Gaussian distributed random noise to the image or randomly generate white and black pixels in the image to simulate noise interference during image acquisition. By performing data enhancement on the images in the initial data set, the size of the data set is increased, and then the target data set is obtained.
[0063] Step S3, dividing the target data set into a training set, a validation set and a test set.
[0064] Specifically, the images are randomly divided into training set, validation set and test set in the ratio of 7:2:1.
[0065] Step S4, using the YOLOv8n network model as a benchmark model to construct an improved YOLOv8n network model as an insulator defect detection network model.
[0066] Specifically, if Figure 2 As shown in the figure, the existing YOLOv8n model is mainly composed of a backbone network, a neck network and a detection head. Among them, the backbone network includes a CBS module, a C2f module, and an SPPF module, where C2f is a feature extraction-fusion module in YOLOv8n. Among them, C2f consists of a Conv module and a varying number of Bottleneck modules, and the number of Bottleneck modules is determined by the width factor of the model. Bottleneck is a basic module with a residual structure. The neck network accepts the feature layer from the backbone network as input, and uses the C2f module, the Concat module and the upsampling operation to perform feature fusion, and finally outputs a feature map. The detection head contains detection branches for three target scales: large, medium and small, and each branch is responsible for detecting targets of different scale ranges. YOLOv8 changes the size of the model by adjusting the network depth and width control factors. There are five models from small to large: v8n, v8s, v8m, v8l, and v8x.
[0067] The improved network based on YOLOv8n mainly includes model lightweighting and performance optimization. The detailed structure is as follows Figure 3 As shown, the specific steps are as follows:
[0068] Step S41, embedding the C2f module into the CD_LSK module.
[0069] Specifically, if Figure 4 As shown in the figure, the existing C2f module first consists of a convolutional block (CBS) that receives the input feature map and generates an intermediate feature map. The generated intermediate feature map is split into two parts, one part is directly passed to the final Concat block, and the other part is passed to multiple Bottleneck blocks for further processing. The feature maps input to these Bottleneck blocks are processed through a series of convolution, normalization, and activation operations, and the final feature map generated is concatenated (Concat) with the directly passed part of the feature map in the Concat block. In the C2f module, the number of Bottleneck modules is defined by the depth muliple (width factor) parameter of the model, which means that the depth and computational complexity of the module can be flexibly adjusted according to needs. Final convolution block: The concatenated feature map is input to a final convolution block for further processing to generate the final output feature map.
[0070] In this embodiment, a CD_LSK module is added before passing it to the Botleneck block. The specific working process of the CD_LSK module includes: the module consists of two large kernel convolutions and a multi-scale feature dynamic selection kernel. First, the feature map passed in previously is explicitly convolved with two large kernels to generate multiple features with various large receptive fields, which makes subsequent kernel selection easier. Secondly, sequential decomposition is more effective than simply applying a single larger kernel. Finally, in order to enhance the network's ability to focus on the most relevant spatial context area to detect targets, a spatial selection mechanism is used to spatially select feature maps from large convolution kernels of different scales.
[0071] like Figure 5 As shown in the figure, in traditional small target detection, the importance of prior knowledge in complex backgrounds for accurately detecting tiny targets is often ignored. These tiny targets usually require contextual feature information with a larger receptive field to be correctly identified. CD_LSK uses a spatial selection mechanism to spatially select feature maps from large convolution kernels of different scales, enhancing the network's ability to focus on the most relevant spatial context areas to detect targets, thereby improving the accuracy and robustness of the model in small target detection tasks.
[0072] like Figure 6 As shown in the figure, by embedding the CD_LSK module in the C2f module and increasing the receptive field of the context of the feature extraction module CDK by adding large kernel convolution attention, the defect feature extraction of the insulator is improved.
[0073] Step S42, introducing the PConv partial convolution module.
[0074] Specifically, if Figure 7As shown in the figure, in traditional small target detection, the importance of prior knowledge in accurately identifying small targets in complex backgrounds is often ignored. These small targets need to obtain contextual feature information with a larger receptive field in order to be correctly identified. PConv can more effectively extract effective information from the input feature map through the partial convolution mechanism, avoiding the interference of invalid areas on small target detection. Its flexible convolution method enables the model to focus on important feature areas, enhances the sensitivity to small targets and positioning accuracy, thereby improving the model's small target detection performance in complex environments.
[0075] The feature maps between different channels have high similarity. Specifically, PConv can reduce computational redundancy and memory access. Figure 7 As shown in Figure 1, PConv applies regular Conv only on some input channels for spatial feature extraction, while the rest of the channels remain unchanged. For continuous or regular memory access, PConv treats the first or last continuous cp channel as a representative of the entire feature map for calculation. Without loss of generality, we consider the input and output feature maps to have the same number of channels. Therefore, the computational cost of PConv is only:
[0076]
[0077] Among them, h is the height of the convolution kernel, w is the width of the convolution kernel, k is the size of the convolution kernel, and c is the p is the number of partial channels of normal convolution.
[0078] In typical part ratios In this case, the FLOPs of PConv is only 1 / 2 of that of regular Conv. In addition, PConv has less memory access, i.e.
[0079]
[0080] That is, for When PConv is used, the computational effort is only that of conventional Conv.
[0081] Among them, h is the height of the convolution kernel, w is the width of the convolution kernel, k is the size of the convolution kernel, and c is the p is the number of partial channels of normal convolution.
[0082] Step S43, introducing the FocalModulation module.
[0083] Specifically, if Figure 8As shown in the figure, when the traditional SPPF module performs multi-scale sampling and fusion on the input feature map, the receptive field is related to the target size: a large receptive field is beneficial to large targets, and a small receptive field is beneficial to small targets. The deeper the network and the more frequent downsampling, the more likely it is that the position information will be lost and the resolution will be reduced, making it difficult to accurately locate the target and increasing the difficulty of identifying large and small targets. Replacing it with FocalModulation can focus on extracting key information of the image and enhance the retention of information in the deep network.
[0084] like Fig. 9 As shown in the figure, the working process of FocalModulation includes: first, the input image is subjected to feature extraction through the backbone network to generate a multi-layer feature map; then, the feature modulation module is applied to process these feature maps, and an important feature is enhanced by introducing a modulation factor, while irrelevant or interfering features are suppressed; then, the focusing mechanism acts on the feature map to dynamically adjust the weight of each position to ensure that the model pays more attention to difficult-to-detect objects or complex background areas; finally, after processing by the classification and regression heads, the category and position of the target are output, thereby achieving target detection and segmentation tasks and improving detection accuracy in challenging scenarios.
[0085] Step S44, replace the loss function CIoU in the original YOLOv8n with Powerful-Iou.
[0086] The loss function of the original YOLOv8 is CIoU, and the calculation formula of CIoU is:
[0087]
[0088] Among them, d is the distance between the center point of the predicted box and the real box, c is the diagonal distance of the minimum enclosing rectangle, and v is the correction factor.
[0089] Since v is a correction factor, it is used to further adjust the loss function to take into account the shape and direction of the target box. The specific calculation formula of the correction factor v is:
[0090]
[0091] Among them, w G is the width of the target box, h G is the height of the target box, w P is the width of the prediction box, h P is the height of the prediction box.
[0092] The CIou loss function may cause the anchor box to expand, thus affecting the detection accuracy of small objects. Powerful-IoU can effectively avoid this problem through an improved loss calculation method, making the bounding box of small objects more consistent with the real object. Fig.10As shown, the calculation formula of Powerful-Iou is as follows:
[0093]
[0094] L IoU =1-IoU
[0095] PIoU=IoU-f(P),-1≤PIoU≤1,
[0096] L PIoU =1-PIoU=L IoU +f(P),0≤L PIoU ≤2
[0097] In order to solve the problem of anchor box expansion and the limitations of the existing IoU-based loss function, PIou proposes a penalty factor P that adapts to the target size. The penalty factor is defined as follows:
[0098]
[0099] Among them, dw1, dw2, dw2, dh2 are the absolute values of the distances between the predicted box and the corresponding edge of the target box, W gt is the width of the target box, h gt The height of the target box.
[0100] Using P as the penalty factor in the loss function does not cause the anchor box to be enlarged, because the denominator of P depends only on the size of the target box and is independent of the size of the smallest external box of the anchor box and the target box. Unlike the penalty factors used in other loss functions, anchor box enlargement does not change P. In addition, P will never degenerate to 0 unless the anchor box completely overlaps with the target box. In addition, P shows adaptability to the target size.
[0101] In insulator defect detection, the Powerful-Iou loss function may not fully consider the feature differences of small targets. By introducing the width weight W_dw and height weight W_dh of the target box in the calculation of the penalty factor P, the modified penalty coefficient formula is as follows:
[0102]
[0103] Among them, dw1, dw2, dw2, dh2 are the absolute values of the distances between the predicted box and the corresponding edge of the target box, W gt is the width of the target box, h gt is the height of the target box, W_dw is the width weight of the target box, and W_dh is the height weight of the target box.
[0104] In this case, the focus on the difference between the horizontal and vertical bounding boxes is enhanced. The purpose of this change is to improve the model's sensitivity to small targets such as flash, damage, and string drop. Small targets are often difficult to accurately identify in complex backgrounds. Increasing the weight makes the loss function focus more on these key features during the optimization process, thereby effectively reducing the missed detection rate. The experimental results show that after the weight adjustment, the model has significantly improved in detection accuracy and recall rate. Table 1 below is an experimental diagram of different weights. Finally, after considering the three comprehensive indicators of P, R, and map, it is concluded that the width weight W_dw and the height weight W_dh are both 0.7.
[0105] Table 1 Performance comparison of different weights in Powerful-Iou loss function
[0106]
[0107] Step S5, inputting the training set into the insulator defect detection network model for model training, and improving the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model.
[0108] Specifically, the experimental environment was built using the Pytorch-GPU training framework and Python language to implement the deep learning training environment, using CUDA version 11.7 and GPU version NVIDIA GeForce RTX 4060. The network parameters were set to set the image training size to 640X640 and use the Adam optimizer to optimize the network to speed up the training process; and the learning rate was adjusted through the cosine function; the epoch was set to 200 and the batch-size was set to 8.
[0109] Step S6, inputting the verification set into the trained insulator defect detection network model for model evaluation.
[0110] Specifically, the validation set is input into the trained insulator defect detection network model for model evaluation, including: inputting the test set into the trained insulator defect detection network model, and evaluating the insulator defect detection network model based on its precision rate P, recall rate R and mean average precision mAP.
[0111] Specifically, the comparison of model parameters before and after improvement is shown in Table 2.
[0112] Table 2 Performance comparison of the model before and after improvement
[0113]
[0114] The improved model has improved its accuracy by 6.1%, its recall by 3.5%, and its average precision by 3%. It can be seen that the improved YOLOv8n model has significantly improved the defect detection of insulators.
[0115] The indicator formula for evaluating model performance is as follows:
[0116]
[0117] Among them, TP is the number of correctly predicted positive samples, FN is the number of incorrectly predicted negative samples, and FP is the number of incorrectly predicted positive samples.
[0118] Step S7, inputting the test set into the trained insulator defect detection network model to obtain the insulator defect detection result.
[0119] The first embodiment of the present invention provides a defect detection method for transmission line insulators based on improved YOLOv8n, comprising: collecting insulator defect images in the transmission line, and preprocessing the images to obtain an initial data set; performing data enhancement on the images in the initial data set to obtain a target data set; dividing the target data set into a training set, a validation set, and a test set; using the YOLOv8n network model as a benchmark model to construct an improved YOLOv8n network model as an insulator defect detection network model; inputting the training set into the insulator defect detection network model for model training, and improving the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model; inputting the validation set into the trained insulator defect detection network model for model evaluation; and inputting the test set into the trained insulator defect detection network model to obtain the insulator defect detection result. The invention uses the YOLOv8n network model as a benchmark model to construct an improved YOLOv8n network model as an insulator defect detection network model. By embedding a CD_LSK module in a C2f module, multi-scale features can be more effectively integrated and processed, and the ability to capture detail information and small targets is enhanced. Not only the feature expression ability is improved, but also the feature transmission between different levels is optimized, so that the model performs better in complex scenes. The PConv partial convolution module is introduced. The PConv applies conventional Conv only on part of the input channels to extract spatial features, while the remaining channels remain unchanged. For continuous or conventional memory access, the first or last continuous cp channel is regarded as a representative of the entire feature map for calculation. While reducing redundant calculations, spatial features can be extracted more effectively. The FocalModulation module is introduced. The FocalModulation uses an attention mechanism to focus on key areas in the image, thereby improving the model's recognition ability of these areas. Compared with SPPF, FocalModulation can not only process input images of different scales, but also more accurately identify and locate objects in the image, and is particularly suitable for processing difficult-to-detect objects and objects in complex backgrounds. The loss function CIoU in the original YOLOv8n is replaced by Powerful-Iou. Powerful-IoU is an improved loss function that can accelerate the convergence of bounding box regression and improve target detection performance. The Powerful-IoU loss function combines the target size adaptive penalty factor and the gradient adjustment of the anchor box quality. In order to better focus on the detection of small targets in insulator defects, a new bounding box difference weight is introduced in the penalty coefficient P in Powerful-IoU, so that the model pays more attention to the sensitivity of small targets; the improved YOLOv8n network model can efficiently and accurately detect and extract insulator defects, and the model has good migration and generalization.
[0120] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed 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 to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0121] Second implementation method:
[0122] like Fig.11 As shown, the second embodiment of the present invention provides a defect detection system for transmission line insulators based on improved YOLOv8n, and the system includes: a data set acquisition module 201, a data set enhancement module 202, a data set division 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.
[0123] Specifically, the data set acquisition module 201 is used to acquire insulator defect images in the transmission line and preprocess the images to obtain an initial data set; the data set enhancement module 202 is used to perform data enhancement on the images in the initial data set to obtain a target data set; the data set division module 203 is used to divide the target data set into a training set, a validation set and a test set; the improved modeling module 204 is used to construct an improved YOLOv8n network model as an insulator defect detection network model with the YOLOv8n network model as a benchmark model; the model training module 205 is used to input the training set into the insulator defect detection network model for model training, and improve the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model; the model verification and evaluation module 206 is used to input the verification set into the trained insulator defect detection network model for model evaluation; the detection result generation module 207 is used to input the test set into the trained insulator defect detection network model to obtain the insulator defect detection result.
[0124] It is not difficult to find that this embodiment is a system embodiment 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 in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.
[0125] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.
[0126] A third embodiment of the present invention relates to a network side server, such as Fig.12 As shown, it includes at least one processor 302; and a memory 301 that is communicatively connected to the at least one processor 302; wherein the memory 301 stores instructions that can be executed by the at least one processor 302, and the instructions are executed by the at least one processor 302 so that the at least one processor 302 can execute the above-mentioned data processing method.
[0127] The memory 301 and the processor 302 are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors 302 and the 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 are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor 302 is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor 302.
[0128] The 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. The memory 301 can be used to store data used by the processor 302 when performing operations.
[0129] The fourth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the defect detection method for transmission line insulators based on improved YOLOv8n in the first embodiment is implemented.
[0130] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0131] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is not described in detail here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field of the invention before the application date or priority date, can obtain all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The protection scope required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.
[0132] 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 in the protection scope of the present invention.
Claims
1. A defect detection method for transmission line insulators based on improved YOLOv8n, characterized in that: include: S1, collects insulator defect images in transmission lines and preprocesses the images to obtain an initial data set; S2, performing data enhancement on the images in the initial data set to obtain a target data set; S3, dividing the target data set into a training set, a validation set and a test set; S4, using the YOLOv8n network model as the benchmark model to build an improved YOLOv8n network model as the insulator defect detection network model; S5, inputting the training set into the insulator defect detection network model for model training, and improving the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model; S6, inputting the verification set into the trained insulator defect detection network model for model evaluation; S7, inputting the test set into the trained insulator defect detection network model to obtain an insulator defect detection result.
2. The defect detection method for transmission line insulators based on improved YOLOv8n according to claim 1 is characterized in that: In S1, the insulator defect images in the transmission line are collected and preprocessed to obtain an initial data set, including: Unmanned aerial vehicles (UAVs) are used to collect insulator defect images of transmission lines and construct an insulator defect image dataset. In the dataset, the original images are preprocessed by the method of segmentation before labeling according to the characteristics of insulator defect images. The images are segmented into small blocks, and then the defects of the segmented small images are labeled to obtain the initial dataset.
3. The defect detection method for transmission line insulators based on improved YOLOv8n according to claim 1 is characterized in that: In S4, the improved YOLOv8n network model is constructed as the insulator defect detection network model based on the YOLOv8n network model as the benchmark model, including: Step S41, embedding the C2f module into the CD_LSK module; Step S42, introducing the PConv partial convolution module; Step S43, introducing the FocalModulation module; Step S44, replace the loss function CIoU in the original YOLOv8n with Powerful-Iou.
4. The defect detection method for transmission line insulators based on improved YOLOv8n according to claim 3 is characterized in that: The method of embedding the C2f module into the CD_LSK module comprises: adding the CD_LSK module before passing it to the Botleneck block; the specific working process of the CD_LSK module comprises: firstly, explicitly generating multiple features with various large receptive fields from the feature map previously passed in through two large kernel convolutions; secondly, sequential decomposition is more effective than simply applying a single larger kernel; finally, in order to enhance the ability of the network to focus on the most relevant spatial context area to detect the target, a spatial selection mechanism is used to spatially select feature maps from large convolution kernels of different scales.
5. The defect detection method for transmission line insulators based on improved YOLOv8n according to claim 3 is characterized in that: The introduction of the FocalModulation module includes: the working process of FocalModulation is as follows: first, the input image is subjected to feature extraction through a backbone network to generate a multi-layer feature map; then, the feature modulation module is applied to process the feature maps, and important features are enhanced by introducing a modulation factor, while irrelevant or interfering features are suppressed; then, the focusing mechanism acts on the feature map to dynamically adjust the weight of each position to ensure that the model pays more attention to difficult-to-detect objects or complex background areas; finally, after being processed by the classification and regression heads, the category and position of the target are output to achieve target detection and segmentation tasks, thereby improving the detection accuracy in challenging scenarios.
6. The defect detection method for transmission line insulators based on improved YOLOv8n according to claim 1 is characterized in that: The loss function CIoU in the original YOLOv8n is replaced with Powerful-Iou, including that in insulator defect detection, the Powerful-Iou loss function fails to fully consider the feature differences of small targets; by introducing the width weight W_dw and height weight W_dh of the target box in the calculation of the penalty factor P, the modified penalty coefficient formula is as follows: Among them, dw1, dw2, dw2, dh2 are the absolute values of the distances between the predicted box and the corresponding edge of the target box, W gt is the width of the target box, h gt is the height of the target box, W_dw is the width weight of the target box, and W_dh is the height weight of the target box.
7. The defect detection method for transmission line insulators based on improved YOLOv8n according to claim 6 is characterized in that: In S6, the step of inputting the validation set into the trained insulator defect detection network model for model evaluation includes: inputting the test set into the trained insulator defect detection network model, and evaluating the insulator defect detection network model based on its precision rate P, recall rate R, and mean average precision mAP; the indicator formula for evaluating the model performance is as follows: Among them, TP is the number of correctly predicted positive samples, FN is the number of incorrectly predicted negative samples, and FP is the number of incorrectly predicted positive samples.
8. A defect detection system for transmission line insulators based on improved YOLOv8n, characterized in that: The defect detection method for transmission line insulators based on improved YOLOv8n as described in claim 1, wherein the system comprises: The data set acquisition module is used to acquire insulator defect images in the transmission line and pre-process the images to obtain an initial data set; A data set enhancement module, used to perform data enhancement on the images in the initial data set to obtain a target data set; A data set partitioning module, used to partition the target data set into a training set, a validation set and a test set; An improved modeling module is used to construct an improved YOLOv8n network model as an insulator defect detection network model using the YOLOv8n network model as a benchmark model; A model training module is used to input the training set into the insulator defect detection network model for model training, and improve the insulator defect detection network model parameters based on the training results to obtain the trained insulator defect detection network model; A model verification and evaluation module, used for inputting a verification set into the trained insulator defect detection network model for model evaluation; The detection result generation module is used to input the test set into the trained insulator defect detection network model to obtain the insulator defect detection result.
9. 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, and the instructions are executed by the at least one processor to enable the at least one processor to execute the defect detection method for transmission line insulators based on improved YOLOv8n as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the defect detection method for transmission line insulators based on improved YOLOv8n according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Lightweight strawberry maturity detection method based on RD-YOLO model
CN120088775A