A power transmission line foreign matter detection algorithm based on SCSM-YOLOv8

By improving the backbone and neck network structure of YOLOv8 and designing SDM, CSPPFS, and SSFFE modules, the difficulties of multi-scale target detection and environmental adaptability of YOLOv8 in foreign object detection of transmission lines were solved, achieving more efficient and higher-precision detection results.

CN120339582BActive Publication Date: 2025-11-18GUANGDONG LEINENG POWER GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510433783.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-11-18
Estimated Expiration
2045-04-08

AI Technical Summary

Technical Problem

The existing YOLOv8 algorithm has difficulties in detecting multi-scale targets and poor detection performance in adverse environments when detecting foreign objects in power transmission lines, making it difficult to meet the high efficiency and high precision requirements of intelligent inspection.

Method used

By improving the backbone and neck network of YOLOv8, SDM, CSPPFS and SSFFE modules were designed. Switchable dilated convolution SDconv, CBAM attention mechanism, SimAM attention mechanism, ECA channel attention mechanism and dynamic feature fusion technology were adopted to improve feature extraction and fusion capabilities.

Benefits of technology

It significantly improves the multi-scale target detection performance and robustness in complex environments for foreign object detection on power transmission lines, achieving higher detection accuracy and speed, and enhancing the overall performance of the algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339582B_ABST
    Figure CN120339582B_ABST
Patent Text Reader

Abstract

The application discloses to the technical field of deep learning target detection and power line foreign matter combination, specifically a power line foreign matter detection algorithm based on SCSM-YOLOv8, including the following specific steps: creating a custom dataset for power line foreign matter detection, and dividing it into three parts: training set, validation set and test set by random sampling method, the proportion is 70%, 20% and 10%; in the main structure, design the SDM module, replace the original C2f standard convolution with the designed switchable expansion convolution SDconv, expand the receptive field, and improve the feature extraction capability of the algorithm; in the main structure, design the CSPPFS module, introduce the CBAM attention mechanism and SimAM attention mechanism in SPPF, improve the target detection performance without increasing the parameter quantity and calculation amount. The application significantly improves the detection effect of the algorithm by using the SDM module, the CSPPFS module and the SSFFE module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deep learning object detection combined with foreign object detection in power transmission lines, specifically a foreign object detection algorithm for power transmission lines based on SCSM-YOLOv8. Background Technology

[0002] Transmission lines traverse complex environments including mountains, cities, and rural areas, making them highly susceptible to the adhesion of various foreign objects. If these foreign objects are not detected and removed in a timely manner, they can cause line outages, leading to widespread power outages, resulting in significant economic losses and profound social impacts. Foreign object detection on transmission lines is a crucial task in power line inspection; however, manual inspection is labor-intensive and inefficient. Currently, intelligent inspection, with its high safety, reliability, and low cost, is becoming the mainstream method for transmission line inspection. The target detection methods in intelligent inspection primarily involve extracting target features and performing target segmentation and recognition. In recent years, deep learning has developed rapidly, and deep learning-based target detection has been applied to foreign object detection on transmission lines.

[0003] Currently, deep learning-based object detection algorithms can be divided into two types: two-stage object detection algorithms, such as R-CNN, Fast R-CNN, and Faster R-CNN, but their slow inference speed does not meet the requirements of current detection tasks. The other type is single-stage object detection algorithms, which can achieve high-speed inference while maintaining excellent detection accuracy; the main representatives include SSD and YOLO. Among them, YOLOv8, with its flexible architecture and free anchor box design, performs excellently in terms of both speed and accuracy. However, in practical applications, YOLOv8 still has some problems, such as difficulties in multi-scale object detection and poor detection performance in adverse environments.

[0004] Therefore, to address the aforementioned issues, this patent proposes a foreign object detection algorithm for power transmission lines based on SCSM-YOLOv8. By improving the backbone and neck networks of YOLOv8, the performance of multi-scale object detection is significantly enhanced, and the robustness of the algorithm in complex environments is strengthened. First, in the backbone structure, an SDM module is designed, replacing the standard C2f convolution with a designed switchable dilated convolution SDconv, expanding the receptive field of the algorithm. This allows for the application of convolutions with different dilation rates on the same input features, and the results of different convolutions are fused through a switching function, thereby expanding the receptive field and capturing more global and local information. Next, in the backbone structure, a CSPPFS module is designed, introducing CBAM and SimAM attention mechanisms into SPPF. This enhances the expressive power of features without increasing the number of parameters or computational cost, further improving object detection performance. Furthermore, in the neck network, an SSFFE module is designed, introducing SDconv and ECA channel attention mechanisms into ASFF, strengthening the feature fusion capability of the neck network in the YOLOv8 algorithm. Summary of the Invention

[0005] To address the aforementioned technical problems, according to one aspect of the present invention, the present invention provides the following technical solution:

[0006] A foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 includes the following specific steps:

