Power contact network foreign matter detection method and system based on improved YOLOv8 neural network

By improving the YOLOv8 neural network, combining the C2f-SCConv module, BiFPN structure, GAM attention mechanism, and Wise-IoU loss function, the problem of low detection efficiency of foreign objects in the power contact network is solved, and foreign objects with high accuracy and robustness are achieved Detection effect.

CN119027401APending Publication Date: 2024-11-26CHINA TOWER CO LTD
View PDF 0 Cites 9 Cited by

Patent Information

Application Number
CN202411141988.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The complex environment around the railway and the diversity of foreign objects in the contact network lead to low efficiency in the detection of foreign objects in the power contact network.

Method used

Improve the power contact network foreign object detection method of YOLOv8 neural network, and form the C2f-SCConv module by combining cross-stage partial links and spatial channel reconstruction in the Neck part, embedding the bidirectional feature pyramid and GAM attention mechanism, and introducing the Wise-IoU loss function , improve the model's adaptability and robustness to foreign body characteristics and background changes.

Benefits of technology

The high accuracy rate in the identification of foreign objects in railway contact networks was achieved, with an average accuracy rate of 89.9%, which significantly enhanced the detection effect of small targets and met the actual needs of foreign objects in railway contact networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119027401A_ABST
    Figure CN119027401A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machine vision, and particularly discloses a power contact network foreign matter detection method and system based on an improved YOLOv8 neural network, and the method comprises the steps: constructing a power contact network foreign matter detection model through the improved YOLOv8 neural network, and carrying out the detection of a foreign matter in a Neck part of the YOLOv8 network, cross-stage partial linking and space channel reconstruction convolution are combined to form a C2f-SCConv module to replace an original C2f module, so that the adaptability of a network model to foreign matter features and background changes is improved; a BiFPN structure is embedded behind a C2f-SCConv module in a Neck part of the YOLOv8 network, so that feature information of different scales is effectively integrated, and the precision of multi-scale foreign matter detection is improved; a GAM attention mechanism is embedded behind the last layer of C2f module of the backbone part of the YOLOv8 network so as to enhance image noise suppression and improve robustness of network identification; a Wise-IoU loss function is introduced into the YOLOv8 model, so that the sensitivity of the network to a complex boundary is enhanced, and the detail capturing capability of the network is improved. Experiments show that the average accuracy of the method is high, and the detection effect on the small target is remarkably enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine vision technology, and in particular to a method and system for detecting foreign matter in a power contact network by improving a YOLOv8 neural network. Background Art

[0002] The overhead contact network is a special form of power transmission line erected above the railway line to supply power to electric locomotives. Because it is in the open air, floating objects such as plastic bags, kites, and balloons are easily hung on the overhead contact network, and birds also build nests on the pillars of the overhead contact network. These phenomena will cause the overhead contact network to be damaged and affect the safe operation of the train.

[0003] At present, foreign objects in the contact network are mainly detected and removed through manual inspection, but this method is not only costly and inefficient, but also cannot eliminate safety hazards in a timely manner. With the rapid development of computer vision and other fields, many scholars have conducted research on foreign object detection using methods such as deep learning.

[0004] Most studies focus on foreign object detection on high-voltage transmission lines, which include floating objects such as plastic bags, kites, balloons, and dust nets. Some scholars have proposed a deep learning model called YOLO-CSM for detecting foreign objects and component defects on high-voltage transmission lines. The model has significantly improved detection speed and accuracy. Some scholars have proposed a method for detecting foreign objects on power transmission lines based on deep learning. By designing a network based on regression strategy, it focuses on capturing global information and key visual features to effectively detect small-scale and long-distance foreign objects. Some scholars have proposed a model based on improved YOLOv8m for detecting foreign objects on high-voltage transmission lines. The model has improved mAP_0.5 and mAP_0.5:0.95 indicators by 2.7% and 4% respectively, and the recall rate has increased by 6%. Some scholars have proposed a new method for tracking the intrusion of light objects on the contact network based on twin multi-attention networks. By introducing three attention mechanisms to extract light object features from a deeper level, the robustness and accuracy have been significantly improved.

[0005] Bird nests on contact network pillars are also one of the important factors affecting the safe operation of trains. Some scholars have proposed an automatic detection framework for bird nests based on deep learning, using drone images for detection. And introduced k-means clustering and focal loss function to improve the detection accuracy and efficiency. Some scholars have proposed an improved model based on YOLOv3 and YOLOv4, combining a coarse-to-fine detection strategy for detecting bird nests on high-speed rail contact networks. By using candidate region generation and feature extraction modules, the accuracy and anti-interference ability of identifying bird nests are significantly improved. Some scholars have proposed using feature refinement networks to detect bird nests in distribution networks. Combining HOG features with convolutional neural networks (CNNs) has significantly improved the accuracy of bird nest detection on high-voltage transmission lines.

[0006] In summary, with the continuous progress of society, more and more research has been conducted on the detection of foreign objects in the contact network. However, due to the complex environment around the railway and the impact of special lighting conditions, as well as the wide variety of foreign objects and small targets, the current foreign object detection scheme for the power contact network is not accurate enough and there is still a lot of room for improvement. Summary of the invention

[0007] The present invention provides a method and system for detecting foreign objects in an electric contact network by improving the YOLOv8 neural network, and solves the technical problem that the efficiency of detecting foreign objects in the electric contact network is low due to the complex environment surrounding the railway and the diversity of foreign objects in the contact network.

[0008] In order to solve the above technical problems, the present invention provides a method for detecting foreign objects in a power contact network by improving the YOLOv8 neural network, comprising the steps of:

[0009] Improve the YOLOv8 neural network to build a foreign body detection model for the electric contact network; the steps of improving the YOLOv8 neural network include: in the Neck part of the YOLOv8 network, combine the cross-stage partial link and the spatial channel reconstruction convolution to form a C2f-SCConv module to replace the original C2f module; embed a bidirectional feature pyramid after the C2f-SCConv module in the Neck part of the YOLOv8 network; embed a GAM attention mechanism after the last layer of the C2f module in the backbone part of the YOLOv8 network; introduce the Wise-IoU loss function in the YOLOv8 model;

[0010] Build a dataset;

[0011] The constructed data set is used to train and test the constructed power overhead line foreign body detection model;

[0012] The trained and tested foreign object detection model for electric contact network is applied to the actual foreign object detection for electric contact network.

[0013] Furthermore, the C2f-SCConv module includes a spatial reconstruction unit and a channel reconstruction unit;

[0014] The operations performed by the space reconstruction unit include:

[0015] Use the group normalization layer to normalize the given input feature X to obtain X out ;

[0016] The importance weight W of the input feature X is calculated using the trainable parameter γ in the group normalization layer γ ;

[0017] W γ and X outThe information weight W is obtained by mapping the information to the range (0, 1) through the Sigmoid function and setting the threshold. The mapping values ​​greater than the threshold are set to 1 and the rest are set to 0. 1 and the non-information weight W 2 ;

[0018] The input features X and W 1 and W 2 Multiply to get the corresponding features and Features

[0019] Features and Features Perform cross reconstruction to obtain the spatial reorganization feature X w .

[0020] Furthermore, for the features and Features Perform cross reconstruction to obtain the spatial reorganization feature X w Specifically:

[0021] Features Perform group normalization and spatial reconstruction operations respectively to obtain features and

[0022] Features Perform group normalization and spatial reconstruction operations respectively to obtain features

[0023] Features Add the features to get feature X w1 ;

[0024] Features Add the features to get feature X w2 ;

[0025] For feature X w1 , X w2 Perform feature fusion to obtain the spatial reorganization feature X w .

[0026] Furthermore, the operations performed by the channel reconstruction unit include:

[0027] Rearrange the space feature X w Split into two parts along the channel, namely aC and (1-a)C channels, where 0≤a≤1 is the split ratio and C is the number of channels;

[0028] S 1 Use 1×1 convolution to compress the channels of the two partial feature maps and obtain the upper X corresponding to aC and (1-a)C channels upand lower X low ;

[0029] X up Perform group convolution and point convolution to obtain the feature map Y 1 ;

[0030] X low Apply point convolution and then with X low Concatenate and generate feature map Y 2 ;

[0031] For feature map Y 1 and feature map Y 2 The fusion is performed to obtain the fused feature map Y.

[0032] Furthermore, for X up Perform group convolution and point convolution to obtain the feature map Y 1 , expressed as:

[0033]

[0034] Among them, M G Yes X up The weight matrix for group convolution, M P1 Yes X up The weight matrix for point convolution;

[0035] X low Apply point convolution and then with X low Concatenate and generate feature map Y 2 , expressed as:

[0036]

[0037] Among them, M P2 Yes X low The weight matrix for point convolution, ∪ is the concatenation operation;

[0038] For feature map Y 1 and feature map Y 2 The fusion is performed to obtain the fusion feature map Y, which specifically includes the following steps:

[0039] For feature map Y 1 , Y 2 The corresponding global channel descriptor S is calculated by global average pooling respectively. 1 , S 2 :

[0040]

[0041] Among them, H and W represent the feature map Y 1 and Y 2 The height and width, Yc (i,j) represents the channel feature value at position (i,j);

[0042] The global channel descriptor S 1 and S 2 Stacked together, and using the Softmax soft attention operation to generate the feature importance feature vector β 1 and β 2 :

[0043]

[0044] Based on the feature vector β 1 and β 2 Fusion Y 1 and Y 2 , and get the fused feature map Y:

[0045] Y=β 1 Y 1 +β 2 Y 2 .

[0046] Further,

[0047] The operations performed by the bidirectional feature pyramid include:

[0048] Delete the redundant nodes in the feature pyramid that are not directly involved in feature fusion and information transmission;

[0049] Starting from the top node, high-level features are passed down layer by layer by connecting nodes in each layer in sequence;

[0050] Starting from the bottom layer nodes, low-level features are passed upward layer by layer by connecting nodes in each layer in sequence;

[0051] Learnable weights are attached to the connecting edges of each transfer arrow. These weights are optimized through the back-propagation algorithm, allowing the network to dynamically adjust the strength of feature fusion.

[0052] Furthermore, the operations performed by the GAM attention module include:

[0053] The channel attention module is used to extract the channel attention weight of the input feature F1;

[0054] Multiply the extracted channel attention weights by the input feature F1 element by element to obtain the intermediate feature F2;

[0055] The spatial attention module is used to extract the spatial attention weight of the intermediate feature F2;

[0056] The extracted spatial attention weights are multiplied element-wise with the intermediate feature F2 to obtain the output feature F3.

[0057] Furthermore, the operation performed by the channel attention module includes the steps of:

[0058] Through the operation of global average pooling or global maximum pooling, the global context information is extracted from the input feature F1 to obtain the global feature vector;

[0059] The global feature vector is input into the multi-layer perceptron, and the channel attention weight is calculated through the fully connected layer and activation function;

[0060] The operations performed by the spatial attention module include:

[0061] In the spatial dimension, the input feature F2 is subjected to a 7×7 convolution operation, and the spatial attention weight is calculated through a 7×7 convolution layer and an activation function.

[0062] Furthermore, the Wise-IoU loss function is expressed as:

[0063] L WIou =rR WIoU L IoU

[0064] Among them, the parameter γ is used to dynamically adjust the loss value, R WIoU is the distance loss between the predicted box and the center point of the real box, L IoU is the IoU loss;

[0065] γ is calculated by the following formula:

[0066]

[0067] Among them, β, δ, and α are different weight parameters;

[0068] R WIoU Calculated by the following formula:

[0069]

[0070] Among them, (xx gt ) and (yy gt ) represent the center coordinate differences between the predicted box and the real box in the x and y directions, respectively. It is the sum of the squares of the width and height of the minimum enclosing area of ​​the predicted box and the true box. exp() refers to an exponential function with the natural constant e as the base. The * in the figure indicates that the calculation of this part is performed without participating in back propagation.

[0071] The present invention also provides a power contact network foreign body detection system based on an improved YOLOv8 neural network, the key of which is that an intelligent agent is provided, and the intelligent agent is used to implement the power contact network foreign body detection method based on the improved YOLOv8 neural network.

[0072] The invention provides a method and system for detecting foreign objects in an electric contact network by improving a YOLOv8 neural network. The method and system realize high-accuracy foreign object detection by improving a YOLOv8 neural network to construct a foreign object detection model for an electric contact network. In the Neck part of the YOLOv8 network, a C2f-SCConv module is formed by combining cross-stage partial links and spatial channel reconstruction convolution to replace the original C2f module, so as to improve the adaptability of the network model to foreign object features and background changes; a BiFPN (bidirectional feature pyramid) structure is embedded after the C2f-SCConv module in the Neck part of the YOLOv8 network to effectively integrate feature information of different scales and improve the accuracy of multi-scale foreign object detection; a GAM attention mechanism is embedded after the last layer of the C2f module in the backbone part of the YOLOv8 network to enhance image noise suppression and improve the robustness of network recognition; a Wise-IoU loss function is introduced in the YOLOv8 model to enhance the sensitivity of the network to complex boundaries and improve the network's ability to capture details. The experimental results show that the power contact network foreign object detection model constructed by improving the YOLOv8 neural network has an average accuracy of 89.9% in railway contact network foreign object identification, and significantly enhances the detection effect of small targets, meeting the actual needs of railway contact network foreign object identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 It is a network structure diagram of a foreign body detection model for a power contact network provided by an embodiment of the present invention;

[0074] Figure 2 is a network structure diagram of a space reconstruction unit (SRU) provided in an embodiment of the present invention;

[0075] Figure 3 is a network structure diagram of a channel reconstruction unit (CRU) provided in an embodiment of the present invention;

[0076] Figure 4 is a network structure diagram of BiFPN provided by an embodiment of the present invention;

[0077] Figure 5 is a processing flow chart of the GAM attention module provided by an embodiment of the present invention;

[0078] Figure 6 is a processing flow chart of a channel attention module provided by an embodiment of the present invention;

[0079] Figure 7is a processing flow chart of a spatial attention module provided by an embodiment of the present invention;

[0080] Figure 8 It is a comparison diagram of the detection before and after the improvement of the YOLOv8 neural network model provided by an embodiment of the present invention;

[0081] Fig. 9 : is a diagram showing the influence of C2f-SCConv at different positions on the model detection effect provided by an embodiment of the present invention;

[0082] Fig.10 This is a diagram of experimental results of introducing different attention mechanisms provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0083] The following specifically illustrates the implementation mode of the present invention in conjunction with the accompanying drawings. The embodiments are provided for illustrative purposes only and cannot be understood as limiting the present invention. The accompanying drawings are provided for reference and illustration only and do not constitute a limitation on the scope of patent protection of the present invention, because many changes can be made to the present invention without departing from the spirit and scope of the present invention.

[0084] The electric overhead line foreign body detection method of the improved YOLOv8 neural network provided in the embodiment of the present invention comprises the following steps:

[0085] Improve the YOLOv8 neural network to build a foreign body detection model for the electric contact network;

[0086] Build a dataset;

[0087] The constructed data set is used to train and test the constructed power overhead line foreign body detection model;

[0088] The trained and tested foreign object detection model for electric contact network is applied to the actual foreign object detection for electric contact network.

[0089] Detecting foreign objects in the contact network is an important measure to ensure the complete, efficient and economical operation of trains. YOLOv8 inherits and optimizes the efficient real-time performance of the YOLO series models. The detection of foreign objects in the contact network usually needs to be carried out in a complex and dynamic environment. High precision and real-time performance are the key to ensuring the effective operation of the detection system. However, the basic model of YOLOv8 is still insufficient in detecting irregular and large-sized foreign objects in the contact network in complex environments.

[0090] Therefore, an embodiment of the present invention proposes a power contact network foreign body detection model of an improved YOLOv8 neural network that integrates a C2f-SCConv module, a BiFPN structure, a GAM attention mechanism, and a Wise-IoU loss function. The steps of improving the YOLOv8 neural network include: in the Neck part of the YOLOv8 network, the cross-stage partial link and the spatial channel reconstruction convolution are combined to form a C2f-SCConv module to replace the original C2f module, so as to improve the adaptability of the network model to foreign body features and background changes; secondly, in the Neck part of the YOLOv8 network, a BiFPN (bidirectional feature pyramid) structure is embedded after the C2f-SCConv module to effectively integrate feature information of different scales and improve the accuracy of multi-scale foreign body detection; then, a GAM attention mechanism is embedded after the last layer of the C2f module in the backbone part of the YOLOv8 network to enhance image noise suppression and improve the robustness of network recognition; finally, the Wise-IoU loss function is introduced in the YOLOv8 model to enhance the network's sensitivity to complex boundaries and improve the network's ability to capture details.

