Substation grounding wire status target detection method based on improved YOLOv5
By improving the structure and loss function of the YOLOv5 model, the problems of insufficient recognition accuracy and speed in substation grounding wire status detection are solved, more efficient grounding wire status detection is achieved, and the computational complexity and time cost are reduced.
Patent Information
- Application Number
- CN202311267588.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2043-09-28
AI Technical Summary
Existing target detection algorithms such as Faster-R-CNN and YOLOv3 have problems with low recognition accuracy and low recognition speed in identifying the status of substation grounding wires, which may lead to power accidents.
An improved YOLOv5 model is adopted, including the backbone stage, neck stage and head stage. Feature extraction and fusion are performed through the focus module, CSPResnet module, C3 module and SPP module, combined with depthwise separable convolution and loss function optimization to improve detection accuracy and speed.
Faster and more accurate ground wire status detection is achieved, computational complexity and time cost are reduced, and model robustness and detection accuracy are improved.
Smart Images

Figure CN117253188B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a substation grounding wire status target detection method based on improved YOLOv5. Background Art
[0002] With the advancement of online monitoring technology, smart substations now have real-time monitoring of grounding wire status. However, if the monitoring system's data is inaccurate, such as due to untimely updates or data leakage, electrical accidents can occur during operator operations. To address this, many researchers are using deep learning algorithms to detect grounding wire status, providing operator safety. Among deep learning algorithms, the YOLO algorithm has developed rapidly and is well-suited for object detection.
[0003] To prevent accidents involving grounded power lines, substations must monitor the connection status of ground lines in real time to ensure the safety of substation operators while repairing power equipment. However, existing object detection algorithms, such as Faster-R-CNN and YOLOv3, suffer from low accuracy and speed in identifying grounded wire status. Summary of the Invention
[0004] The present invention aims to at least solve the technical problems existing in the prior art, and particularly innovatively proposes a substation grounding wire status target detection method based on improved YOLOv5.
[0005] In order to achieve the above-mentioned object of the present invention, the present invention provides a substation grounding wire status target detection method based on improved YOLOv5, comprising the following steps:
[0006] S1, collects field images inside the substation including the grounding wire area;
[0007] S2, input the image into the improved YOLOv5 model to detect the ground wire state target and obtain the detection result;
[0008] The improved YOLOv5 model includes:
[0009] Backbone stage: extract the features of input data;
[0010] Neck stage: Fusing features from different feature layers of Backbone to enhance the model's expressive power.
[0011] Output stage Head: used to predict the coordinates, category and confidence score of the object, delete invalid prediction results through non-maximum suppression (NMS), and mark the final result on the image;
[0012] The Backbone consists of the focus module, CSPResnet module, C3 module and SPP module. First, the preprocessed image is input into the focus module. The focus module is a special downsampling operation that uses slicing operation to split the high-resolution feature map into several low-resolution feature maps.
[0013] Then, several low-resolution feature maps are sequentially input into the first CSPResnet module and the first C3 module. The first CSPResnet module is used to enhance the learning ability of CNN and helps the first C3 module learn the features of the low-resolution feature maps. The first C3 module performs preliminary feature extraction to obtain preliminary features.
[0014] The obtained preliminary features are input into the second CSPResnet module and the second C3 module, wherein the second CSPResnet module is used to enhance the learning ability of CNN and help the second C3 module learn the features of the low-resolution feature map; the second C3 module performs feature extraction to obtain the underlying features;
[0015] The obtained low-level features are input into the third CSPResnet module and the third C3 module. The third CSPResnet module is used to enhance the learning ability of CNN and helps the third C3 module learn the features of the low-resolution feature map. The third C3 module performs feature extraction to obtain mid-level features.
[0016] The obtained mid-level features are input into the fourth CSPResnet module, the fourth C3 module, and the SPP module. The fourth CSPResnet module is used to enhance the learning ability of the CNN and helps the fourth C3 module learn the features of the low-resolution feature map. Feature extraction is performed through the fourth C3 module, and finally, the SPP module uses different maximum pooling layers to convert feature maps of any size into a fixed size, thereby obtaining high-level features.
[0017] Neck includes DWConv module, Concat module, Upsample module and Maxpool module.
[0018] The bottom-level features, middle-level features, and high-level features output by the Backbone network are sent to the neck network. The high-level features are upsampled by the first Upsample module and fused with the middle-level features by the first Concat module. The fused features are input to the first DWConv module for depthwise separable convolution. The feature map obtained after convolution is input to the second Upsample module for upsampling and fused with the bottom-level features by the second Concat module to obtain top-down transmission features. Thus, the learning of top-down transmission feature information is completed through the Neck network;
[0019] The top-down transmitted features are passed through the second DWConv module for depth-wise separable convolution, and the feature map obtained after convolution is fused with the underlying features through the third Concat module to obtain the first horizontal fusion feature;
[0020] The first horizontal fusion feature is passed through the third DWConv module to perform depth-wise separable convolution, and then the feature map after the pooling operation of the first Maxpool module, the feature map obtained by the depth-wise separable convolution of the first DWConv module, and the middle-layer feature map are fused through the fourth Concat module to obtain the second horizontal fusion feature;
[0021] The second horizontal fusion feature is passed through the fourth DWConv module for depth-wise separable convolution, and then the feature map after the pooling operation of the second Maxpool module is fused with the high-level feature through the fourth Concat module to obtain the third horizontal fusion feature.
[0022] Therefore, the Neck network is used to connect the low, medium and high layer features horizontally at each layer, and the features of each layer fused with other layers are fused with the original layer features before output, completing the horizontal learning of features at different layers and solving the problems of information loss and redundancy in traditional feature pyramids when extracting features of different scales.
[0023] Furthermore, the convolution process of the DWConv module is to first convolve the feature map of size a×b×c through the convolution kernel of size q*q*c and then convolve it through p convolution kernels of size 1*1*c to obtain the feature map of size a*b*p. The parameter DWC in the convolution process is p and computational effort DWC cps As shown below:
[0024] DWC p =q×q×c+c×p
[0025] DWC cps =q×q×a×b×c+a×b×c×p
[0026] Where a×b×c represents the width, height, and depth of the input feature map respectively;
[0027] q×q×c represent the width, height, and depth of the convolution kernel respectively.
[0028] Furthermore, during the training of the improved YOLOv5 model, the collected field images of the substation need to be processed as follows:
[0029] S01, use the LabelImg annotation tool to mark the ground line area in the image;
[0030] S02, performing an enhancement operation on the image with the ground line area marked;
[0031] S03, cropping the image to obtain an image of the grounding line area;
[0032] S04, resize the image to a fixed size that meets the requirements of the improved YOLOv5 model;
[0033] S05, using the oversampling method SMOTE for data balancing;
[0034] S06, converting the location information of the ground line area into the coordinates and category labels of the bounding box; if the image resolution is smaller than the set input size, gray blocks are added to the image to reach the set size.
[0035] Furthermore, during the training process of the improved YOLOv5 model, the inconsistency between the predicted value and the true value is calculated through the loss function. The loss function of the model includes the Head loss function, which is the weighted addition of classification loss, positioning loss and confidence loss. The classification loss uses the CIoU loss function, and the positioning loss uses the Varifocal Loss.
[0036] The calculation formula of the CIoU loss function is shown in formula (7):
[0037]
[0038] Where CIOU(A,B) represents the intersection-over-union ratio of the predicted box A and the true box B;
[0039] IoU(A,B) represents the IoU value between bounding boxes A and B;
[0040] D(A,B) represents the distance between the center points of bounding boxes A and B;
[0041] X represents the diagonal length of the image;
[0042] y(A,B) represents the distance between the corners of bounding boxes A and B;
[0043] a is an adjustable parameter used to balance the effects of center point distance, scale ratio, and corner point distance on object detection performance.
[0044] Furthermore, the F1-score and mAP evaluation indicators are used to evaluate the performance of the model, where the formula of F1-score is:
[0045] F1 Score=2×(Precision×Recall) / (Precision+Recall)
[0046] Precision = TP / (TP+FP)
[0047] Recall = TP / (TP+FN)
[0048] Among them, F1 Score is an evaluation indicator that comprehensively considers the precision rate and recall rate, and is used to measure the performance of binary or multi-classification models;
[0049] TP represents the number of samples correctly predicted as positive;
[0050] FP represents the number of samples that are incorrectly predicted as positive.
[0051] In summary, due to the adoption of the above technical solution, the method of the present invention can identify the ground wire status faster and with higher recognition accuracy by adopting the improved YOLOv5 model.
[0052] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments with reference to the accompanying drawings, in which:
[0054] Figure 1 It is a model structure diagram of the present invention.
[0055] Figure 2 This is a comparison chart of CSPResnet and CBS of the present invention.
[0056] Figure 3 This is a schematic diagram of the standard convolution process.
[0057] Figure 4 It is the depthwise separable convolution process of the present invention.
[0058] Figure 5 This is the CSPResNet network architecture diagram of the present invention.
[0059] Figure 6 This is a diagram of the calculation method of precision and recall.
[0060] Figure 7 It is a schematic diagram of the comparison of model evaluation indicators. DETAILED DESCRIPTION
[0061] The following describes embodiments of the present invention in detail. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present invention and are not to be construed as limiting the present invention.
[0062] S1. Dataset Acquisition: Field images from a substation were used as the training and evaluation dataset. Since the grounding wire area accounts for a relatively small proportion of the actual image, a simple dataset expansion was performed to capture a large number of photos containing grounding wire areas. This ensured a balance between positive samples (grounding wire areas) and negative samples (background). During data preprocessing, the LabelImg annotation tool was used to accurately label the grounding wire areas in the images. The experimental dataset was divided into three parts: training, testing, and validation, with a ratio of 7:1:2.
[0063] S2. Dataset Preprocessing: Before training, images marked with grounding wire areas need to be augmented. Appropriate augmentation can be used to extract more context from the same image, expanding the dataset and improving the accuracy of grounding wire detection.
[0064] S3: Perform image cropping. Since the area where the temporary grounding wire is attached to the transmission line accounts for a relatively small portion of the entire image, to allow the model to focus more on the grounding wire, the image needs to be cropped to a smaller area containing only the area of interest. This reduces interference from irrelevant background information and focuses the model's attention on the grounding wire area.
[0065] S4, resize the image. Since the YOLOv5 model has requirements for the size of the input image, it is necessary to resize the image to a fixed size to maintain the consistency of the model input and improve the model's operating efficiency.
[0066] S5, by resampling the data set, uses the oversampling method SMOTE (Synthetic Minority Over-sampling Technique), which is the synthetic minority oversampling technology. This method selects two or more similar samples under a small category based on the distance metric, and then selects one of the samples (root sample), and randomly selects a certain number of adjacent samples (auxiliary samples) and performs linear interpolation with the root sample to generate new samples. Moreover, the attributes of the new samples are different from those of the samples used for synthesis, and they belong to new data. In this way, a lot of new data is constructed.
[0067] In S6, the final stage of dataset preprocessing, we performed label conversion and encoding. As required by the YOLOv5 model, we converted the location information of the ground line region into bounding box coordinates and category labels. This enabled the model to understand and learn the ground line object detection task. If the image resolution is smaller than the specified input size, gray blocks are added to the image to achieve the specified size. These blocks do not affect the model's feature extraction.
[0068] S7, input the training data into the improved YOLOv5 of the present invention for model training, and then input the test and verification data into the improved YOLOv5 for testing and verification respectively.
[0069] The improved YOLOv5 structure of the present invention is as follows Figure 1 As shown: It specifically includes the following stages:
[0070] 1) Input stage: In this stage, the original image is preprocessed, including adaptive scaling, data augmentation, and generation of initial anchor points.
[0071] 2) Backbone stage: It mainly consists of the Focus module, CSPResnet module, C3 module and Spatial Pyramid Pooling (SPP) module.
[0072] First, the preprocessed image is input into the focus module. The focus module is a special downsampling operation that uses a slicing operation to split the high-resolution feature map into several low-resolution feature maps.
[0073] Then, several low-resolution feature maps are sequentially input into the first CSPResnet module and the first C3 module. The first CSPResnet module is used to enhance the learning ability of CNN and helps the first C3 module learn the features of the low-resolution feature maps. The first C3 module performs preliminary feature extraction to obtain preliminary features.
[0074] The obtained preliminary features are input into the second CSPResnet module and the second C3 module, wherein the second CSPResnet module is used to enhance the learning ability of CNN and help the second C3 module learn the features of the low-resolution feature map; the second C3 module performs feature extraction to obtain the underlying features;
[0075] The obtained low-level features are input into the third CSPResnet module and the third C3 module. The third CSPResnet module is used to enhance the learning ability of CNN and helps the third C3 module learn the features of the low-resolution feature map. The third C3 module performs feature extraction to obtain mid-level features.
[0076] The obtained middle-level features are input into the fourth CSPResnet module, the fourth C3 module and the SPP module. The fourth CSPResnet module is used to enhance the learning ability of CNN and helps the fourth C3 module to learn the features of low-resolution feature maps. Feature extraction is performed through the fourth C3 module, and finally, the SPP module uses different maximum pooling layers to convert feature maps of any size into a fixed size, thereby obtaining high-level features.
[0077] Among them, the CSPResNet network is a network structure that combines CSP (Cross Stage Partial) and ResNet, with strong feature representation capabilities and computational efficiency. The CSP module is the core component of CSPResNet. It promotes the transmission and fusion of feature information by dividing the feature map into two paths, namely the trunk path and the branch path, and introducing partial residual connections between the two paths. The CSPResNet network architecture is shown in the figure below. Figure 5As shown in the figure, the CSPResnet network adds BasicBlock and EffectiveSElayer to the CBS model, while also changing the computational structure. BasicBlock is a network consisting of a stacked ConvBN layer and a REPVggBlock, containing a residual network. The ConvBN layer is similar to the combination of Conv and BN layers, while REPVggBlock is composed of two branches: a 3×3 Conv layer plus a BN layer and a 1×1 layer plus a BN layer, with the outputs added and then passed through an activation function. The benefit of using CSPResnet is that it enhances the learning ability of CNNs, allowing them to be lightweight while maintaining accuracy, while reducing computational bottlenecks and memory costs. The CBS module consists of convolutional layers, batch normalization layers, and the SiLU activation function. The C3 module is an efficient feature extraction module that enhances the network's learning capabilities. It includes three 1×1 convolutional layers and a bottleneck layer. The bottleneck layer uses a 1×1 convolutional layer to reduce dimensionality and a 3×3 convolutional layer to extract features from the image, increasing network depth and reducing computational effort. This design enables CSPResNet to fully utilize characteristic signals from both the main and branch paths, thereby enhancing feature expression. ResNet is a deep residual training network system that uses skip connections to overcome the vanishing gradient problem in deep network training, making network training easier. CSPNet is commonly used in ResNet, ResNeXt, and DenseNet networks. Using CSPNet can reduce the computational workload of these networks by 10% to 20%. However, in terms of accuracy, it outperforms these networks on the ImageNet image classification task. A higher computational bottleneck increases inference time and reduces computational efficiency, with some computing units often idle. This model achieves a balanced distribution of computational workload across all layers, improving computational efficiency and reducing energy consumption. Furthermore, CSPNet can halve the computational bottleneck of PeleeNet. To reduce memory usage, this model compresses feature maps across channels when extracting the feature pyramid. When using CSPNet, PeleeNet's memory usage can be reduced by 75%.
[0078] 3) Neck stage: The depthwise separable convolution (DWConv) module, the Concat module, the upsample module, and the maxpool module are used.
[0079] The bottom-level features, middle-level features, and high-level features output by the Backbone network are sent to the neck network. The high-level features are upsampled by the first Upsample module and then fused with the middle-level features through the first Concat module. The fused features are input into the first DWConv module for depthwise separable convolution. The feature map obtained after convolution is input into the second Upsample module for upsampling and then fused with the bottom-level features through the second Concat module to obtain top-down transmitted features. Thus, the learning of top-down transmitted feature information is completed through the Neck network.
[0080] The top-down transmitted features are passed through the second DWConv module for depth-wise separable convolution, and the feature map obtained after convolution is fused with the underlying features through the third Concat module to obtain the first horizontal fusion feature;
[0081] The first horizontal fusion feature is passed through the third DWConv module to perform depth-wise separable convolution, and then the feature map after the pooling operation of the first Maxpool module, the feature map obtained by the depth-wise separable convolution of the first DWConv module, and the middle-layer feature map are fused through the fourth Concat module to obtain the second horizontal fusion feature;
[0082] The second horizontal fusion feature is passed through the fourth DWConv module for depth-wise separable convolution, and then the feature map after the pooling operation of the second Maxpool module is fused with the high-level feature through the fourth Concat module to obtain the third horizontal fusion feature.
[0083] Therefore, the Neck network is used to connect the low, medium and high layer features horizontally at each layer, and the features of each layer fused with other layers are fused with the original layer features before output, completing the horizontal learning of features at different layers and solving the problems of information loss and redundancy in traditional feature pyramids when extracting features of different scales.
[0084] In addition to changing the structure of the Neck network, depthwise separable convolution (DWConv) is also used. Depthwise separable convolution decomposes the normalized convolution into depthwise convolution and pointwise 1x1 convolution. Depthwise convolution DWconv obtains new feature maps layer by layer by depth (number of channels), but these new feature maps do not have spatial information because depthwise convolution uses two-dimensional convolution to convolve the features of each input channel, and the channels are blocked. In order to reinject spatial information into the feature map, DWconv uses 1×1 convolution to recombine these new feature maps, and the spatial information is regained by reverse BP. This separation method can effectively reduce the number of parameters during model calculation. When the standard convolution is X A×A×L convolutions (where A is the length and width of the convolution, and L is the depth of the convolution), the DWConv convolution divides the standard convolution into L A×A×1 convolution kernels. The ratio of the number of DWConv parameters to the number of standard convolution parameters is shown in formula (1).
[0085]
[0086] The above structural improvements to Neck enable bidirectional feature transfer in both forward and backward propagation. By combining bidirectional paths, multi-level feature information can be simultaneously utilized, enhancing the model's feature extraction capabilities and spatial resolution. At each layer of the bidirectional path, feature fusion operations are used to integrate features of different scales. This adaptively fuses features by considering their weights and relative importance. Lateral connections are introduced at each layer of the bidirectional path, enabling features from different levels to communicate and fuse with each other. This effectively addresses the issue of poor information transfer in traditional feature pyramid networks, improving the mean average precision (mAP) by 0.3% when identifying objects. A higher mAP value indicates a better detection performance of the object detection model on a given dataset.
[0087] Among them, the depth-wise separable convolution module (DWConv) is used to further reduce the computational complexity of the module and reduce the complexity of the network model. The present invention replaces the Conv structure in the Neck module and the Head network with the DWConv module. The convolution layer in the Conv module belongs to the standard convolution, and its convolution process is as follows: Figure 3 As shown in Figure 2. During the calculation process, the convolution kernel extracts and fuses the features of all channels. Figure 3As shown in , the step size is set to 1. The standard convolution process is to output a feature map of size a×b×c to a feature map of size a×b×p. The parameter amount Par and computational amount Cqs required for the standard convolution process are obtained, as shown in Equations (2) and (3).
[0088] Conv p =q×q×c×p (2)
[0089] Conv cps =q×q×a×b×c×p (3)
[0090] The depth-wise separable convolution consists of two steps: depth-wise convolution and point-wise convolution:
[0091] 1) Extract regional features on the feature map through depth convolution.
[0092] 2) Enter the point-by-point convolution information fusion channel. This step takes into account both spatial and channel dimensional features. The process is as follows Figure 4 shown.
[0093] In the depthwise convolution algorithm, each convolution kernel only contributes to a single feature map, thus avoiding cross-path information exchange. Pointwise convolution fuses the features extracted by the depthwise convolution operation. This process involves a 3D convolution kernel of 1×1 size. The number of channels with feature maps depends on the number of convolution kernels. The combined use of depthwise and pointwise convolutions results in depthwise separable convolution, which reduces model parameters while ensuring information extraction.
[0094] The convolution process of DWConv is to first convolve the feature map of size a×b×c through the convolution kernel of size q*q*c and then convolve it through p convolution kernels of size 1*1*c to obtain the feature map of size a*b*p. The expressions of the parameter amount Par and the computation amount Cqs required for the convolution process are as follows (4) and (5).
[0095] DWC p =q×q×c+c×p (4)
[0096] DWC cps =q×q×a×b×c+a×b×c×p (5)
[0097] The ratio of separable depthwise convolution to standard convolution is calculated using Equation (2), Equation (4) or Equation (3) and Equation (5). The results show that the former has fewer calculation parameters and less computational effort. The ratio of the two is shown in Equation (6).
[0098]
[0099] The depthwise separable convolutional module can learn more stable feature representations, thereby improving the accuracy and robustness of ground wire status detection. This method not only reduces the number of model parameters and the computational complexity, but also improves the model's inference speed.
[0100] 4) Output stage (Head). This stage is responsible for predicting the coordinates, categories, and confidence scores of the objects. Invalid prediction results are removed through non-maximum suppression (NMS), and the final results are marked on the image. The model structure diagram is as follows Figure 2 shown.
[0101] Furthermore, the loss in the Head network is a weighted sum of three loss functions: Varifocal Loss, CIoU, and Confidence Loss. Varifocal Loss is used as the classification loss, CIoU is used as the localization loss, and Confidence Loss is used to determine whether the bounding box contains the object to be labeled. Confidence is used to determine whether the object within the bounding box is a positive or negative sample. A confidence level greater than the confidence threshold is considered a positive sample, while a confidence level less than the confidence threshold is considered a negative sample, i.e., background.
[0102] The classification loss function commonly used in YOLOv5 is the cross-entropy loss, but this loss function is not suitable for ground line target detection. Therefore, the Varifocal Loss function replaces the cross-entropy loss function, which can better balance positive and negative samples and improve the generalization ability of the model. This is because when the cross-entropy loss is used in scenes where the detection object is small and the background occupies most of the area, the model will be biased towards the background, resulting in failure to detect the object and poor recognition effect. VarifocalLoss (zoom loss) is a dynamically scaled binary cross-entropy loss. It uses an asymmetric training instance weighting method to only reduce the weight of negative samples to solve the class imbalance problem during training, and increase the weight of high-quality positive samples to generate the main detection. VariFocal Loss comes from Focal Loss. The problem that Focal Loss was proposed to solve is the imbalance of positive and negative samples in the training data.
[0103] Furthermore, in IoU loss processing, GIoU is replaced by CIoU. CIoU takes the aspect ratio of the target box into account during calculation, more accurately reflecting the consistency between the predicted and target boxes, helping to improve the model's positioning accuracy. When the GIoU loss function is used, when the prior box and the predicted box are in a containment relationship, the IoU loss function is reverted to. The IoU value remains unchanged, making further optimization impossible, and GIoU converges very slowly. CIoU optimizes the achor by taking into account constraints on center point distance and aspect ratio, accelerating convergence. It does not revert to the IoU loss function when the two boxes are in a containment relationship.
[0104] The calculation formula of the CIoU loss function is shown in formula (7).
[0105]
[0106] Where A and B represent the predicted box and the true box, respectively. IoU(A,B) represents the IoU value between bounding boxes A and B. D(A,B) represents the center-point distance between bounding boxes A and B. X represents the length of the image diagonal. y(A,B) represents the corner-point distance between bounding boxes A and B. a is an adjustable parameter used to balance the effects of center-point distance, scale ratio, and corner-point distance on target detection performance. The classification loss function uses the Varifocal loss function. For detecting small targets such as ground wires, the complex background in substations can easily interfere with the algorithm's detection performance. Varifocal loss uses an asymmetric training instance weighting method, reducing the weight of negative samples to address the class imbalance problem during training while increasing the weight of high-quality positive samples to generate primary detections.
[0107] The improved YOLOv5 model can solve the problem of detecting complex backgrounds and small objects in images. The backbone network has been improved, and the addition of the CSPResnet network has enhanced object detection performance. The network structure of the Neck has been improved, and the use of depthwise separable convolution technology can quickly implement parallel computing while ensuring computing speed and stable performance.
[0108] In practical applications, YOLOv5 has five object detection models: YOLOv5n, YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x. These models differ in their depth and width. YOLOv5n is the smallest model, YOLOv5m and YOLOv5l have more CSP blocks to increase depth, and YOLOv5x is the model with the greatest depth and width. These models strike a balance between accuracy, speed, and model size, making them suitable for various object detection applications. Considering the application scenarios, this paper adopts the YOLOv5s model.
[0109] Taking into account the conflicting influences of precision and recall, we use mean Average Precision (mAP) as a comprehensive measure of the algorithm's detection performance, along with the model's image processing rate to assess the model's real-time detection capabilities. The confusion matrix used to evaluate precision is shown in Table 1. In this matrix, true positives are defined as positive samples predicted as positive by the model; false negatives are defined as positive samples predicted as negative by the model; false positives are defined as negative samples predicted as positive by the model; and true negatives are defined as negative samples predicted as negative by the model.
[0110] Table 1 Confusion matrix
[0111] The real situation Positive prediction results Negative prediction results Positive example True example False negatives (Positive) (True Positive,TP) (False Negative, FN) Negative example False positive True negative example (Negative) (False Positive, FP) (True Negative,TN)
[0112] In order to verify the advantages of the improved algorithm proposed in this paper, different models are selected for comparison in the grounding wire status detection task in the substation, and the three indicators of f1-score are used to evaluate the performance of the model.
[0113] Precision is used to measure the number of truly positive samples among the samples predicted as positive by the model. The calculation formula is shown in Equation (10). TP (True Positive) represents the number of samples correctly predicted as positive, and FP (False Positive) represents the number of samples incorrectly predicted as positive.
[0114] Precision=TP / (TP+FP) (8)
[0115] Recall: Recall is a measure of the number of samples that the model can correctly detect among all true positive samples. The calculation formula is shown in Equation (11). TP (True Positive) represents the number of samples correctly predicted as positive, and FN (False Negative) represents the number of samples incorrectly predicted as negative.
[0116] Recall=TP / (TP+FN) (9)
[0117] The F1 Score is an evaluation metric that comprehensively considers both precision and recall, and is used to measure the performance of binary or multi-classification models. The F1 Score ranges from 0 to 1, with 1 representing optimal performance and 0 representing the worst. The F1 Score combines precision and recall, making it suitable for situations where the samples across different classes are unbalanced. The formula for calculating the F1 Score is shown in Equation (12).
[0118]
[0119] mAP (mean Average Precision), also known as the average value of AP (Average Precision), is the primary evaluation metric for target detection algorithms. Target detection models are typically measured using the speed and accuracy (mAP) metric. A higher mAP value indicates a better target detection model's performance on a given dataset. Accuracy refers to accuracy, which implies systematic error (also known as bias), describing the degree of deviation between the actual value output by the target detection model and the true result. Precision refers to accuracy, which implies random error (also known as variance), describing the perturbation of the actual value. Precision can be considered the model's ability to accurately identify the data it finds.
[0120] AP (Average Precision) is used to measure the model's ability to identify and detect targets. AP is calculated by averaging the precision values corresponding to each recall value to obtain a numerical metric. When evaluating a target detection model, the calculation methods for precision and recall are as follows: Figure 6 shown.
[0121] The map indicator is used to compare with the time cost of the model to verify the effect of the improvement. The comparison chart of different model evaluation indicators is as follows: Figure 7 The comparison results are shown in Table 2.
[0122] Table 2 Experimental comparison results
[0123]
[0124] YOLOv5 is used as a baseline model with a high mean average precision (mAP). In the object detection task, YOLOv5 can accurately detect most objects, but the time cost is relatively high in terms of detection time.
[0125] YOLOv5 with BiFPN and CSPResNet is an improved model that incorporates BiFPN and CSPResNet. The results show that the map metric has significantly improved compared to the baseline model, while significantly reducing the time cost. These results demonstrate that the improved model has made progress in improving object detection accuracy while reducing computational complexity.
[0126] YOLOv5 with three new models utilizes depthwise separable convolutional modules, outperforming baseline models in both map metrics and time performance. Results show that combining these three network modules significantly improves object detection accuracy and reduces model weight.
[0127] The final model incorporates a depthwise separable convolutional module after improving the neck and backbone networks. Table 2 shows that the final improved model achieves optimal results in both detection accuracy and time performance. Therefore, it achieves optimal results when applied to grounding wire detection of power transmission lines, demonstrating its high application value.
[0128] In summary, this paper improves upon the YOLOv5 model by adding a depthwise separable convolutional module. Results show that the improved model achieves a mean average prediction accuracy of 98.7% in just 61ms, significantly improving both accuracy and computational speed compared to the original model. Therefore, the improved YOLOv5 object detection method designed in this paper can be applied to detecting grounding wires within substations. Compared to other object detection algorithms, it is more suitable for detecting grounding wires in substations, effectively preventing accidents involving grounded wires.
[0129] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.
Claims
1. A substation grounding wire status target detection method based on improved YOLOv5, characterized in that: The following steps are involved: S1, collects field images inside the substation including the grounding wire area; S2, input the image into the improved YOLOv5 model to detect the ground wire state target and obtain the detection result; The improved YOLOv5 model includes: Backbone stage: extract the features of input data; Neck stage: Fusing features from different feature layers of Backbone to enhance the model's expressive power. Output stage Head: used to predict the coordinates, categories and confidence scores of the objects, delete invalid prediction results through non-maximum suppression, and mark the final results on the image; The Backbone consists of the focus module, CSPResnet module, C3 module and SPP module. First, the preprocessed image is input into the focus module. The focus module is a special downsampling operation that uses slicing operation to split the high-resolution feature map into several low-resolution feature maps. Then, several low-resolution feature maps are sequentially input into the first CSPResnet module and the first C3 module. The first CSPResnet module is used to enhance the learning ability of CNN and helps the first C3 module learn the features of the low-resolution feature maps. The first C3 module performs preliminary feature extraction to obtain preliminary features. The obtained preliminary features are input into the second CSPResnet module and the second C3 module, wherein the second CSPResnet module is used to enhance the learning ability of CNN and help the second C3 module learn the features of the low-resolution feature map; the second C3 module performs feature extraction to obtain the underlying features; The obtained low-level features are input into the third CSPResnet module and the third C3 module. The third CSPResnet module is used to enhance the learning ability of CNN and helps the third C3 module learn the features of the low-resolution feature map. The third C3 module performs feature extraction to obtain mid-level features. The obtained mid-level features are input into the fourth CSPResnet module, the fourth C3 module, and the SPP module. The fourth CSPResnet module is used to enhance the learning ability of the CNN and helps the fourth C3 module learn the features of the low-resolution feature map. Feature extraction is performed through the fourth C3 module, and finally, the SPP module uses different maximum pooling layers to convert feature maps of any size into a fixed size, thereby obtaining high-level features. Neck includes DWConv module, Concat module, Upsample module and Maxpool module. The bottom-level features, middle-level features, and high-level features output by the Backbone network are sent to the neck network. The high-level features are upsampled by the first Upsample module and fused with the middle-level features by the first Concat module. The fused features are input to the first DWConv module for depthwise separable convolution. The feature map obtained after convolution is input to the second Upsample module for upsampling and fused with the bottom-level features by the second Concat module to obtain top-down transmission features. Thus, the learning of top-down transmission feature information is completed through the Neck network; The top-down transmitted features are passed through the second DWConv module for depth-wise separable convolution, and the feature map obtained after convolution is fused with the underlying features through the third Concat module to obtain the first horizontal fusion feature; The first horizontal fusion feature is passed through the third DWConv module to perform depth-wise separable convolution, and then the feature map after the pooling operation of the first Maxpool module, the feature map obtained by the depth-wise separable convolution of the first DWConv module, and the middle-layer feature map are fused through the fourth Concat module to obtain the second horizontal fusion feature; The second horizontal fusion feature is passed through the fourth DWConv module for depth-wise separable convolution, and then the feature map after the pooling operation of the second Maxpool module is fused with the high-level feature through the fourth Concat module to obtain the third horizontal fusion feature.
2. The method for detecting grounding wire status of a substation based on improved YOLOv5 according to claim 1, wherein: The convolution process of the DWConv module is to first convolve the feature map of size a×b×c through the convolution kernel of size q*q*c and then convolve it through p convolution kernels of size 1*1*c to obtain the feature map of size a*b*p. The parameter DWC in the convolution process is p and computational effort DWC cps As shown below: DWC p =q×q×c+c×p DWC cps =q×q×a×b×c+a×b×c×p Where a×b×c represents the width, height, and depth of the input feature map respectively; q×q×c represent the width, height, and depth of the convolution kernel respectively.
3. The method for detecting grounding wire status of a substation based on improved YOLOv5 according to claim 1, wherein: During the training of the improved YOLOv5 model, the following processing needs to be performed on the collected field images of the substation: S01, use the LabelImg annotation tool to mark the ground line area in the image; S02, performing an enhancement operation on the image with the ground line area marked; S03, cropping the image to obtain an image of the grounding line area; S04, resize the image to a fixed size that meets the requirements of the improved YOLOv5 model; S05, using the oversampling method SMOTE for data balancing; S06, converting the location information of the ground line area into the coordinates and category labels of the bounding box; if the image resolution is smaller than the set input size, gray blocks are added to the image to reach the set size.
4. The method for detecting grounding wire status of a substation based on improved YOLOv5 according to claim 3, wherein: During the training process of the improved YOLOv5 model, the inconsistency between the predicted value and the true value is calculated through the loss function. The loss function of the model includes the Head loss function, which is the weighted addition of classification loss, positioning loss and confidence loss. The classification loss uses the CIoU loss function, and the positioning loss uses VarifocalLoss. The calculation formula of the CIoU loss function is shown in formula (7): Where CIOU(A,B) represents the intersection-over-union ratio of the predicted box A and the true box B; IoU(A,B) represents the IoU value between bounding boxes A and B; D(A,B) represents the distance between the center points of bounding boxes A and B; X represents the diagonal length of the image; y(A,B) represents the distance between the corners of bounding boxes A and B; a is an adjustable parameter used to balance the effects of center point distance, scale ratio, and corner point distance on object detection performance.
5. The method for detecting grounding wire status of a substation based on improved YOLOv5 according to claim 3, wherein: The F1-score and mAP evaluation indicators are used to evaluate the performance of the model. The formula of F1-score is: F1 Score=2×(Precision×Recall) / (Precision+Recall) Precision = TP / (TP+FP) Recall = TP / (TP+FN) Among them, F1 Score is an evaluation indicator that comprehensively considers the precision rate and recall rate, and is used to measure the performance of binary or multi-classification models; TP represents the number of samples correctly predicted as positive; FP represents the number of samples that are incorrectly predicted as positive.
Citation Information
Patent Citations
Power transmission line target detection and identification method based on feature fusion
CN114445706A
Method for online detection of fabric defects based on improved YOLOv5 model, readable storage medium and terminal equipment
CN115439468A