[0007] S1: Create a custom dataset for foreign object detection in power transmission lines and divide it into three parts by random sampling: training set, validation set, and test set, with proportions of 70%, 20%, and 10%, respectively.

[0008] S2: In the backbone structure, an SDM module is designed, which replaces the standard convolution of the original C2f with the designed switchable dilatational convolution SDconv to expand the receptive field and improve the feature extraction capability of the algorithm.

[0009] S3: In the main structure, the CSPPFS module is designed, and the CBAM attention mechanism and SimAM attention mechanism are introduced into SPPF to improve the target detection performance without increasing the number of parameters and computation.

[0010] S4: In the neck structure, the SSFFE module is designed, and the SDconv and ECA channel attention mechanisms are introduced into ASFF to enhance the feature fusion part of the neck network in the YOLOv8 algorithm;

[0011] S5: Input the dataset into the algorithm for iterative training. After training is complete, use the optimal algorithm to detect the test set and obtain the final result.

[0012] As a preferred embodiment of the foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 described in this invention, the specific steps of S1 are as follows:

[0013] S11: Create a custom dataset specifically for foreign object detection on power transmission lines, and collect images of power transmission lines from varying environmental conditions and diverse perspectives to form the initial dataset;

[0014] S12: Among the collected images, images of low quality or blurry images are excluded, and only clear, uncompressed two-dimensional images are retained to ensure the clarity and accuracy of the data;

[0015] S13: After screening, 2157 images containing everyday foreign objects were obtained, which constituted the basic dataset. To improve the generalization ability of the algorithm, various data augmentation techniques were applied to the images, including rotation, translation, cropping, flipping, and adjustments to brightness, grayscale, and contrast. Through data augmentation techniques, the number of images increased to 6382, resulting in a custom dataset for foreign object detection in power transmission lines, which contained different types of foreign objects.

[0016] S14: Before algorithm training, the expanded dataset is randomly divided into training, validation, and test sets in a ratio of 7:2:1. After the division, the training set contains 4467 images for algorithm training, the validation set contains 1276 images for algorithm performance verification, and the test set contains 639 images for evaluating the final performance of the algorithm.

[0017] As a preferred embodiment of the foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 described in this invention, wherein: the switchable dilated convolution SDconv in S2 includes a front-end multi-channel global context module, an SDconv unit, and a rear-end multi-channel global context module;

[0018] The steps of the pre-processed multi-channel global context module are as follows: receiving the input feature map and processing it through two pooling layers with different field of view; the two pooling layers can capture global context information at different scales; after processing by the pooling layers, the feature map is further compressed through a 1×1 convolutional layer, reducing the number of channels to half of the original number, so as to reduce the computational burden of the algorithm and extract more refined features; the outputs of the two pooling layers are fused in the channel dimension to integrate context information at different scales and prepare for further processing by the SDconv unit;

[0019] The steps of the SDconv unit are as follows: the input features are processed by two dilated convolutional layers with different dilation rates to capture feature information at different scales; the two dilated convolutional layers are dilated with dilation rates d1 and d2 respectively to extract multi-scale features; a switching function is used to dynamically adjust the output weights of the two dilated convolutional layers. The switching function consists of a 5×5 average pooling layer and a 1×1 convolutional layer, which is used to generate a set of weights to adjust the proportion of contributions from the two convolutional layers; the output of the SDconv unit is a weighted sum of the outputs of the two dilated convolutional layers, which helps the algorithm to fuse features at different scales.

[0020] The steps of the post-multichannel global context module are as follows: after the SDconv unit, the post-multichannel global context module is used again to further refine the features and provide rich contextual information for subsequent layers of the network, thereby enhancing the expressive power of the features.

[0021] As a preferred embodiment of the SCSM-YOLOv8-based foreign object detection algorithm for transmission lines described in this invention, the steps of the SDM module are as follows: the input features first pass through an SDconv layer, then through an SDbottleneck layer, and simultaneously, the input features also pass through a traditional convolutional layer; the output of the SDbottleneck layer is concatenated with the output of the standard convolutional layer in the channel dimension, and then the features are integrated through another SDconv layer, which is finally used as the output of the SDM module.

[0022] The steps of the SDbottleneck are as follows: the input features are first processed through an SDconv, and then through another SDconv. The outputs of the first SDconv and the second SDconv are added element-wise to form a residual connection, which helps to improve gradient flow and prevent gradient vanishing. The feature map after the sum is used as the final output of the SDbottleneck.

[0023] As a preferred embodiment of the SCSM-YOLOv8-based foreign object detection algorithm for transmission lines described in this invention, in the CSPPFS module, the input features of S3 first pass through the CBAM module and then through the SimAM module. The SimAM module enhances important features by adaptively adjusting the channel weights of the feature map, the CBAM module enhances feature representation through explicit channel and spatial attention mechanisms, and the SimAM module adaptively captures salient information in the feature map in a parameterless manner. The combination of the two enables the model to better extract and utilize features at different levels and dimensions, complementing each other. Specifically, the CBAM module performs global feature enhancement at a higher level, while the SimAM module performs local feature enhancement at a lower level. This multi-level feature enhancement strategy enables the model to better capture information at different scales and improve model performance.