[0091] The network structure of the foreign body detection model for the electric contact network obtained by improving the YOLOv8 neural network is as follows: Figure 1 As shown, based on the original YOLOv8 neural network, this embodiment makes four improvements:

[0092] 1. In the Neck part of the YOLOv8 network, the cross-stage partial links and spatial channel reconstruction convolutions are combined to form the C2f-SCConv module to replace the original C2f module;

[0093] 2. Embed the BiFPN (bidirectional feature pyramid) structure after the C2f-SCConv module in the Neck part of the YOLOv8 network;

[0094] 3. Embed the GAM attention mechanism / module after the last layer of C2f module in the backbone of the YOLOv8 network;

[0095] 4. Introduce the Wise-IoU loss function in the YOLOv8 model.

[0096] (1) C2f-SCConv module

[0097] In the basic YOLOv8 network structure, the feature extraction module is the C2f module (Cross-Stage Partialconnections). Through the cross-stage partial connection design, the network's feature transfer and fusion capabilities are enhanced, so that feature information at different levels can be more effectively combined, thereby improving the detection accuracy and computational efficiency of the model. However, it is still not flexible enough for target extraction in complex environments such as low-light environments at night and dynamic environments. Therefore, in the Neck part of the basic network YOLOv8, the cross-stage partial connection and spatial channel reconstruction convolution are combined to form a C2f-SCConv module to replace the original C2f module, which effectively enhances the feature extraction capability of contact network foreign objects in complex environments and improves the detection capability of small targets such as white plastic bags.

[0098] C2f-SCConv (Spatial and Channel Reconstruction Convolution) is a new convolutional neural network (CNN) module that can reduce redundant features in standard convolution, reduce computational and storage costs, and improve model performance. The C2f-SCConv module consists of two units: the spatial reconstruction unit (SRU) and the channel reconstruction unit (CRU).

[0099] The purpose of the Spatial Reconstruction Unit (SRU) is to reduce spatial redundancy in feature maps. It distinguishes between informative and less informative feature maps based on their spatial content through separation and reconstruction operations. SRU enhances representative features while suppressing redundant features in the spatial dimension, such as Figure 2 shown.

[0100] SRU first uses group normalization (GN) to normalize the given input feature X to obtain X out , as shown in the following formula (1):

[0101]

[0102] Where μ and σ are the mean and standard deviation of X, ε is a small constant used to stabilize the calculation (to prevent the denominator from being zero), and γ and β are trainable affine transformation parameters.

[0103] The trainable parameter γ in the GN layer is used to measure the spatial information richness of each feature map, and these parameters are normalized to reflect the importance of different feature maps, as shown in the following formula (2):

[0104]

[0105] W γ represents the importance weight of each feature map, γ i, γ j represents the eigenvalues ​​of channels i and j, C represents the number of channels, and w i represents the weight of channel i.

[0106] Then W γ and X out The Sigmoid function is used to map the information to the range of (0,1), and the threshold set in the experiment is used to distinguish between feature maps with rich information and feature maps with redundant information. For example, the mapping values ​​greater than the threshold are set to 1, and the rest are set to 0, so as to obtain the information weight W 1 and the non-information weight W 2 . Get the information weight W 1 and the non-information weight W 2 The process is as follows:

[0107] W=Gate(Sigmoid(W γ (GN(X)))) (3)

[0108] Gate() represents a threshold function, values ​​greater than the threshold are set to 1, and the rest are set to 0.

[0109] Then the input features X and W are 1 and W 2 Multiply together to get informative features and less informative features Finally, the informative features and less informative features Perform cross reconstruction and obtain the spatial reorganization feature X w , as shown in formula (4):

[0110]

[0111] in, is the element-wise summation and ∪ is the concatenation / concatenation operation. is from The extracted spatially informative features are is from The extracted features have less spatial information. is from The extracted spatially informative features are is from Extract features with less spatial information.

[0112] Although SRU can effectively reduce redundancy in spatial dimension, in deep convolutional neural network, feature map has redundancy not only in spatial dimension but also in channel dimension. Therefore, it is necessary to reduce channel redundancy through segmentation-conversion-fusion strategy of channel reconstruction unit (CRU). The specific process is as follows: Figure 3 shown.

[0113] First, the given space is reorganized into features X W The input is sent to the splitting stage and split into two parts along the channel, namely aC and (1-a)C channels, where 0≤a≤1 is the split ratio. Then 1×1 convolution is used to compress the channels of the feature map to improve computational efficiency. The split and compressed aC and (1-a)C channel feature maps correspond to the upper X up and lower X low .

[0114] In the conversion phase, up Group convolution (GWC) and point convolution (PWC) are performed to extract high-level representative information while reducing the computational cost. The combined representative feature map Y 1 The calculation formula is shown in (5):

[0115]

[0116] Among them, M G Yes X up The weight matrix for GWC, M P1 Yes X up The weight matrix for PWC.

[0117] X low Apply PWC operation and then low Concatenate and generate feature map Y 2 , the calculation formula is shown in (6):

[0118]

[0119] Among them, M P2 Yes X low The weight matrix for PWC.

[0120] In the feature fusion stage, Y is fused by a simplified SKNet method. 1 and Y 2 Perform adaptive fusion.

