Insulator defect detection method based on improved yolov5

By performing data expansion and feature layer fusion optimization on the yolov5 model, the problem of insufficient detection accuracy of small insulator defects is solved, and efficient and real-time identification of insulator defects is achieved, with the detection accuracy reaching 98.7%.

CN118941983APending Publication Date: 2024-11-12DINGXING COUNTY POWER SUPPLY BRANCH OF STATE GRID HEBEI ELECTRIC POWER CO LTD +2
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410921477.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The existing yolov5 model lacks accuracy when detecting small or micro insulator defects, and is not efficient when processing image data, making it difficult to achieve real-time recognition.

Method used

By augmenting the transmission line data set, using OpenCV for image processing, combining convolutional neural network and attention mechanism, the yolov5 model is optimized to improve detection accuracy and efficiency, including data enhancement strategies such as image rotation, cropping, and color transformation. The feature layer fusion mechanism was introduced in the Neck section to enhance the multi-scale feature fusion performance.

Benefits of technology

It realizes high-precision identification of insulator defects, with a detection accuracy of 98.7%, greatly improving processing efficiency, and is suitable for real-time inspection environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118941983A_ABST
    Figure CN118941983A_ABST
Patent Text Reader

Abstract

The invention discloses an insulator defect detection method based on improved yolov5, and the method comprises the steps: firstly, extracting related features according to the related features of a data set of a power transmission line, and obtaining enough sample data; secondly, construction of a convolutional neural network lightweight model is completed, and model training is completed by using acquired power transmission line sample data; and finally, positioning and classifying the defects of the power transmission line under a complex background through a plurality of power transmission line training sets and test sets. The method provided by the invention has the highest detection precision, the average detection precision can reach 98.7%, and the method is a simple, effective and high-practicability power transmission line defect identification method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an image processing and defect detection method, and in particular to an insulator defect detection method based on an improved YOLO V5. Background Art

[0002] As a clean energy, electricity plays an important role in people's daily lives. Especially in the context of my country's rapid economic development and increasing urbanization, the demand for electricity continues to expand, and the scale of the power grid has also increased, which has directly led to an increase in the total electricity consumption of the whole society. In order to ensure the safety of national electricity consumption and stable economic development, the distribution department needs to conduct daily inspections of distribution lines, including damage and missing of hardware components and equipment operation status. Therefore, regular inspections of distribution lines to discover and solve potential problems and ensure the smooth and reliable operation of distribution lines are important measures to prevent economic losses.

[0003] At present, there are four inspection methods for overhead lines in my country: manual, mechanical, helicopter, and drone inspection. Among them, the manual inspection method mainly involves inspectors inspecting the distribution lines through human eyes and auxiliary equipment. However, due to the increasing scale and intelligent development of power grids, manual inspection has exposed many disadvantages such as heavy workload, harsh environment, and low efficiency.

[0004] With the increase in electricity demand at the social level, there are more and more power lines, and the inspection work is becoming increasingly arduous. In order to deal with the many disadvantages of manual inspection, such as poor safety, high cost, and heavy workload, power companies in many countries have begun to look for more intelligent and efficient solutions. Foreign power researchers have explored the use of manned helicopters for line inspections and other tasks. Due to the high cost of flying helicopters, power companies have turned to research on drone-assisted inspections. my country started late in the research on drone line inspection technology, but it has developed rapidly in recent years. Major power grid companies, research institutes, and universities have conducted a lot of research on drone inspection technology and achieved good results.

[0005] At present, many methods for power transmission line defect detection have been proposed at home and abroad. However, they can be roughly divided into two categories according to the detection method. One category is to use traditional image processing technology for detection, and the other is to use deep neural network methods for detection. Each category of methods contains a variety of specific methods. Among them, the power transmission line defect detection methods based on traditional image processing include edge detection, harr wavelet transform, and the power transmission line defect detection methods based on deep learning include Faster R-CNN network, SSD network, transfer learning, and YOLOv3 network. Summary of the invention

[0006] The technical problem to be solved by the present invention is that defect detection of insulators in power systems requires high-precision identification of small defects and minor damages. Although the original YOLOv5 model performs well in general target detection tasks, it needs further optimization to improve the detection accuracy for specific small or minor defects, such as cracks, breakage or corrosion. It must also be fast enough to process a large amount of image data in real time and quickly identify insulators with problems. To address this problem, the present invention provides an insulator defect detection method based on an improved YOLOv5.

[0007] To achieve the above object, the present invention provides the following solutions:

[0008] An insulator defect detection method based on improved yolov5 comprises the following steps: S1: extract relevant features according to relevant characteristics of a transmission line data set to obtain sufficient sample data; obtain transmission line defect data, enrich the data set based on OpenCV data expansion, perform image compression, image rotation, image cropping, and image color conversion in four forms, expand the overhead line hazardous object data set, use the resize function in OpenCV to modify the image resolution, determine the interpolation method when calling the resize function, use bilinear interpolation to complete the adjustment of the image resolution, and bilinear interpolation means performing linear interpolation in the x and y directions respectively; S2: complete the construction of a lightweight model of a convolutional neural network, and use the obtained transmission line sample data to complete model training at the same time, and analyze the principle of the attention mechanism based on the yolov5 algorithm; S3: establish a transmission line fault recognition network, and realize the positioning and classification of transmission line defects under complex backgrounds through multiple transmission line training sets and test sets.

[0009] Preferably, the data expansion strategies adopted by S1 include angle rotation, saturation adjustment, denoising and defogging, image flipping and translation morphological operations; the image rotation is realized by using the rotate function in the OpenCV library. The rotate function rotates the image 90°, 180°, and 270° according to different parameters. Point A (x1, y1) rotates a certain degree to point B (x2, y2). According to trigonometric functions, there is the following relationship:

[0010] x2=Dcos(α+β)=xcosβ-ysinβ

[0011] y2=Dsin(α+β)=xsinβ+ycosβ

[0012] In the formula, D represents the distance between points A and B and the origin, α represents the angle between the line connecting point A and the origin and the x-axis, β represents the angle of rotation of point B relative to point A, and (α+β) represents the angle between the line connecting point B and the origin and the x-axis. When processing a large number of images, the calculation is usually carried out in the form of a matrix. The matrix calculation expression for image rotation is as follows:

[0013]

[0014] [x2 y2 1]=[xy 1]×R

[0015] Wherein, R represents the rotation factor.

[0016] Preferably, the network structure of the yolov5 algorithm in S2 specifically includes:

[0017] The input part mainly completes image preprocessing, converts the input image size into the network input size, data enhancement and adaptive anchor frame calculation; the Backbone part mainly completes the extraction of image feature information. In this part, the Focus module divides, connects and re-convolves the image, which is equivalent to the downsampling operation; the CBL module consists of the convolution operation Conv layer, the normalization operation BN layer and the SiLU activation function; CSP1_X structure, where X represents the residual component used in the CSP structure, each residual component uses 2 CBL structures, and the SPP module uses kernels of 1×1, 9×9 and 13×13 for maximum pooling to meet the final input consistency. The Neck part mainly completes multi-scale feature fusion and adopts the FPN+PAN structure.

[0018] Preferably, S2 specifically includes allowing the model to focus on important parts of the input data during the calculation process of the model. Once the scores are calculated, a normalization function is used to convert these scores into probability form, and all weights add up to 1.

[0019] Preferably, the normalization function is a softmax function.

[0020] Preferably, a deep learning model Transformer network based on self-attention mechanism is used to replace the LSTM network in the ELMo model;

[0021] In the self-attention mechanism, each position of the input sequence is associated with other positions, and the importance of each position is determined by calculating the attention weight. Such attention calculation captures the global dependencies in the sequence. The multi-head self-attention mechanism learns multiple different representation subspaces by applying the attention mechanism multiple times, each time using a different linear projection; the Transformer model also introduces residual connections and layer normalization techniques.

[0022] Preferably, S3 specifically includes: adding a layer of feature fusion in the Neck of yolov5, so that the network model can obtain more effective information in the multi-scale feature fusion process.

[0023] Preferably, in order to improve the fusion performance of the yolov5 network model for multi-scale feature maps, an enhanced optimization strategy called Neck is proposed, which introduces a feature layer fusion mechanism to obtain more effective information in the multi-pixel feature fusion process during the network model process.

[0024] Preferably, the yolov5 loss function Loss includes boundary regression loss Loss, confidence prediction loss and category prediction loss Loss; yolov5 uses GIoU Loss to calculate boundary regression loss, BECLogits loss function to calculate confidence loss, and cross entropy loss function to calculate category prediction loss.

[0025] Preferably, the loss formula is as follows:

[0026] Loss=Loss (coord) +Loss (conf) +Loss (cls)

[0027] Loss (coord) =1-GIoU

[0028]