[0024] As a preferred embodiment of the foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 described in this invention, wherein: the SSFFE module in S4 is composed of feature size adjustment, dynamic feature fusion, and ECA channel attention mechanism weight calibration;

[0025] In the feature size adjustment, upsampling or downsampling techniques are used to unify the feature map size. During upsampling, convolutional layers are used to adjust the number of channels, and interpolation techniques are used to improve the resolution. For 2x downsampling, SDconv with a stride of 2 is used to adjust both the number of channels and the resolution simultaneously. For 4x downsampling, dimensionality reduction is first achieved using a max pooling layer with a stride of 2, followed by further adjustment using SDconv with a stride of 2. In SDconv, when the dilation rate is set to 3, the size of the convolutional kernel increases, thereby obtaining a wider receptive field, which helps to capture image content more comprehensively during the feature fusion stage.

[0026] In the dynamic feature fusion, SSFFE integrates the feature information of the first three levels after size adjustment, and the information is shared in all channels to promote effective feature integration.

[0027] In the ECA channel attention mechanism weight calibration, the ECA channel attention mechanism first performs global average pooling on each channel of the input feature map, compressing the spatial dimension to 1×1 and generating a channel descriptor containing global information. Then, the ECA channel attention mechanism automatically determines the kernel size of the one-dimensional convolution based on the number of channels and calculates it through a non-linear mapping to ensure that the kernel size is odd to maintain the central symmetry of the convolution operation. The ECA channel attention mechanism uses one-dimensional convolution to process the result of global average pooling to identify the interrelationships between channels. This convolution method avoids the need for dimensionality reduction and expansion, reduces the number of parameters, and preserves the integrity of information. The output of the one-dimensional convolution is activated by the Sigmoid activation function to generate attention weights for each channel. The attention weights reflect the importance of each channel. Finally, the attention weights are multiplied element-wise with the corresponding channels of the original feature map to achieve weighting of channel features, highlighting key features while suppressing less important information.

[0028] As a preferred embodiment of the foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 described in this invention, the calculation formula for ASFF is as follows:

[0029]

[0030] in, The feature vector at position (x,y) represents the output feature map of layer n. α, β and γ represent the spatial weights from layer m (m∈1,2,3) to layer n. A, B and C represent the feature vectors of different feature maps at position (x,y) from layer m to layer n. The ASFF obtains the fused feature F by weighting and summing the feature vectors of different characteristics according to their corresponding spatial weights, thereby integrating the effective information of each layer's features into different scales.

[0031] As a preferred embodiment of the foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 described in this invention, the ECA channel attention mechanism first performs global average pooling on the input feature map to compress the spatial dimension to 1x1, then captures local cross-channel dependencies through one-dimensional convolution, and then activates the result through the Sigmoid activation function to enhance nonlinear features, thereby obtaining the attention weights for each channel. Finally, the obtained attention weight matrix is ​​reshaped into the same shape as the original input feature map and multiplied element-wise with the input feature map to achieve recalibration of channel features.

[0032] The calculation formula for the ECA channel attention mechanism is as follows:

[0033]

[0034] Where k is the size of the one-dimensional convolution kernel, b and γ are hyperparameters, set to 1, C is the number of channels of the input feature, and |t| odd This represents the odd number closest to t, and its formula ensures that the convolution kernel size is odd.

[0035] Compared with existing technologies:

[0036] This invention aims to achieve more accurate foreign object detection in power transmission lines. First, in the backbone structure, an SDM module is designed, replacing the standard C2f convolution with a designed switchable dilated convolution SDconv, expanding the algorithm's receptive field. This allows for the application of convolutions with different dilation rates on the same input features, and the results of different convolutions are fused through a switching function, thereby expanding the receptive field and capturing more global and local information. Next, in the backbone structure, a CSPPFS module is designed, introducing CBAM and SimAM attention mechanisms into SPPF to improve target detection performance without increasing the number of parameters or computational cost. Furthermore, in the neck network, an SSFFE module is designed, introducing SDconv and ECA channel attention mechanisms into ASFF to strengthen the feature fusion part of the neck network in the YOLOv8 algorithm. Attached Figure Description

[0037] Figure 1 This is a flowchart of the method of the present invention;

[0038] Figure 2 This is a diagram of the overall network structure of the present invention;

[0039] Figure 3 This is a structural diagram of the SDconv of the present invention;

[0040] Figure 4 This is a structural diagram of the SDM of the present invention;

[0041] Figure 5 This is a structural diagram of the CSPPFS of the present invention;