[0121] First, the feature map Y 1 , Y 2 Collect global information through global average pooling and calculate the statistics S of the channel dimension 1 , S 2, as shown in formula (7).

[0122]

[0123] H and W represent the height and width of the feature map, Y c (i,j) represents the channel feature value at a specific position (i,j).

[0124] The global channel descriptor S of the upper and lower layers 1 and S 2 Stacked together, and using the Softmax soft attention operation to generate the feature importance feature vector β 1 and β 2 , as shown in (8):

[0125]

[0126] Finally, in the feature importance feature vector β 1 and β 2 Under the guidance of 1 and Y 2 , we get the channel-optimized feature map Y, as shown in (9):

[0127] Y=β 1 Y 1 +β 2 Y 2 (9)

[0128] In summary, the C2f-SCConv module aims to reduce feature redundancy through spatial and channel reconstruction units, thereby reducing computational costs and improving the performance of convolutional neural networks.

[0129] (2) BiFPN structure

[0130] There are many kinds of foreign objects that can damage the contact network, such as balloons, kites, plastic bags, dust nets, branches, construction waste, etc. Since these foreign objects have significant differences in material, size, color, and shape, feature fusion poses a considerable challenge. In the traditional YOLOv8 model, the PA-FPN feature fusion structure that combines feature pyramids with path aggregation networks is used to fuse features at different levels through a top-down and bottom-up bidirectional fusion network. Figure 4 As shown in (a) and (b).

[0131] Since foreign objects on the contact network have multi-scale characteristics, the traditional feature fusion structure has low detection accuracy and slow detection speed. Therefore, a bidirectional feature pyramid (BiFPN) network can be used as a substitute to improve detection accuracy and speed.

[0132] Weighted bidirectional feature pyramid fusion network BiFPN, such as Figure 4 As shown in (c). It is a modification of FPN (feature pyramid). The improved structure removes redundant nodes that do not need to be fused for features and simplifies the network. As can be seen from the picture, some intermediate nodes in FPN are removed, while the main feature fusion nodes are retained. In BiFPN, top-down pathways are represented by blue arrows. These pathways pass high-level semantic features downward from the highest layer, such as the blue arrows from the top node to the next layer node. Bottom-up pathways are represented by red arrows. These pathways pass low-level position information upward from the lowest layer, such as the red arrows from the lowest layer node to the previous layer node. New skip connection pathways are added between the input nodes and output nodes of the same layer. These pathways are represented by green arrows to ensure that features of the same size can be directly fused. For example, the green arrows between the nodes of each layer directly connect the up and down sampled features. In addition, new edges with context information are added, represented by purple arrows. These edges connect feature nodes of different layers, pass context information, and ensure that a wider range of context information is considered when fusion of features is performed. For example, purple arrows connect nodes at different levels. Each connection edge is multiplied by a learnable weight, which is learned through the training process. Through back-propagation optimization, the network can dynamically adjust the strength of feature fusion. For example, learnable weights are attached to each connection edge of the blue, red, green and purple arrows to ensure the adaptability and flexibility of feature fusion, so that feature fusion can be carried out more effectively. In summary, the BiFPN structure simplifies the original structural design, reduces the computational complexity, and improves the utilization rate of effective features. In the detection of foreign objects in the power contact network, it effectively enhances the detection ability of multi-scale targets and improves the detection accuracy and robustness of the model in complex backgrounds.

[0133] (3) GAM attention mechanism / module

[0134] With the continuous development of deep learning technology, various new attention mechanisms have emerged, which has improved the performance of various computer vision tasks. Therefore, the GAM attention module is added to the YOLOv8 backbone network. This global attention module is particularly suitable for processing visual tasks such as foreign body detection in power contact network, which has long-distance dependencies and complex backgrounds. By combining channel attention and spatial attention, it amplifies cross-dimensional dependencies, improves the model's global perception of input features, and improves the accuracy, positioning accuracy and robustness of the model in identifying foreign bodies in the contact network.

[0135] like Figure 5 As shown in the flowchart of the GAM attention module, the operations performed by the GAM attention module include:

[0136] The channel attention module Mc (mechanism) is used to extract the channel attention weight of the input feature F1;

[0137] Multiply the extracted channel attention weights by the input feature F1 element by element to obtain the intermediate feature F2;

[0138] The spatial attention module Ms (mechanism) is used to extract the spatial attention weight of the intermediate feature F2;

[0139] The extracted spatial attention weights are multiplied element-wise with the intermediate feature F2 to obtain the output feature F3.

[0140] By fusing the results of channel attention and spatial attention, the input features are comprehensively weighted. This ensures that the input features are effectively enhanced in both channel and spatial dimensions, thereby generating a more accurate feature representation. After inputting the feature map F1, the channel attention map Mc(F1) is calculated by the channel attention mechanism. The weight map of Mc(F1) is element-wise multiplied with F1 to obtain the intermediate feature F2. Then, F2 is calculated by the spatial attention mechanism to obtain the spatial attention map Ms(F2). The weight map of Ms(F2) is element-wise multiplied with F2 to obtain the output feature map F3. The calculation formula is as follows:

[0141]

[0142] like Figure 6 As shown in the structural diagram of the channel attention module, the operations performed by the channel attention module include:

[0143] ① First, extract the global context information from the input features through global average pooling or global maximum pooling to obtain a global feature vector. Global pooling can effectively capture the global information of the input features and generate a feature vector representing the global context.

[0144] ②After obtaining the global feature vector, it is input into MLP (Multi-layer Perceptron), and the attention weights are calculated through a series of fully connected layers and activation functions (such as ReLU, sigmoid). These weights will be used to weight the input features in the channel dimension so that important channel features are enhanced.