[0029] Where IoU stands for intersection over union, which measures the overlap between two bounding boxes; A stands for the predicted bounding box; B stands for the true bounding box; C stands for the minimum bounding box that contains A and B; GIoU stands for generalized intersection over union, which is an extension of IoU that takes into account non-overlapping areas; S×S stands for the number of cells in the grid size that the image is divided into; represents the indicator function, indicating whether the target appears in cell i and bounding box j; represents the indicator function, indicating whether the target does not appear in cell i and bounding box j; C i represents the prediction confidence score of cell i; p i represents the actual probability of category c in cell i; classes represents the set of all possible categories; Loss (coord) Represents boundary regression loss, Loss (conf) Represents the confidence prediction loss, Loss (cls) represents the category prediction loss;

[0030] Where S is the network size, I represents the i-th square of the feature map, j represents the j-th prediction box predicted by the square, and the subscripts obj and nobj indicate whether there is an object in the i-th square.

[0031] Beneficial effects of the present invention:

[0032] The present invention uses the YOLO algorithm based on deep learning to detect insulator defects based on aerial images obtained by inspecting distribution lines with a high-definition camera carried by a drone. The method of the present invention is used to realize intelligent detection of the status of insulators in the line, thereby reducing the workload of line inspectors.

[0033] The method proposed in the present invention has the highest detection accuracy, with an average detection accuracy of up to 98.7%. It is a simple, effective and highly practical method for identifying defects in power transmission lines. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a bilinear interpolation graph;

[0035] Figure 2 This is the yolov5 network model diagram;

[0036] Figure 3 This is the result of the power transmission line defect detection under foggy weather;

[0037] Figure 4 This is the distribution line defect detection result under normal weather conditions. DETAILED DESCRIPTION

[0038] In order to describe the present invention in more detail, the present invention is further illustrated below with reference to the accompanying drawings and specific implementation examples.

[0039] An insulator defect detection method based on improved yolov5 comprises the following steps:

[0040] Step 1: Obtain transmission line defect data, including: In view of the current lack of public data sets for overhead line insulators, which cannot meet the training requirements of the target detection model, in order to prevent overfitting of the target detection model and improve the robustness of the model, the self-constructed data set is expanded.

[0041] The transmission line defect images were collected at a substation in a certain city. A drone carrying a camera was used to take photos at a distance of 25 to 70 cm from the defect. The images were taken from five angles: left side, right side, upward, downward, and front. A total of 5,000 original images were collected, and the size of the collected images was 600×600 pixels.

[0042] These images have the following characteristics:

[0043] (1) Overhead line hazardous objects are relatively small. For example, some engineering vehicles in the picture are far away from the shooting point, which reduces the effective information provided by the model during detection. In addition, they are easily affected by surrounding noise during feature extraction, which increases the difficulty of model detection.

[0044] (2) Overhead line hazardous objects are seriously blocked or overlapped. When multiple engineering vehicles are densely packed, hazardous objects will be blocked or overlapped. In addition, when shooting in densely populated cities, pedestrians, buildings and other objects will also block hazardous objects, affecting the final detection.

[0045] (3) There is a lot of interfering information in the image. When video surveillance is shot at a long distance, the image quality is affected by the surrounding environment. In addition, the target is small, so there may be a lot of noise in a picture. Even if the total number of pictures is large, the number of pictures that can be used for training is small.

[0046] (4) Abnormal shooting angles. Video surveillance usually uses a bird’s-eye view when shooting at close range. At this time, the dangerous objects are relatively large. However, when the model was trained, the images in the data set were all shot horizontally. This difference will also affect the model’s recognition results.

[0047] The distance between overhead lines and the ground is relatively short. When large-scale construction machinery such as truck dumpers, cranes, and tower cranes are moving under the corridors of overhead lines, they may touch each other and cause accidents such as line disconnection. In addition, the main causes of external force damage also include large excavators and bulldozers illegally digging the land around the pole towers during construction, resulting in unstable tower foundations or digging up ground cables. The failure downtime rate caused by external damage is high, so the present invention includes all construction machinery such as tower cranes, excavators, cranes, trucks, bulldozers, etc. in the identification range. In addition, the iron wires, branches, and excrement that birds hold in their mouths during nesting are prone to insulator flashover on cloudy or rainy days, threatening the safety and reliability of the power system. Affected by wind, branches and vines in bird nests are prone to hanging down, resulting in insufficient electrical safety distance between tower materials and conductors, reducing the reliability of transmission line operation.

[0048] The present invention uses OpenCV-based data expansion to enrich the data set.