[0042] Figure 6 This is a structural diagram of the SSFFE of the present invention;

[0043] Figure 7 This is a structural diagram of the ECA channel attention mechanism of the present invention;

[0044] Figure 8 These are images from a portion of the dataset used in this invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0046] This invention provides a foreign object detection algorithm for transmission lines based on SCSM-YOLOv8. Please refer to [link / reference]. Figures 1-8 The specific steps are as follows:

[0047] S1: Create a custom dataset for foreign object detection in power transmission lines and divide it into three parts by random sampling: training set, validation set, and test set, with proportions of 70%, 20%, and 10%, respectively.

[0048] S2: In the backbone structure, design the SDM module, using the designed switchable dilated convolution SDconv (SDconv structure as follows). Figure 3 (As shown) Replace the original standard C2f convolution to expand the receptive field and improve the algorithm's feature extraction capability;

[0049] S3: In the main structure, the CSPPFS module is designed, and the CBAM attention mechanism and SimAM attention mechanism are introduced into SPPF to improve the target detection performance without increasing the number of parameters and computation.

[0050] S4: In the neck structure, the SSFFE module is designed, and the SDconv and ECA channel attention mechanisms are introduced into ASFF to enhance the feature fusion part of the neck network in the YOLOv8 algorithm;

[0051] S5: Input the dataset into the algorithm for iterative training. After training is complete, use the optimal algorithm to detect the test set and obtain the final result.

[0052] The specific steps of S1 are as follows:

[0053] S11: Create a custom dataset specifically for foreign object detection on power transmission lines, and collect images of power transmission lines from varying environmental conditions and diverse perspectives to form the initial dataset;

[0054] S12: Among the collected images, images of low quality or blurry images are excluded, and only clear, uncompressed two-dimensional images are retained to ensure the clarity and accuracy of the data;

[0055] S13: After screening, 2157 images containing everyday foreign objects were obtained, which constituted the basic dataset. To improve the generalization ability of the algorithm, various data augmentation techniques were applied to the images, including rotation, translation, cropping, flipping, and adjustments to brightness, grayscale, and contrast. Through data augmentation techniques, the number of images increased to 6382, resulting in a custom dataset for foreign object detection on power transmission lines. This dataset contained different categories of foreign objects, such as 1505 balloons, 1765 kites, 1421 bird nests, and 1691 pieces of garbage.

[0056] S14: Before algorithm training, the expanded dataset is randomly divided into training, validation, and test sets in a ratio of 7:2:1. After the division, the training set contains 4467 images for algorithm training, the validation set contains 1276 images for algorithm performance verification, and the test set contains 639 images for evaluating the final performance of the algorithm.

[0057] The switchable dilated convolution SDconv in S2 includes a front-end multi-channel global context module, an SDconv unit, and a rear-end multi-channel global context module;

[0058] The steps of the pre-processed multi-channel global context module are as follows: receiving the input feature map and processing it through two pooling layers with different field of view; the two pooling layers can capture global context information at different scales; after processing by the pooling layers, the feature map is further compressed through a 1×1 convolutional layer, reducing the number of channels to half of the original number, so as to reduce the computational burden of the algorithm and extract more refined features; the outputs of the two pooling layers are fused in the channel dimension to integrate context information at different scales and prepare for further processing by the SDconv unit;

[0059] The steps of the SDconv unit are as follows: the input features are processed by two dilated convolutional layers with different dilation rates to capture feature information at different scales; the two dilated convolutional layers are dilated with dilation rates d1 and d2 respectively to extract multi-scale features; a switching function is used to dynamically adjust the output weights of the two dilated convolutional layers. The switching function consists of a 5×5 average pooling layer and a 1×1 convolutional layer, which is used to generate a set of weights to adjust the proportion of contributions from the two convolutional layers; the output of the SDconv unit is a weighted sum of the outputs of the two dilated convolutional layers, which helps the algorithm to fuse features at different scales.

[0060] The steps of the post-multichannel global context module are as follows: after the SDconv unit, the post-multichannel global context module is used again to further refine the features and provide rich contextual information for subsequent layers of the network, thereby enhancing the expressive power of the features.

[0061] The SDM module (structure as follows) Figure 4 The steps shown in a) are as follows: The input features first pass through an SDconv, then through an SDbottleneck, and at the same time, the input features also pass through a traditional convolutional layer; the output of the SDbottleneck and the output of the standard convolutional layer are concatenated in the channel dimension, and then the features are integrated through another SDconv, which is finally used as the output of the SDM module;

[0062] The SDbottleneck (structure as follows) Figure 4 The steps (as shown in b) are as follows: The input features are first processed through an SDconv, and then through another SDconv. The outputs of the first SDconv and the second SDconv are added element-wise to form a residual connection, which helps to improve gradient flow and prevent gradient vanishing. The feature map after the sum is used as the final output of SDbottleneck.