[0145] like Figure 7 As shown in the structure diagram of the spatial attention module, the operations performed by the spatial attention module include:

[0146] In the spatial dimension, the input feature F2 is convolved by 7×7 to extract spatial information, and the spatial attention weights are calculated through the 7×7 convolution layer and activation function. These weights are also used to weight the input features in the spatial dimension, so that important spatial position features are strengthened.

[0147] (4) Loss Function

[0148] The evaluation of target detection performance is closely related to the design of loss functions. The bounding box loss function used by the original YOLOv8 model is CIoU. Although CIoU significantly improves the convergence speed and positioning accuracy of the model by comprehensively considering the distance, overlapping area and size comparison between the predicted box and the real box compared to the traditional IoU, the boundary accuracy is still insufficient when dealing with irregular shapes and small foreign objects.

[0149] At present, there is a lack of datasets for contact network foreign objects. Most datasets are derived from self-annotation and inevitably contain some low-pixel images and low-quality annotation boxes. In addition, since contact network foreign objects are of various types, shapes, and most of them are small targets, the Wise-IoU function is replaced by the bounding box regression loss function in the YOLOv8 network, such as Figure 1 As shown in the figure, the dynamic focusing mechanism is introduced to effectively process low-quality samples during training, reduce the penalty of geometric factors on low-quality samples, and thus improve the generalization ability of the model.

[0150] The calculation formula of Wise-IoU is shown in formula (11):

[0151] L WIou =rR WIoU L IoU (11)

[0152] Among them, the parameter r is used to dynamically adjust the loss value, R WIoU is the distance loss between the predicted box and the center point of the real box, L IoU That is the traditional IoU loss.

[0153] γ is calculated by the following formula:

[0154]

[0155] Among them, β, δ, and α are weight parameters used to control the sensitivity of the loss function to different errors.

[0156] R WIoU The calculation formula is as follows:

[0157]

[0158] Among them, (xx gt ) and (yy gt ) represent the center coordinate differences between the predicted box and the real box in the x and y directions respectively. It is the sum of the squares of the width and height of the minimum enclosing area of ​​the predicted box and the true box, which is used to normalize the distance. exp() refers to an exponential function with the natural constant e as the base. The * in the figure indicates that the calculation of this part is performed without participating in back propagation.

[0159] L IoU This is the traditional IoU loss, which is used to measure the overlap between the predicted box and the true box.

[0160] Based on the above method, an embodiment of the present invention also provides an electric contact network foreign object detection system with an improved YOLOv8 neural network, which is provided with an intelligent agent, and the intelligent agent is used to implement the electric contact network foreign object detection method with an improved YOLOv8 neural network.

[0161] In summary, the electric contact network foreign body detection method and system of the improved YOLOv8 neural network provided by the embodiment of the present invention realizes high-accuracy foreign body detection by improving the YOLOv8 neural network to construct a foreign body detection model for the electric contact network. In the Neck part of the YOLOv8 network, the cross-stage partial link and the spatial channel reconstruction convolution are combined to form a C2f-SCConv module to replace the original C2f module, so as to improve the adaptability of the network model to foreign body features and background changes; in the Neck part of the YOLOv8 network, a BiFPN (bidirectional feature pyramid) structure is embedded after the C2f-SCConv module to effectively integrate feature information of different scales and improve the accuracy of multi-scale foreign body detection; a GAM attention mechanism is embedded after the last layer of the C2f module of the backbone part of the YOLOv8 network to enhance image noise suppression and improve the robustness of network recognition; a Wise-IoU loss function is introduced in the YOLOv8 model to enhance the sensitivity of the network to complex boundaries and improve the network's ability to capture details.

[0162] The effect of the present invention is verified by experiments below.

[0163] 1. Experimental data

[0164] The contact network foreign body dataset used in the embodiment of the present invention is mainly derived from the public RailFOD23 dataset, from which 625 pictures are selected. In addition, 146 contact network foreign body pictures are collected from the website, totaling 771 original pictures. In order to improve the robustness of the model, the dataset is expanded 9 times to 6939 pictures by randomly combining one or more of the following methods: flipping, random cropping, changing hue, and adding noise. The dataset is divided into 8:1:1 ratios, with 5909 training sets, 535 validation sets, and 500 test sets.

[0165] Use labelimg to label the image, marking the type of foreign objects as 0 for floaters and 1 for bird nests. Foreign objects on the contact network are mainly light floating objects such as balloons, kites, and plastic bags, while foreign objects on the contact network support are mainly bird nests, most of which are elliptical.

[0166] 2. Parameter settings

[0167] The training parameters are shown in the table. The border loss hyperparameters of Wise-IoU are α=1.9 and δ=3.

[0168] Table 1 Training parameter configuration

[0169] Initial learning rate Iterations Batch size Image size Gradient Momentum 0.01 200 16 640X640 0.937

[0170] 3. Model evaluation criteria

[0171] The evaluation criteria in this example are considered from the following aspects: mean average precision (mAP), mean accuracy (AP), accuracy (P) and recall (R), among which mean average precision is taken as the core criterion for evaluation.

[0172] 4. Experimental analysis

[0173] 1) Comparison of detection effects

[0174] In order to evaluate the performance and detection effect of the improved model, this example selected 4 images for comparison. The comparison results are as follows: Figure 8 As shown in the figure, the comparison results of the four images before and after improvement are as follows: Figure 8 As shown in (a), (b), (c) and (d).