[0049] This paper mainly expands the limited video surveillance data set. The resolution of the video surveillance image is 5472×3648. According to the input requirements of the yolov5 network structure, it is uniformly compressed to 640×640. In OpenCV, the resize function can modify the image resolution. When calling this function, you need to determine the interpolation method. Here, bilinear interpolation is used to adjust the image resolution. Bilinear interpolation means performing linear interpolation in two directions. This method is mainly used for resampling image textures. Because the use of non-integer scaling factors is reduced during calculation, image distortion can be effectively avoided.

[0050] In deep learning models, in order to reduce the overfitting problem, a large number of data samples are required for model training; in the model training stage, the more sufficient and comprehensive the collected data is, the more significant the model recognition effect is. Therefore, the number of samples is expanded by data augmentation methods. The data augmentation strategies used in the present invention include morphological operations such as angle rotation, saturation adjustment, denoising and defogging, image flipping and translation. After enhancement, 42,000 images are obtained as a data set.

[0051] Use the rotate function in the OpenCV library to rotate the image. This function can rotate the image 90°, 180°, and 270° according to different parameters. The principle of image rotation is as follows. Point A (x1, y1) rotates a certain degree to point B (x2, y2). According to trigonometric functions, there is the following relationship:

[0052] x2=Dcos(α+β)=xcosβ-ysinβ

[0053] y2=Dsin(α+β)=xsinβ+ycosβ

[0054] Where D is the distance between points A and B and the origin, α is the angle between the line connecting point A and the origin and the x-axis, β is the angle of rotation of point B relative to point A, and (α+β) is the angle between the line connecting point B and the origin and the x-axis. When processing a large number of images, the operation is usually performed in the form of a matrix. The matrix calculation expression for image rotation is as follows:

[0055]

[0056] [x2 y2 1]=[xy 1]×R

[0057] Where R represents the rotation factor.

[0058] In the previous article, four forms of image compression, image rotation, image cropping, and image color transformation were used to expand the overhead line hazardous objects dataset, bringing the total number of samples to 8,800.

[0059] Step 2: Introduce the basics of the yolov5 algorithm, including: multi-scale prediction, more complex loss functions and more efficient network structures. It supports inputs of various sizes, predicts target boundaries through specific anchor boxes, and achieves fast and accurate target detection. The model training of yolov5 is relatively simple and supports deployment in a variety of environments.

[0060] The YOLO (You Only Look Once) series of algorithms are a type of object detection algorithm based on deep learning, which has attracted widespread attention for its efficient real-time performance and high accuracy. The basic idea is to grid the feature map, and each grid is responsible for detecting the object that falls into it, and predict the bounding box, location confidence, and probability distribution of all categories of the objects contained in all grids at one time, so as to achieve efficient object detection in an end-to-end manner.

[0061] YOLO5 is the fifth version of the YOLO series of algorithms. Compared with previous versions, YOLO5 has significantly improved in speed and accuracy, and is therefore widely used in various application scenarios, such as remote sensing image analysis, traffic monitoring, and defect detection.

[0062] YOLOv5 is currently a more advanced single-stage target detection algorithm. Its Backbone refers to the idea of ​​CSPNet, uses an improved version of CSPNet as the main structure of the backbone network, and performs multi-scale fusion on the Neck end to improve prediction accuracy. At the same time, it uses the Pytorch framework to make its network scale smaller than YOLOv4. The network structure of YOLOv5 is as follows Figure 2 shown.

[0063] The input part mainly completes image preprocessing, converting the input image size into the network input size, data enhancement, and adaptive anchor box calculation. The Backbone part mainly completes the extraction of image feature information. In this part, the Focus module divides the image, connects and re-convolves it, which is equivalent to the downsampling operation, in order to retain all the information of the image; the CBL module consists of the convolution operation Conv layer, the normalization operation BN layer, and the SiLU activation function; the CSP1_X structure, where X represents the residual component used in the CSP structure, and each residual component uses 2 CBL structures, in order to reduce the model size while ensuring that the accuracy does not decrease. The SPP module uses the kernel of 1×1, 9×9, and 13×13 for maximum pooling to meet the final input consistency. The Neck part mainly completes multi-scale feature fusion, using the FPN+PAN structure.

[0064] Step 3: Analyze the principle of attention mechanism, including: During the calculation process of the model, the model can "focus" on the important parts of the input data, thereby improving the performance and efficiency of the model. Once the scores are calculated, a normalization function, such as the softmax function, is used to convert these scores into probabilistic form. This ensures that all weights add up to 1, allowing the model to effectively distribute its attention.