[0063] Dilated convolution, as a flexible convolution operation, can effectively increase the receptive field of a convolutional network without changing the feature map size. By adjusting the coverage of the convolution kernel, dilated convolution enables the network to capture a wider range of spatial information, which is crucial for understanding contextual relationships in images. Dilated convolution achieves the spacing expansion of the convolution kernel by introducing a key parameter—the "dilation rate." This parameter determines the spacing between kernel elements. In dilated convolution, the kernel size is adjusted according to the dilation rate; for example, when the dilation rate is d, d-1 zeros are inserted between each element of the kernel, thus expanding the original k×k kernel to a larger coverage area. Compared to traditional convolution, dilated convolution expands the receptive field without reducing the feature map resolution, which is important for preserving image detail. In dilated convolution, the actual coverage area of ​​the kernel increases with the dilation rate, meaning that even if the physical size of the kernel remains unchanged, the range of information it can effectively capture will significantly increase.

[0064] The S3 is in the CSPPFS module (structure as follows) Figure 5 As shown in a), its input features first pass through the CBAM module (structure as shown in a diagram). Figure 5 (as shown in b), and then through the SimAM module (structure as shown in b). Figure 5 As shown in c), the SimAM module enhances important features by adaptively adjusting the channel weights of the feature map, the CBAM module enhances feature representation through explicit channel and spatial attention mechanisms, and the SimAM module adaptively captures salient information in the feature map in a parameterless manner. The combination of the two enables the model to better extract and utilize features at different levels and dimensions, complementing each other. Specifically, the CBAM module performs global feature enhancement at a higher level, while the SimAM module performs local feature enhancement at a lower level. This multi-level feature enhancement strategy enables the model to better capture information at different scales and improve model performance.