[0175] By comparison Figure 8 From (a) and (b), we can see that no matter how many or few types and quantities of foreign bodies in the contact network there are, as long as the target is large or medium-sized, the improved models can accurately identify it. Figure 8 As can be seen from (c), when there are small objects, there is less semantic information, which leads to missed detections in the YOLOv8 benchmark algorithm. However, the improved model uses the C2f-SCConv module, which can more accurately identify small objects. Figure 8 As can be seen from (d), due to the influence of lighting conditions, there is a certain similarity between foreign objects and the background, which leads to missed detection by the original model. Overall, the improved model adopts the GAM attention mechanism, which can better focus on important information in the image while suppressing irrelevant background noise, thereby more effectively identifying foreign objects.

[0176] 2) C2f-SCConv module position comparison

[0177] In order to test the influence of C2f-SCConv in different positions on the model detection effect, all C2f in the backbone network (Backbone) are replaced with C2f-SCConv and all C2f in the Neck are replaced with C2f-SCConv on the basic model of YOLOv8 for comparison. The experimental results are shown in the figure. Fig. 9 shown.

[0178] Fig. 9 The experimental results show that applying C2f-SCConv to the Neck part is more effective in improving the detection effect. The AP% (floater) and AP% (nest) applied to the Neck part are higher than those applied to the Backbone part, especially the improvement in the "nest" category. This shows that in the Neck part, C2f-SCConv can better integrate feature information from different scales, thereby improving detection accuracy. In the Backbone part, the complexity introduced by C2f-SCConv may lead to excessive consumption of computing resources, and thus fail to effectively extract the required low-level features, affecting the overall detection effect.

[0179] 3) Comparison of attention mechanisms

[0180] In order to test the effectiveness of the GAM attention mechanism, after replacing the C2f-SCConv module, optimizing the BiFPN structure and the loss function Wise-IoU, we added the Squeeze-and-Excitation Networks (SE): re-weighted channel features, the Convolutional Block Attention Module (CBAM): optimized spatial and channel features, the Coordinate Attention Mechanism (CA): enhanced cross-channel features, and the Global Attention Mechanism (GAM): weighted global features. The experimental results are shown in Figure 2. Fig.10 shown.

[0181] Depend on Fig.10It can be seen that after adding the above four attention mechanisms respectively, the mAP has been improved compared with the YOLOv8 basic model. When the SE attention mechanism and the CA attention mechanism are introduced, the mAP of the model is relatively low. The SE attention mechanism uses a global average pooling operation and loses some local related features, while the CA attention mechanism cannot make full use of local features, resulting in its performance not being outstanding enough. When the GAM attention mechanism and the CBAM attention mechanism are introduced, the mAP performance of the model is similar. In addition, CBAM performs best in AP%(floater), but its AP%(nest) is lower than GAM, and even worse than the basic model. This shows that GAM can better play its advantages than CBAM in complex backgrounds.

[0182] 4) Comparison of target detection algorithms before and after improvement

[0183] In order to evaluate the comprehensive performance of this method and system, the YOLOv8 basic algorithm was selected under the above experimental conditions, and a comparative experiment was carried out on the self-built contact network foreign body dataset. The comparison results are shown in Table 2.

[0184] Table 2 Experimental comparison of different target detection algorithms

[0185]

[0186] From the experimental results in Table 2, we can see that compared with the YOLOv8 baseline algorithm, the AP of the improved YOLOv8 model (ours) floater detection reached 91%, an increase of 3%; the AP of nest detection reached 88.7, an increase of 2.7%. mAP(0.5) increased by 2.8%, and mAP(0.5-0.95) increased by 0.8%. The recall rate (R) decreased by 2.5%, which may be because the improved model increased the complexity and reduced the recall rate. In summary, in practical applications, in order to better detect foreign objects in the contact network in complex railway environments, improved models with higher average precision mean are more suitable.

[0187] By comparing with the YOLOv8 algorithm, the comprehensive performance of the power contact network foreign object detection model is verified, which can meet the actual requirements of the project, effectively detect foreign objects in the contact network, and ensure the safe operation of trains.

[0188] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. Improve the YOLOv8 neural network power contact network foreign body detection method, characterized in that: Includes steps: Improve the YOLOv8 neural network to build a foreign body detection model for the electric contact network; the steps of improving the YOLOv8 neural network include: in the Neck part of the YOLOv8 network, combine the cross-stage partial link and the spatial channel reconstruction convolution to form a C2f-SCConv module to replace the original C2f module; embed a bidirectional feature pyramid after the C2f-SCConv module in the Neck part of the YOLOv8 network; embed a GAM attention module after the last layer of the C2f module in the backbone part of the YOLOv8 network; introduce the Wise-IoU loss function in the YOLOv8 model; Build a dataset; The constructed data set is used to train and test the constructed power overhead line foreign body detection model; The trained and tested foreign object detection model for electric contact network is applied to the actual foreign object detection for electric contact network.

2. The method for detecting foreign matter in a power contact network using an improved YOLOv8 neural network according to claim 1 is characterized in that: The C2f-SCConv module includes a spatial reconstruction unit and a channel reconstruction unit; The operations performed by the space reconstruction unit include: Use the group normalization layer to normalize the given input feature X to obtain X out ; The importance weight W of the input feature X is calculated using the trainable parameter γ in the group normalization layer γ ; W γ and X out Map it to the range of (0,1) through the Sigmoid function, set the threshold, set the mapped values ​​greater than the threshold to 1, and the rest to 0, to obtain the information weight W1 and non-information weight W2; Multiply the input feature X by W1 and W2 respectively to get the corresponding features and Features Features and Features Perform cross reconstruction to obtain the spatial reorganization feature X w .