[0065] The attention mechanism originates from human visual attention. When people learn images, they first scan all the information of the entire picture, determine which information is the key learning content, and then learn the key learning content. Most of the background and noise in the picture will be ignored. This method can save learning resources and improve learning efficiency. In deep learning, the input and output of the attention mechanism have the same number of channels. Therefore, the attention mechanism will not change the number of channels of a certain layer of feature images in the network structure. Therefore, the attention mechanism can be used in any number of layers of the network without considering the influence of the number of channels. This feature gives the attention mechanism a plug-and-play advantage. The essence of the attention mechanism is a special weight, which corresponds to the input feature layer one by one. The size of the weight reflects which pixels in the feature layer are the key learning content. The larger the weight of a certain area, the more important it is to learn the target area. The smaller the weight of a certain area, the more important it is to learn the background area, and the learning of this area should be reduced. The current mainstream attention mechanisms include channel attention mechanism, spatial attention mechanism, coordinate attention mechanism, etc. Common insertion positions include between feature extraction network and feature fusion network, and between feature fusion network and YOLOhead. Different attention mechanisms have different effects on the same target detection model. The same attention mechanism will also have different effects on the target detection model at different addition positions.

[0066] Transformer is a deep learning model based on the self-attention mechanism. It was originally proposed by Vaswani et al. in 2017 and has been widely used in natural language processing tasks. It has become the most advanced method in many NLP tasks, such as machine translation, text generation, and semantic understanding. Large Transformer-based models are usually pre-trained on large corpora and then fine-tuned for tasks in specific fields. For example, BERT uses denoising self-supervised pre-training tasks. The GPT model was proposed by the OpenAI team in 2018. The model uses the Transformer network instead of the LSTM network in the ELMo model to better capture long-distance language structures.

[0067] In the self-attention mechanism, each position of the input sequence is associated with other positions, and the importance of each position is determined by calculating the attention weight. Such attention calculation can capture the global dependencies in the sequence while avoiding the traditional fixed window mechanism. The multi-head self-attention mechanism further improves the representation ability of the model by applying the attention mechanism multiple times, each time using different linear projections to learn multiple different representation subspaces. In addition, the Transformer model also introduces technologies such as residual connections and layer normalization, which are helpful for model training and optimization. Through residual connections, the model can better transfer gradients and avoid the problem of gradient vanishing or gradient exploding. Layer normalization helps to accelerate the convergence speed and stability of the model.

[0068] In general, the emergence of the Transformer model has achieved significant breakthroughs in natural language processing tasks and has become an important cornerstone in modern deep learning. It solves some inherent problems in sequence modeling by introducing the self-attention mechanism, providing powerful modeling capabilities for tasks such as translation, generation, and understanding. Although the Transformer initially made major breakthroughs in the field of natural language processing, its ideas and architecture also have great potential in the field of machine vision. The ViT (Vision Transformer) model for image classification proposed by Alexey et al. in 2020 has shown excellent performance in major visual tasks.

[0069] Step 4: Establish a transmission line fault identification network, specifically including: In order to improve the fusion performance of the network model for multi-scale feature maps, a layer of feature fusion is added to the Neck of yolov5, so that the network model can obtain more effective information in the process of multi-scale feature fusion and detect the target object more accurately.

[0070] In order to improve the fusion performance of the yolov5 network model for multi-scale feature maps, researchers proposed an enhanced optimization strategy called Neck. This strategy mainly focuses on improving the bounding box regression function to improve the accuracy of target object detection. The key innovation of Neck is the introduction of a feature layer fusion mechanism, which aims to enable the network model to obtain more effective information in the process of multi-pixel feature fusion.

[0071] In previous object detection algorithms, the fusion of multi-scale feature maps often uses simple operations, such as simple superposition or splicing. However, this simple fusion method is difficult to fully utilize the correlation information between feature maps of different scales, resulting in a decrease in the performance of the network model when processing targets with large scale changes. Therefore, in order to overcome this problem, Neck introduced a feature layer fusion mechanism, which performs weighted fusion of feature maps of different scales to better capture the feature information of the target object.

[0072] Specifically, Neck's feature layer fusion mechanism includes two key steps: feature map extraction and feature map fusion. In the feature map extraction stage, Neck extracts feature subgraphs with rich information from feature maps of different scales through different convolution operations. These feature subgraphs correspond to feature information of different scales, laying the foundation for subsequent fusion operations. In the feature map fusion stage, Neck introduces an attention mechanism to perform weighted fusion of feature subgraphs of different scales, so that the network model pays more attention to feature subgraphs with important information, reduces attention to irrelevant information, and improves the detection performance of the network model.