[0065] The CBAM module consists of a Spatial Attention Module (SAM) and a Channel Attention Module (CAM). The feature map is processed through parallel max pooling and average pooling layers, reducing its size from the original... C×H×W ( C H represents the number of channels, where H is the high channel. W (for width), becomes C×1×1 These two pooling operations do not change the size of the feature map, but they generate two different feature representations: a max pooling result that emphasizes the most salient features, and a mean pooling result that emphasizes the average features. These two pooling results are then passed through a shared multilayer perceptron (MLP) module; in this module, the number of channels in the feature map is first compressed back to its original size. The number of channels is multiplied by a factor of R, where R is the reduction rate, and then expanded back to the original number of channels. After passing through the MLP module, two activated feature maps are obtained. These two feature maps are merged by adding them element-wise. Finally, the merged feature map is passed through a Sigmoid activation function to generate channel attention weights. These channel attention weights are then multiplied element-wise with the original feature map to adjust the weight of each channel, so that the algorithm can focus more on important features.

[0066] The SimAM module first obtains the features of each channel through global average pooling, and then performs the interaction between channels through a 1D convolution. This operation combines information from the spatial dimension and the channel dimension to generate three-dimensional attention weights. Finally, the Sigmoid activation function is used to generate channel weights, which are then multiplied with the original feature map to reweight the features. This process achieves adaptive adjustment of features and improves the expressive power of the network.

[0067] The formula for calculating its weight is:

[0068]

[0069] Where y represents the input feature. For dot product operation, λ is a hyperparameter, C is the number of channels, and t and x j These are the target neuron and the neighboring neurons, respectively; the Sigmoid activation function maps input values ​​to between 0 and 1, which helps control the output range of the neuron.

[0070] The SSFFE module in S4 (structure as follows) Figure 6 (As shown) consists of feature size adjustment, dynamic feature fusion, and ECA channel attention mechanism weight calibration;

[0071] To address the differences in channel count and spatial resolution among feature maps in different layers of the YOLOv8 algorithm, the feature size adjustment employs upsampling or downsampling techniques to unify the feature map size. During upsampling, convolutional layers are used to adjust the number of channels, and interpolation techniques are used to improve resolution. For 2x downsampling, SDconv with a stride of 2 is used to simultaneously adjust the number of channels and resolution. For 4x downsampling, dimensionality reduction is first achieved using a max-pooling layer with a stride of 2, followed by further adjustment using SDconv with a stride of 2. In SDconv, when the dilation rate is set to 3, the size of the convolutional kernel increases, resulting in a wider receptive field, which helps to capture image content more comprehensively during the feature fusion stage.

[0072] In the dynamic feature fusion, SSFFE integrates the feature information of the first three levels after size adjustment, and the information is shared in all channels to promote effective feature integration.

[0073] In the ECA channel attention mechanism weight calibration, the ECA channel attention mechanism first performs global average pooling on each channel of the input feature map, compressing the spatial dimension to 1×1 and generating a channel descriptor containing global information. Then, the ECA channel attention mechanism automatically determines the kernel size of the one-dimensional convolution based on the number of channels and calculates it through a non-linear mapping to ensure that the kernel size is odd to maintain the central symmetry of the convolution operation. The ECA channel attention mechanism uses one-dimensional convolution to process the result of global average pooling to identify the interrelationships between channels. This convolution method avoids the need for dimensionality reduction and expansion, reduces the number of parameters, and preserves the integrity of information. The output of the one-dimensional convolution is activated by the Sigmoid activation function to generate attention weights for each channel. The attention weights reflect the importance of each channel. Finally, the attention weights are multiplied element-wise with the corresponding channels of the original feature map to achieve weighting of channel features, highlighting key features while suppressing less important information.

[0074] The formula for calculating ASFF is as follows:

[0075]

[0076] in, The feature vector at position (x,y) represents the output feature map of layer n. α, β and γ represent the spatial weights from layer m (m∈1,2,3) to layer n. A, B and C represent the feature vectors of different feature maps at position (x,y) from layer m to layer n. The ASFF obtains the fused feature F by weighting and summing the feature vectors of different characteristics according to their corresponding spatial weights, thereby integrating the effective information of each layer's features into different scales.

[0077] ECA channel attention mechanism (structure as follows) Figure 7 As shown, the interaction between channels is achieved through global average pooling and one-dimensional convolution, avoiding the use of complex fully connected layers, thus greatly reducing computational complexity. Compared with traditional attention mechanisms, it uses concise and efficient one-dimensional convolution to capture the dependencies between channels, enhance feature aggregation, and effectively improve computational efficiency. In foreign object detection on power transmission lines, small objects may only occupy a few pixels on the feature map. Therefore, by adding the ECA channel attention mechanism before the small detection head, long-distance dependencies can be effectively captured through local cross-channel interaction, thereby enhancing the algorithm's detection accuracy for small targets.

[0078] To address the issue of varying object scales in foreign object detection on power transmission lines, the ECA channel attention mechanism helps to better integrate multi-scale features from different levels. This mechanism first performs global average pooling on the input feature map, compressing the spatial dimension to 1x1. Then, it captures local cross-channel dependencies through one-dimensional convolution. Next, it activates the result using a Sigmoid activation function to enhance nonlinear features, obtaining the attention weights for each channel. Finally, the resulting attention weight matrix is ​​reshaped to the same shape as the original input feature map and multiplied element-wise with it to achieve channel feature recalibration.

[0079] The calculation formula for the ECA channel attention mechanism is as follows:

[0080]

[0081] Where k is the size of the one-dimensional convolution kernel, b and γ are hyperparameters, set to 1, C is the number of channels of the input feature, and |t| odd This represents the odd number closest to t, and its formula ensures that the convolution kernel size is odd.

[0082] The specific training steps for the algorithm in S5 are as follows:

[0083] The experiment was conducted on a Windows 10 operating system using an Intel(R) Core(TM) i9-10900K processor and an NVIDIA GeForce RTX 3080 graphics card. PyTorch version 2.3.0 was used as the primary development tool. The hyperparameters were set as follows: batch size was 8, epochs were 100, and the Stochastic Gradient Descent (SGD) optimizer was used for algorithm training. The initial learning rate was set to 0.01, and the weight decay was set to 0.0005. Furthermore, all input images were uniformly scaled to 640×640 pixels.

[0084] The specific steps for obtaining the algorithm detection results in S5 are as follows:

[0085] To comprehensively evaluate the performance of the SCSM-YOLOv8 algorithm, multiple evaluation metrics were selected to ensure the objectivity and accuracy of the assessment. These metrics include: Precision (P), Recall (R), F1 score, Average Precision (AP), Mean Average Precision (mAP), and Frames Per Second (FPS) as evaluation indicators to detect network performance. The specific calculation formulas are as follows:

[0086]

[0087] Wherein, TP means the algorithm correctly predicts a positive class sample as a positive class; TN means the algorithm correctly predicts a negative class sample as a negative class; FP means the algorithm incorrectly predicts a negative class sample as a positive class; and FN means the algorithm incorrectly predicts a positive class sample as a negative class.

[0088] AP measures the local performance of the learned algorithm in each class, while mAP measures the overall performance of the learned algorithm across all classes. The specific formulas are as follows:

[0089]

[0090] Where n is the number of images in the test set; i is the i-th image in the test set; p i is the accuracy of a certain category for the i-th image; N is the number of target categories; k represents the k-th category; AP k This represents the average accuracy of the k-th class across all images in the test set;

[0091] In S5, the improved algorithm is compared with different algorithms, specifically as follows:

[0092] To accurately verify the performance of the SCSM-YOLOv8 algorithm in the foreign object detection task on power transmission lines, it was compared with Faster R-CNN, YOLOv5, YOLOX, YOLOv7, and YOLOv8 algorithms. All algorithms were trained and tested under identical conditions. The final experimental results are shown in Table 1.

[0093] Table 1 shows the algorithm's performance across six dimensions: mAP, Recall, Precision, F1, FPS, and number of parameters. SCSM-YOLOv8 achieved the highest mAP, Recall, Precision, and F1, outperforming the second-place algorithm by 2.56%, 3.47%, 3.14%, and 3%, respectively. This demonstrates SCSM-YOLOv8's significant performance advantage. This is primarily attributed to SCSM-YOLOv8's ability to acquire more feature information and efficiently fuse multi-scale information. Despite its larger parameter count, its frame rate performance remains competitive, especially compared to YOLOv7l and YOLOv8s. This indicates that the improved SCSM-YOLOv8 algorithm significantly enhances detection accuracy and improves feature extraction capabilities while maintaining high detection speed, achieving a good balance between performance and efficiency.

[0094] Table 1. Performance comparison of SCSM-YOLOv8 and other methods on the transmission line foreign object dataset.

[0095]

[0096] Note: Bold text indicates the optimal value; underlined text indicates the suboptimal value; - indicates no such data.

[0097] Although the present invention has been described above with reference to embodiments, various modifications can be made and components can be replaced with equivalents without departing from the scope of the invention. In particular, as long as there is no structural conflict, the features in the disclosed embodiments can be combined with each other in any manner. The lack of an exhaustive description of these combinations in this specification is merely for the sake of brevity and resource conservation. Therefore, the present invention is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. A foreign object detection algorithm for transmission lines based on SCSM-YOLOv8, characterized in that, The specific steps are as follows: S1: Create a custom dataset for foreign object detection in power transmission lines and divide it into three parts by random sampling: training set, validation set, and test set, with proportions of 70%, 20%, and 10%, respectively. S2: In the backbone structure, an SDM module is designed, which replaces the standard convolution of the original C2f with the designed switchable dilatational convolution SDconv to expand the receptive field and improve the feature extraction capability of the algorithm. S3: In the main structure, the CSPPFS module is designed, and the CBAM attention mechanism and SimAM attention mechanism are introduced into SPPF to improve the target detection performance without increasing the number of parameters and computation. S4: In the neck structure, the SSFFE module is designed, and the SDconv and ECA channel attention mechanisms are introduced into ASFF to enhance the feature fusion part of the neck network in the YOLOv8 algorithm; S5: Input the dataset into the algorithm for iterative training. After training is complete, use the optimal algorithm to detect the test set and obtain the final result.

2. The foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 according to claim 1, characterized in that, The specific steps of S1 are as follows: S11: Create a custom dataset specifically for foreign object detection on power transmission lines, and collect images of power transmission lines from varying environmental conditions and diverse perspectives to form the initial dataset; S12: Among the collected images, images of low quality or blurry images are excluded, and only clear, uncompressed two-dimensional images are retained to ensure the clarity and accuracy of the data; S13: After screening, 2157 images containing everyday foreign objects were obtained, which constituted the basic dataset. To improve the generalization ability of the algorithm, various data augmentation techniques were applied to the images, including rotation, translation, cropping, flipping, and adjustments to brightness, grayscale, and contrast. Through data augmentation techniques, the number of images increased to 6382, resulting in a custom dataset for foreign object detection in power transmission lines, which contained different types of foreign objects. S14: Before algorithm training, the expanded dataset is randomly divided into training, validation, and test sets in a ratio of 7:2:

1. After the division, the training set contains 4467 images for algorithm training, the validation set contains 1276 images for algorithm performance verification, and the test set contains 639 images for evaluating the final performance of the algorithm.

3. The foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 according to claim 1, characterized in that, The switchable dilated convolution SDconv in S2 includes a front-end multi-channel global context module, an SDconv unit, and a rear-end multi-channel global context module. The steps of the pre-processed multi-channel global context module are as follows: receiving the input feature map and processing it through two pooling layers with different field of view; the two pooling layers can capture global context information at different scales; after processing by the pooling layers, the feature map is further compressed through a 1×1 convolutional layer, reducing the number of channels to half of the original number, so as to reduce the computational burden of the algorithm and extract more refined features; the outputs of the two pooling layers are fused in the channel dimension to integrate context information at different scales and prepare for further processing by the SDconv unit; The steps of the SDconv unit are as follows: the input features are processed by two dilated convolutional layers with different dilation rates to capture feature information at different scales; the two dilated convolutional layers are dilated by dilation rates d1 and d2 respectively to extract multi-scale features; A switching function is used to dynamically adjust the output weights of the two dilated convolutional layers. The switching function consists of a 5×5 average pooling layer and a 1×1 convolutional layer, which is used to generate a set of weights to adjust the proportion of contributions of the two convolutional layers. The output of the SDconv unit is a weighted sum of the outputs of the two dilated convolutional layers, which helps the algorithm to perform feature fusion at different scales. The steps of the post-multichannel global context module are as follows: after the SDconv unit, the post-multichannel global context module is used again to further refine the features and provide rich contextual information for subsequent layers of the network, thereby enhancing the expressive power of the features.

4. The foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 according to claim 3, characterized in that, The steps of the SDM module are as follows: the input features first pass through an SDconv, then through an SDbottleneck, and simultaneously, the input features also pass through a traditional convolutional layer; the output of the SDbottleneck and the output of the standard convolutional layer are concatenated along the channel dimension, and then the features are integrated through another SDconv, which is finally used as the output of the SDM module. The steps of the SDbottleneck are as follows: the input features are first processed through an SDconv, and then through another SDconv. The outputs of the first SDconv and the second SDconv are added element-wise to form a residual connection, which helps to improve gradient flow and prevent gradient vanishing. The feature map after the sum is used as the final output of the SDbottleneck.

5. The foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 according to claim 1, characterized in that, In the CSPPFS module, the input features of S3 first pass through the CBAM module and then through the SimAM module. The SimAM module enhances important features by adaptively adjusting the channel weights of the feature map, while the CBAM module enhances feature representation through explicit channel and spatial attention mechanisms. The SimAM module, on the other hand, adaptively captures salient information in the feature map in a parameterless manner. The combination of the two enables the model to better extract and utilize features at different levels and dimensions, complementing each other. Specifically, the CBAM module performs global feature enhancement at a higher level, while the SimAM module performs local feature enhancement at a lower level. This multi-level feature enhancement strategy enables the model to better capture information at different scales and improve model performance.

6. The foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 according to claim 1, characterized in that, The SSFFE module in S4 consists of feature size adjustment, dynamic feature fusion, and ECA channel attention mechanism weight calibration. In the feature size adjustment, upsampling or downsampling techniques are used to unify the feature map size. During upsampling, convolutional layers are used to adjust the number of channels, and interpolation techniques are used to improve the resolution. For 2x downsampling, SDconv with a stride of 2 is used to adjust both the number of channels and the resolution simultaneously. For 4x downsampling, dimensionality reduction is first achieved using a max pooling layer with a stride of 2, followed by further adjustment using SDconv with a stride of 2. In SDconv, when the dilation rate is set to 3, the size of the convolutional kernel increases, thereby obtaining a wider receptive field, which helps to capture image content more comprehensively during the feature fusion stage. In the dynamic feature fusion, SSFFE integrates the feature information of the first three levels after size adjustment, and the information is shared in all channels to promote effective feature integration. In the ECA channel attention mechanism weight calibration, the ECA channel attention mechanism first performs global average pooling on each channel of the input feature map, compressing the spatial dimension to 1×1 and generating a channel descriptor containing global information. Then, the ECA channel attention mechanism automatically determines the kernel size of the one-dimensional convolution based on the number of channels and calculates it through a non-linear mapping to ensure that the kernel size is odd to maintain the central symmetry of the convolution operation. The ECA channel attention mechanism uses one-dimensional convolution to process the result of global average pooling to identify the interrelationships between channels. This convolution method avoids the need for dimensionality reduction and expansion, reduces the number of parameters, and preserves the integrity of information. The output of the one-dimensional convolution is activated by the Sigmoid activation function to generate attention weights for each channel. The attention weights reflect the importance of each channel. Finally, the attention weights are multiplied element-wise with the corresponding channels of the original feature map to achieve weighting of channel features, highlighting key features while suppressing less important information.

7. The foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 according to claim 6, characterized in that, The formula for calculating ASFF is as follows: in, The feature vector at position (x,y) represents the output feature map of layer n. α, β and γ represent the spatial weights from layer m (m∈1,2,3) to layer n. A, B and C represent the feature vectors of different feature maps at position (x,y) from layer m to layer n. The ASFF obtains the fused feature F by weighting and summing the feature vectors of different characteristics according to their corresponding spatial weights, thereby integrating the effective information of each layer's features into different scales.

8. The foreign object detection algorithm for transmission lines based on SCSM-YOLOv8 according to claim 6, characterized in that, The ECA channel attention mechanism first performs global average pooling on the input feature map to compress the spatial dimension to 1x1. Then, it captures local cross-channel dependencies through one-dimensional convolution. Next, it activates the result through the Sigmoid activation function to enhance non-linear features and obtain the attention weights for each channel. Finally, the obtained attention weight matrix is ​​reshaped to the same shape as the original input feature map and multiplied element-wise with the input feature map to achieve channel feature recalibration. The calculation formula for the ECA channel attention mechanism is as follows: Where k is the size of the one-dimensional convolution kernel, b and γ are hyperparameters, set to 1, C is the number of channels of the input feature, and |t| odd This represents the odd number closest to t, and its formula ensures that the convolution kernel size is odd.

Citation Information

Patent Citations

  • X-ray dangerous object detection method

    CN116758376A

  • PCBA surface defect detection method and system based on image recognition

    CN119273682A