3. The method for detecting foreign matter in electric overhead line by improving YOLOv8 neural network according to claim 2 is characterized in that: Features and Features Perform cross reconstruction to obtain the spatial reorganization feature X w Specifically: Features Perform group normalization and spatial reconstruction operations respectively to obtain features and Features Perform group normalization and spatial reconstruction operations respectively to obtain features Features Add the features to get feature X w1 ; Features Add the features to get feature X w2 ; For feature X w1 , X w2 Perform feature fusion to obtain the spatial reorganization feature X w .

4. The method for detecting foreign matter in a power contact network using an improved YOLOv8 neural network according to claim 3 is characterized in that: The operations performed by the channel reconstruction unit include: Rearrange the space feature X w Split into two parts along the channel, namely aC and (1-a)C channels, where 0≤a≤1 is the split ratio and C is the number of channels; Use 1×1 convolution to compress the channels of the two partial feature maps and obtain the upper X corresponding to aC and (1-a)C channels up and lower X low ; X up Perform group convolution and point convolution to obtain feature map Y1; X low Apply point convolution and then with X low Splice to generate feature map Y2; The feature map Y1 and the feature map Y2 are fused to obtain the fused feature map Y.

5. The method for detecting foreign matter in electric overhead line by improving YOLOv8 neural network according to claim 4 is characterized in that: X up Perform group convolution and point convolution to obtain the feature map Y1, which can be expressed as: Among them, M G Yes X up The weight matrix for group convolution, M P1 Yes X up The weight matrix for point convolution; X low Apply point convolution and then with X low The concatenation generates the feature map Y2, which is expressed as: Among them, M P2 Yes X low The weight matrix for point convolution, ∪ is the concatenation operation; The feature map Y1 and the feature map Y2 are fused to obtain a fused feature map Y, which specifically includes the following steps: The corresponding global channel descriptors S1 and S2 are calculated for the feature maps Y1 and Y2 respectively by global average pooling: Among them, H and W represent the height and width of feature maps Y1 and Y2 respectively, Y c (i,j) represents the channel feature value at position (i,j); The global channel descriptors S1 and S2 are stacked together and the Softmax soft attention operation is used to generate feature vectors β1 and β2: Based on the feature vectors β1 and β2, Y1 and Y2 are fused to obtain the fused feature map Y: Y=β1Y1+β2Y2.

6. The method for detecting foreign matter in electric overhead line by improving YOLOv8 neural network according to claim 1 is characterized in that: The operations performed by the bidirectional feature pyramid include: Delete the redundant nodes in the feature pyramid that are not directly involved in feature fusion and information transmission; Starting from the top node, high-level features are passed down layer by layer by connecting nodes in each layer in sequence; Starting from the bottom layer nodes, low-level features are passed upward layer by layer by connecting nodes in each layer in sequence; Learnable weights are attached to the connecting edges of each transfer arrow. These weights are optimized through the back-propagation algorithm, allowing the network to dynamically adjust the strength of feature fusion.

7. The method for detecting foreign matter in electric overhead line by improving YOLOv8 neural network according to claim 1 is characterized in that: The operations performed by the GAM attention module include: The channel attention module is used to extract the channel attention weight of the input feature F1; Multiply the extracted channel attention weights by the input feature F1 element by element to obtain the intermediate feature F2; The spatial attention module is used to extract the spatial attention weight of the intermediate feature F2; The extracted spatial attention weights are multiplied element-wise with the intermediate feature F2 to obtain the output feature F3.

8. The method for detecting foreign matter in electric overhead line by improving YOLOv8 neural network according to claim 7 is characterized in that: The operation performed by the channel attention module includes the steps of: Through global average pooling or global maximum pooling operation, the global context information is extracted from the input feature F1 to obtain the global feature vector; The global feature vector is input into the multi-layer perceptron, and the channel attention weight is calculated through the fully connected layer and activation function; The operations performed by the spatial attention module include: In the spatial dimension, the input feature F2 is subjected to a 7×7 convolution operation, and the spatial attention weight is calculated through a 7×7 convolution layer and an activation function.

9. The method for detecting foreign matter in electric overhead line by improving YOLOv8 neural network according to claim 1, characterized in that: The Wise-IoU loss function is expressed as: L WIou =r·R WIoU L IoU Among them, the parameter r is used to dynamically adjust the loss value, R WIoU is the distance loss between the predicted box and the center point of the real box, L IoU is the IoU loss; r is calculated by the following formula: Among them, β, δ, and α are different weight parameters; R WIoU Calculated by the following formula: Among them, (xx gt ) and (yy gt ) represent the center coordinate differences between the predicted box and the real box in the x and y directions, respectively. It is the sum of the squares of the width and height of the minimum enclosing area of ​​the predicted box and the true box. exp() refers to an exponential function with the natural constant e as the base. The * in the figure indicates that the calculation of this part is performed without participating in back propagation.

10. Improved YOLOv8 neural network power contact network foreign body detection system, characterized by: An intelligent agent is provided, which is used to implement the electric contact network foreign body detection method of the improved YOLOv8 neural network as described in any one of claims 1 to 9.

Citation Information

Cited By

  • Defect detection method, system and equipment for power transmission line and storage medium

    CN119649031A

  • Grain flow detection method based on SCConv lightweight improved YOLOv8 model

    CN119672688A

  • Kidney stone detection system based on SCC-YOLOX model

    CN120374544A

  • A kidney stone detection system based on the SCC-YOLOX model

    CN120374544B

  • Food safety intelligent detection method based on improved YOLOv8 model and DeepSeek reasoning

    CN120451967A