[0073] By introducing the enhanced optimization strategy of Neck, the researchers successfully improved the fusion performance of the yolov5 network model for multi-scale feature maps. Experimental results show that in the target object detection task, the yolov5 network model after using Neck has higher accuracy and robustness than the traditional model, especially when dealing with target objects with large scale changes. This research result provides an important reference value for the further development of target detection algorithms, and is expected to promote greater breakthroughs in target detection technology in practical applications. L = l obj +l cls +l box

[0074] Where, L represents the total loss; l obj represents the target confidence loss; l cls represents the classification loss; l box represents the bounding box regression loss.

[0075] The yolov5 loss function Loss includes boundary regression loss Loss(coord), confidence prediction loss Loss(conf) and category prediction loss Loss(cls). Yolov5 uses GIoU Loss to calculate boundary regression (bounding box) loss, BECLogits loss function to calculate confidence (objectness score) loss, and cross entropy loss function (BCEclsloss) to calculate category prediction (class probability score) loss. The loss formula is as follows:

[0076] Loss=Loss (coord) +Loss (conf) +Loss (cls)

[0077] Loss (coord) =1-GIoU

[0078]

[0079] Where S is the network size, I represents the i-th square of the feature map, j represents the j-th prediction box predicted by the square, and the subscripts obj and nobj represent whether there is an object in the i-th square. Step 5: Example simulation and experimental platform establishment, specifically including: In the Python 3.8 environment, by using the Pytorch framework to improve the yolov5 network model, the target detection task can be effectively implemented and optimized. The improvement process includes adjusting the model architecture, optimizing hyperparameters, or integrating new functions. Figure 3 and Figure 4 This is the result diagram of insulator defect detection using the improved yolov5 algorithm.

[0080] The experimental part of the present invention is written in Python and implemented using the PyTorch framework. PyTorch is an open source machine learning library widely used in the field of deep learning. Its flexibility and ease of use make it one of the preferred tools in research and practice. Based on PyTorch, we can easily build and train various complex neural network models and conduct efficient experiments and tests.

[0081] In terms of hardware environment, we chose a computer equipped with an Intel Core i5-7360U processor as the main operating platform. This processor uses a dual-core four-thread design, has high single-core and multi-core performance, and performs well in processing deep learning tasks. In addition, we also equipped it with 64GB of memory to ensure efficient management of data and computing resources when running large-scale experiments.

[0082] In order to speed up the model training process, two NVIDIA GTX 1080ti graphics cards are also configured. These two graphics cards can provide powerful computing power and support CUDA acceleration, which can significantly shorten the training time in deep learning tasks. By taking advantage of GPU parallel computing, we can complete model training and parameter optimization faster, thereby accelerating the progress of experiments and improving efficiency.

[0083] All experiments and tests are performed on the Ubuntu operating system. Ubuntu is a free and open source operating system based on the Linux kernel, known for its stability, security, and ease of use. Conducting deep learning experiments on this operating system can provide good stability and performance, and can also easily use various deep learning frameworks and tool libraries.

[0084] In general, we chose Python language and PyTorch framework as the programming environment for the experiment, and conducted the experiment on the hardware platform of Intel Core i5-7360U processor, 64GB memory and two NVIDIA GTX1080ti graphics cards. At the same time, we also used Ubuntu operating system as the operating environment of the experiment to ensure the stability and efficiency of the experimental process. Such hardware and software configuration can not only meet the experimental requirements, but also provide full guarantee for the accuracy and reliability of the experimental results.

[0085] mAP (mean average precision) is often used as an indicator to measure detection accuracy in target detection. The mAP indicator is obtained by averaging the AP (average precision) values ​​corresponding to multiple targets in the target detection task. The AP value is the area of ​​the PR curve drawn by the accuracy (precision) and recall (recall) in the prediction results. The calculation formulas for the accuracy, recall and AP indicators are as follows:

[0086]

[0087] In the formula, TP represents the number of cases where the prediction is positive and the actual result is also positive, FP represents the number of cases where the prediction is positive but the actual result is negative, and FN represents the number of cases where the prediction is negative but the actual result is positive.

[0088] Table 1 Comparison of mp index, AP index and running time of different algorithms

[0089] algorithm mAP metric AP Index Run time Traditional Neural Network 93.89% 93.26% 37ms Algorithm of the present invention 95.64% 94.98% 19ms

[0090] Figure 1 Bilinear interpolation is a commonly used image processing technique used to estimate new pixel values ​​on a known pixel value grid. It is based on the following principle: Assume that there is a continuous function in two-dimensional space. We know the value of the function at four points and need to estimate the value of the function at a position between these four points. Bilinear interpolation first determines a rectangular area based on the four known points, and then calculates the pixel value at the new position through linear interpolation based on the pixel values ​​and positional relationships in the area.

[0091] Figure 2 For the yolov5 network model, yolov5 adopts a backbone network structure based on CSPDarknet53, which is an efficient backbone network with strong feature extraction capabilities. In addition, yolov5 also introduces a novel feature Fusion The mechanism, namely the Focus concept, can better capture features of different scales.To ensure accuracy, Yolov5 introduces a multi-scale feature fusion module in the middle part of the network. This module can effectively fuse feature maps of different scales to better capture the information of objects of different scales.

[0092] Figure 2 A neural network architecture for object detection is shown, which may be based on the YOLO (You Only LookOnce) framework. Here is an explanation of each part:

[0093] 1. Input (604x604x3):

[0094] The input to the network is an image of size 604x604 with 3 color channels (RGB).

[0095] 2. Backbone network:

[0096] Focus: This layer splits the input image into 4 slices and concatenates them along the channel dimension, thus increasing the number of channels.

[0097] CBL: Convolutional layer followed by batch normalization and Leaky ReLU activation function.

[0098] CSP1_1 and CSP1_3: CSP (Cross Stage Part) layers. These layers are designed to reduce the amount of computation while maintaining accuracy. CSP1_1 and CSP1_3 represent CSP modules of different configurations or depths.

[0099] SPP (Spatial Pyramid Pooling): This layer helps to extract features at different scales and improve the robustness of the network to changes in target scale.

[0100] 3. Neck:

[0101] CBL and CSP2_1: Similar to the backbone network, these layers are used for further processing and feature extraction.

[0102] Upsample: These layers increase the spatial resolution of feature maps.

[0103] Concat: The concatenation layer is used to combine feature maps from different stages or scales.

[0104] The network alternates between upsampling and concatenation to fuse features from different scales, which helps detect objects of different sizes.

[0105] 4. Prediction:

[0106] CONV: Convolutional layer that outputs the final prediction.

[0107] The network outputs predictions at three different scales (20x20, 40x40, 80x80), each containing 255 channels. These channels encode bounding box coordinates, object confidence, and class probability.

[0108] The present invention discloses an insulator defect detection method based on improved YOLOv5. Aiming at the problem that the defect positioning of the transmission line defect recognition model based on deep learning is slow and inaccurate, an intelligent detection method for transmission line image recognition based on improved YOLOv5 is proposed. Firstly, the relevant features are extracted according to the relevant characteristics of the transmission line data set to obtain sufficient sample data; secondly, the lightweight model of the convolutional neural network is constructed, and the model training is completed by using the acquired transmission line sample data; finally, the positioning and classification of transmission line defects under complex backgrounds are realized through multiple transmission line training sets and test sets. The results show that the proposed algorithm has the highest detection accuracy, and the average detection accuracy can reach 98.7%. It is a simple, effective and practical transmission line defect recognition method.

Claims

1. An insulator defect detection method based on improved yolov5, characterized in that: The following steps are involved: S1: Extract relevant features based on the relevant characteristics of the transmission line data set to obtain sufficient sample data; The defect data of power transmission lines is obtained, and the data set is enriched based on OpenCV data expansion. Four forms of image compression, image rotation, image cropping, and image color transformation are performed to expand the data set of overhead line hazards. The resize function in OpenCV is used to modify the image resolution. When the resize function is called, the interpolation method is determined and the image resolution is adjusted using bilinear interpolation. Bilinear interpolation means performing linear interpolation in the x and y directions respectively. S2: Complete the construction of a lightweight convolutional neural network model, and use the obtained power transmission line sample data to complete model training. Based on the yolov5 algorithm, analyze the principle of the attention mechanism. S3: Establish a transmission line fault identification network, and realize the location and classification of transmission line defects in complex backgrounds through multiple transmission line training sets and test sets.

2. The insulator defect detection method based on improved yolov5 according to claim 1 is characterized in that: The data expansion strategies adopted by S1 include angle rotation, saturation adjustment, denoising and defogging, image flipping and translation morphological operations; the image rotation is realized by using the rotate function in the OpenCV library. The rotate function rotates the image 90°, 180°, and 270° according to different parameters. Point A (x1, y1) rotates a certain degree to point B (x2, y2). According to trigonometric functions, there is the following relationship: x2=Dcos(α+β)=xcosβ-ysinβ y2=Dsin(α+β)=xsinβ+ycosβ In the formula, D represents the distance between points A and B and the origin, α represents the angle between the line connecting point A and the origin and the x-axis, β represents the angle of rotation of point B relative to point A, and (α+β) represents the angle between the line connecting point B and the origin and the x-axis. When processing a large number of images, the calculation is usually carried out in the form of a matrix. The matrix calculation expression for image rotation is as follows: [x2y2 1]=[xy 1]×R Wherein, R represents the rotation factor.

3. The insulator defect detection method based on improved yolov5 according to claim 1 is characterized in that: The network structure of the yolov5 algorithm in S2 specifically includes: The input part mainly completes image preprocessing, converts the input image size into the network input size, data enhancement and adaptive anchor frame calculation; the Backbone part mainly completes the extraction of image feature information. In this part, the Focus module divides, connects and re-convolves the image, which is equivalent to the downsampling operation; the CBL module consists of the convolution operation Conv layer, the normalization operation BN layer and the SiLU activation function; CSP1_X structure, where X represents the residual component used in the CSP structure, each residual component uses 2 CBL structures, and the SPP module uses kernels of 1×1, 9×9 and 13×13 for maximum pooling to meet the final input consistency. The Neck part mainly completes multi-scale feature fusion and adopts the FPN+PAN structure.

4. The insulator defect detection method based on improved yolov5 according to claim 1 is characterized in that: S2 specifically involves focusing the model on the important parts of the input data during the model calculation process. Once the scores are calculated, a normalization function is used to convert these scores into probabilistic form, and all weights add up to 1.

5. The insulator defect detection method based on improved yolov5 according to claim 4 is characterized in that: The normalization function is the softmax function.

6. The insulator defect detection method based on improved yolov5 according to claim 5 is characterized in that: The Transformer network, a deep learning model based on the self-attention mechanism, was used to replace the LSTM network in the ELMo model; In the self-attention mechanism, each position of the input sequence is associated with other positions, and the importance of each position is determined by calculating the attention weight. Such attention calculation captures the global dependencies in the sequence. The multi-head self-attention mechanism learns multiple different representation subspaces by applying the attention mechanism multiple times, each time using a different linear projection; the Transformer model also introduces residual connections and layer normalization techniques.

7. The insulator defect detection method based on improved yolov5 according to claim 1 is characterized in that: S3 specifically includes: adding a layer of feature fusion in the Neck of yolov5, so that the network model can obtain more effective information in the process of multi-scale feature fusion.

8. The insulator defect detection method based on improved yolov5 according to claim 7 is characterized in that: In order to improve the fusion performance of the yolov5 network model for multi-scale feature maps, an enhanced optimization strategy called Neck was proposed, and a feature layer fusion mechanism was introduced to obtain more effective information in the multi-pixel feature fusion process when making the network model.

9. The insulator defect detection method based on improved yolov5 according to claim 8, characterized in that: The yolov5 loss function Loss includes boundary regression loss Loss, confidence prediction loss and category prediction loss Loss; yolov5 uses GIoU Loss to calculate boundary regression loss, BECLogits loss function to calculate confidence loss, and cross entropy loss function to calculate category prediction loss.

10. The insulator defect detection method based on improved yolov5 according to claim 9, characterized in that: The loss formula is as follows: Loss=Loss (coord) +Loss (conf) +Loss (cls) Loss (coord) =1-GIoU Where IoU stands for intersection over union, which measures the overlap between two bounding boxes; A stands for the predicted bounding box; B stands for the true bounding box; C stands for the minimum bounding box that contains A and B; GIoU stands for generalized intersection over union, which is an extension of IoU that takes into account non-overlapping areas; S×S stands for the number of cells in the grid size that the image is divided into; represents the indicator function, indicating whether the target appears in cell i and bounding box j; represents the indicator function, indicating whether the target does not appear in cell i and bounding box j; C i represents the prediction confidence score of cell i; p i represents the actual probability of category c in cell i; classes represents the set of all possible categories; Loss (coord) Represents boundary regression loss, Loss (conf) Represents the confidence prediction loss, Loss (cls) represents the category prediction loss; Where S is the network size, I represents the i-th square of the feature map, j represents the j-th prediction box predicted by the square, and the subscripts obj and nobj indicate whether there is an object in the i-th square.

Citation Information

Cited By

  • Low-altitude unmanned aerial vehicle intelligent inspection system and method based on deep learning

    CN119739190A

  • Transform improvement-based power transmission line multi-target defect detection method

    CN120070853A