Power transmission line foreign matter detection method, system and device and storage medium

By improving the structure and loss function of the YOLOv8x model, the problems of high false negative rate and poor model training effect in foreign object detection of transmission lines were solved, realizing high-precision and low-complexity real-time target detection, and improving the detection capability for complex backgrounds and small targets.

CN121883931APending Publication Date: 2026-04-17NARI INFORMATION & COMM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NARI INFORMATION & COMM TECH
Filing Date
2025-12-17
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies for foreign object detection in power transmission lines suffer from high false negative rates, high false positive rates, and poor model training performance, especially in complex backgrounds and small target detection. Furthermore, imbalanced data samples lead to insufficient model performance.

Method used

An improved YOLOv8x model was adopted, which was extended to four-scale detection by extending the backbone network, adding a P6 stage, replacing the backbone network modules with Focus and C3STR modules, and using DW Conv and adaptive threshold focus loss function in the neck network to optimize the model loss calculation.

Benefits of technology

It improves the accuracy of small target detection, reduces the computational complexity and number of parameters of the model, enhances the feature discrimination ability of complex backgrounds and small targets, improves the detection speed and accuracy, and optimizes the performance of the model under the problem of class imbalance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121883931A_ABST
    Figure CN121883931A_ABST
Patent Text Reader

Abstract

The invention discloses a power transmission line foreign matter detection method, system and device and a storage medium, and the method comprises the steps: inputting a to-be-detected power transmission line image into a trained improved YOLOv8x model, and outputting a power transmission line foreign matter detection result; wherein the improved YOLOv8x model is based on a YOLOv8x model, a backbone network is expanded into four-scale detection, a P6 stage of 1 / 64 scale is added at the tail end of a structure, a first Conv module is replaced by a Focus module, a C2f module is replaced by a C3STR module fused with Swin Transform at P4, P5 and P6 stages, backbone network features are spliced after sampling is carried out on a shallow layer of a neck network, DW Conv is adopted for feature alignment in a deep layer, and then fusion is carried out. And when the improved YOLOv8x model is trained, a self-adaptive threshold focus loss function is adopted to calculate the loss of the model. The foreign matter detection precision of the power transmission line is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of target detection technology, and in particular relates to a method, system, equipment and storage medium for detecting foreign objects in power transmission lines. Background Technology

[0002] The safe and stable operation of transmission lines is crucial to the reliability of power supply in the power system. However, they are often located in complex outdoor environments and are susceptible to interference from foreign objects such as kites and bird nests. The detection of foreign objects with complex backgrounds and small physical dimensions is difficult and poses safety hazards. Therefore, it is of great significance to focus on the detection of small target foreign objects.

[0003] Traditional inspection methods rely on manual patrols, which are inefficient and prone to omissions. While drones equipped with high-definition cameras provide aerial inspection as an auxiliary method, manual interpretation of aerial images remains inefficient and susceptible to human error. Therefore, utilizing deep learning technology to achieve automatic and accurate detection of foreign objects on power transmission lines using aerial photography has become a research hotspot. Currently, deep learning is widely used in power line inspection, and CNN and YOLO-based target detection algorithms have shown initial success in detecting foreign objects on power transmission lines. However, the complex background interference, variable target scale, and unstable lighting conditions in aerial images lead to high false negative and high false positive rates for traditional algorithms. Imbalanced training sample categories also result in extremely poor training performance of deep learning models. Since aerial photography data is generally obtained during power transmission line inspections, the majority of aerial photography data consists of power transmission lines that are operating normally and free of foreign objects. Therefore, negative samples are few in conventional power transmission line aerial photography datasets, and it is difficult to balance the number of samples for different types of foreign objects. Manually screening the dataset is inefficient and may cause the samples to lose their representativeness, meaning that the resulting dataset does not conform to the distribution patterns of various negative sample images. Training the model with a large amount of data will waste a lot of computing resources and the improvement in performance will not be significant. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, system, device and storage medium for detecting foreign objects in transmission lines, thereby improving the accuracy of foreign object detection in transmission lines.

[0005] To solve the above-mentioned technical problems, the present invention is implemented using the following solution: This invention provides a method for detecting foreign objects in power transmission lines, comprising: The image of the transmission line to be detected is input into the trained improved YOLOv8x model, and the output is the foreign object detection result of the transmission line; The improved YOLOv8x model is based on the YOLOv8x model. It expands the backbone network to four-scale detection, adds a 1 / 64 scale P6 stage at the end of the backbone network structure, replaces the first Conv module of the backbone network with a Focus module, and replaces the C2f module with a C3STR module fused with Swing Transformer in the P4, P5, and P6 stages of the backbone network. After upsampling in the shallow layer of the neck network, the backbone network features are spliced ​​together, and in the deep layer of the neck network, DW Conv is used for feature alignment before fusion. The improved YOLOv8x model uses an adaptive threshold focus loss function to calculate the model loss during training.

[0006] Furthermore, the Focus module slices each 2x2 pixel block into four parts and stacks them on the channel dimension, reducing the spatial dimension by half while increasing the number of channels by four times.

[0007] Furthermore, the C3STR module includes a first module, Concat, and CBS modules connected in sequence. The first module includes a second module and a CBS module connected in parallel. The second module includes a CBS module and a Swin Transformer module connected in sequence. The CBS module includes a Conv, a BatchNorm module, and a SiLU activation function connected in sequence.

[0008] Furthermore, the Swin Transformer module includes a Patch Partition module, a first-stage module, a second-stage module, a third-stage module, and a fourth-stage module connected in sequence. The first-stage module includes several sets of Linear Embedding layers and Swin Transformer block layers connected in sequence. The second-stage module, the third-stage module, and the fourth-stage module each include several sets of Patch Merging layers and Swin Transformer block layers connected in sequence. The Swin Transformer block layer includes an MLP layer, an LN layer, a W-MSA / SW-MSA layer, and an LN layer connected in sequence.

[0009] Furthermore, DW Conv decomposes the standard convolution operation into two steps: depthwise convolution and pointwise convolution, and performs convolution operations independently on each channel of the input features.

[0010] Furthermore, improvements to the YOLOv8x model training process include: Preprocess the training images; The preprocessed training images are input into the backbone network of the improved YOLOv8x model to extract feature maps. The extracted feature maps are input into the neck network of the improved YOLOv8x model to effectively fuse and enhance the features at different levels, and organize them into feature representations with rich semantic and spatial detail information from layers P1 to P6. The features from layers P3 to P6 are fed into the decoupling head, and the loss of the improved YOLOv8x model is calculated using the adaptive threshold focus loss function to update and optimize the improved YOLOv8x model, resulting in a trained improved YOLOv8x model.

[0011] Furthermore, the adaptive threshold focus loss function is calculated as follows:

[0012] in, For hyperparameters, This is the current average predicted probability value. This is the predicted probability value of the true target, predicted using the exponential smoothing fitting method:

[0013] in, This represents the average predicted probability value for each training cycle.

[0014] The present invention also provides a foreign object detection system for power transmission lines, comprising: The foreign object detection module for transmission lines is used to input the image of the transmission line to be detected into the trained improved YOLOv8x model and output the foreign object detection results of the transmission line. The improved YOLOv8x model is based on the YOLOv8x model. It expands the backbone network to four-scale detection, adds a 1 / 64 scale P6 stage at the end of the backbone network structure, replaces the first Conv module of the backbone network with a Focus module, and replaces the C2f module with a C3STR module fused with Swing Transformer in the P4, P5, and P6 stages of the backbone network. After upsampling in the shallow layer of the neck network, the backbone network features are spliced ​​together, and in the deep layer of the neck network, DW Conv is used for feature alignment before fusion. The improved YOLOv8x model uses an adaptive threshold focus loss function to calculate the model loss during training.

[0015] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the above-described method for detecting foreign objects in transmission lines.

[0016] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method for detecting foreign objects in transmission lines. Beneficial effects

[0017] This invention introduces a C3STR module incorporating the Swing Transformer architecture, enabling multi-scale feature fusion and enhancing the model's feature fusion and extraction capabilities. This alleviates the common background noise problem in aerial power transmission line images, improves the feature discrimination ability for complex backgrounds and small targets, and enhances the detection accuracy of small targets. Employing DW Conv and Focus lightweight techniques, it significantly reduces the number of model parameters and slightly lowers the model's computational complexity while improving overall detection performance. This allows for real-time target detection while significantly improving detection accuracy and increasing detection speed. Furthermore, an adaptive threshold focus loss function is introduced to calculate the model's loss. This mechanism optimizes the problem of mAP imbalance across different categories, improves the model's target detection performance, and ensures that the model learns complex features more fully. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of the improved YOLOv8x model in a foreign object detection method for power transmission lines provided in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the training process of the improved YOLOv8x model provided in Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of the C3STR module in the improved YOLOv8x model provided in Embodiment 1 of the present invention; Figure 4 This is a schematic diagram of the structure of the Swin Transformer module in the C3STR module provided in Embodiment 1 of the present invention; Figure 5 This is a schematic diagram of the FOCUS module in the improved YOLOv8x model provided in Embodiment 1 of the present invention; Figure 6 This is a schematic diagram illustrating the detection effect of a foreign object detection method for power transmission lines provided in Embodiment 1 of the present invention. Detailed Implementation

[0019] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention. Example 1

[0020] This embodiment provides a method for detecting foreign objects in power transmission lines, and the specific implementation steps are as follows: Step 1: Image preprocessing: Perform preprocessing operations on the input image of the transmission line to be detected.

[0021] Step 2: Input the preprocessed image of the transmission line to be detected into the trained improved YOLOv8x model, and output the foreign object detection results of the transmission line; the details are as follows: Backbone network feature extraction: Input the preprocessed image into the improved CSPDarknet backbone network to extract multi-scale feature information and generate feature maps at different levels; Neck Network Feature Fusion and Enhancement: The feature maps output from the backbone network are fed into the PAPAN neck network to fuse and enhance features from different levels, forming feature representations from P1 to P6 with rich semantic and spatial detail information. The decoupled head outputs detection results: Features from layers P3 to P6 are fed into the decoupled head, which processes and outputs the detection results of the image (such as target category (including four target categories: nest, balloon, trash, kite), location, etc.). Figure 6 As shown.

[0022] Among them, such as Figure 1 As shown, the improved YOLOv8x model is based on the YOLOv8x model: the backbone network is expanded to four-scale detection, and a 1 / 64 scale P6 stage is added at the end of the backbone network structure to enhance the detection capability of small targets. The first Conv module of the backbone network is replaced with a Focus module. The Focus module is added to achieve lossless re-integration of spatial information. In the P4, P5, and P6 stages of the backbone network, the C2f module is replaced with a C3STR module that integrates the Swin Transformer. The introduction of the C3STR module that integrates the Swin Transformer enhances the model's global context modeling capability. The SPPF module is used to strengthen the multi-scale receptive field. The feature fusion strategy in the neck network is optimized. After shallow upsampling, the backbone features are directly concatenated. In the deep layers, DW Conv is used to align the features before fusion. While maintaining the model's feature fusion capability, the computational load is reduced, and the model is lightweight.

[0023] The C2f modules in layers 6, 8, and 10 of the improved YOLOv8x model are replaced with C3STR modules containing a Swing Transformer structure. This module is an improvement upon the C3 module, retaining its feature extraction capabilities while incorporating the sliding window multi-head self-attention mechanism of the Swing Transformer module. This expands the model's receptive field for aerial images of power transmission lines and enables feature interaction between neighboring windows. This structure makes the detection of small targets more accurate and robust than the C2f module. The structure of the C3STR module is as follows: Figure 3 As shown.

[0024] The CBS module typically represents a combination of Convolution-BatchNorm-SiLU, and its structure includes: Convolution (Conv): performing feature extraction or channel adjustment; Batch Normalization (BatchNorm): accelerating training and stabilizing feature distribution; SiLU (Sigmoid Linear Unit): the activation function, with the formula SiLU(x)=x⋅σ(x), where σ(x) is the Sigmoid function. The role of the CBS module is to perform preliminary convolution operations on the input features, adjust the number of channels or spatial resolution, and enhance the nonlinear expressive power of the model and accelerate convergence through the BatchNorm and SiLU activation functions.

[0025] The structure of the Swin Transformer module is as follows: Figure 4 (Note: H The pixel height of the input image. W The pixel width of the input image. CAs shown in the feature map dimension, it mainly consists of a linear normalization layer (LN), windowed multi-head self-attention (W-MSA), a shared perceptron (MLP), and a sliding windowed multi-head self-attention (SW-MSA). The Swin Transformer first divides the input image into blocks using Patch Partition, then constructs feature maps of different sizes through four stages. Stage 1 first uses a Linear Embedding layer, while the remaining three stages use Patch Merging layers for downsampling. The Swin Transformer Block uses both W-MSA and SW-MSA structures alternately, with these two structures appearing together to form the Swin Transformer module. LN is a normalization layer; W-MSA is a windowed multi-head self-attention structure, and SW-MSA is a shifted windowed multi-head self-attention structure; MLP is a multilayer perceptron; Stages 1-4 are stacked modules; the Swin Transformer block is a module composed of LN, MLP, W-MSA, and SW-MSA. Based on the Swing Transformer design, this system incorporates Multi-Head Self-Attention (MHSA) and a Multilayer Perceptron (MLP). It employs window partitioning and shifted window mechanisms to reduce computation and enhance the interaction between local and global features. Its function is to capture long-range dependencies in input features, thereby enhancing the global feature representation capability. Through the self-attention mechanism, it dynamically adjusts the weights of features at different locations, improving the model's ability to model complex patterns.

[0026] The Concat operation concatenates feature maps from different paths along the channel dimension. Its purpose is to fuse features from convolutional and Transformer paths, combining local and global information. This enhances feature diversity and provides richer information for subsequent processing.

[0027] To improve the detection capability of small targets in aerial images of power transmission lines, this method adds a P6 stage to the YOLOv8x backbone network. This improvement effectively alleviates the feature loss problem caused by limited pixel information for small targets by increasing the receptive field and feature information. The newly added P6 stage is located at the end of the backbone network structure, and enhances the model's sensitivity to small targets by introducing higher resolution feature maps.

[0028] Standard convolution performs convolution on all channels of the feature map simultaneously. Depthwise separable convolution (DWConv), on the other hand, breaks down the standard convolution operation into two steps: depthwise convolution (DWC) and pointwise convolution (PWC), performing the convolution operation independently on each channel of the input feature map. If the size of the input feature map is... The output size is For standard convolution, the size of its convolution kernel is The number of input channels is and the number of output channels is . Then the number of parameters for computational load for DWConv, on the other hand, first goes through... The size is Depth-wise convolution is performed using a convolution kernel of depth 1, and then... Each element is 1×1 in size and has a depth of [missing information]. If the convolution kernel is used for pointwise convolution, then the number of parameters... for computational load for The parameter ratio between depthwise separable convolution and standard convolution is:

[0029] The computational workload ratio is:

[0030] For typical output features The value is relatively large, therefore Ignore That is the size of the convolution kernel, so the computational cost and parameter count of a standard convolution are both approximately equal to... Since depthwise separable convolutions are several times more computationally intensive and have far fewer parameters than standard convolutions, replacing standard convolutions with depthwise separable convolutions can optimize the algorithm efficiency of YOLOv8x.

[0031] The FOCUS module achieves downsampling and information retention through slicing operations, the principle of which is as follows: Figure 5As shown, the Focus module first receives the input image and slices each 2x2 pixel block into four parts, stacking them along the channel dimension. This reduces the spatial dimension by half while increasing the number of channels by four times. This operation transforms a 640x640x3 image into a 320x320x12 feature map after passing through the Focus module. This operation preserves all pixel information of the original image by changing the way information is organized, avoiding the information loss that may occur in traditional convolutional downsampling. A standard convolutional layer follows the slicing operation. The purpose of this post-slicing convolutional layer is to extract features and integrate information from the stacked feature map. Due to the increased number of channels, this convolutional layer can learn richer feature representations, which is crucial for subsequent object detection tasks.

[0032] In addition, the training process of the YOLOv8x model has been improved, such as... Figure 2 As shown, it includes: Image preprocessing: Perform necessary preprocessing operations on the input training images to prepare them for subsequent model processing.

[0033] Backbone network feature extraction: The preprocessed image is input into the improved CSPDarknet backbone network, which extracts multi-scale feature information and generates feature maps at different levels.

[0034] Neck Network Feature Fusion and Enhancement: Feature maps extracted from the backbone network are fed into the PAPAN neck network. The neck network effectively fuses and enhances features from different levels, organizing them into feature representations from layers P1 to P6 that have rich semantic and spatial detail information.

[0035] Decoupled Head Calculation of Loss Value: The features from layers P3 to P6 are fed into the decoupled head, and the loss value of the model is calculated using an adaptive threshold focus loss function to guide the updating and optimization of model parameters.

[0036] YOLOv8x uses an improved cross-entropy loss as its classification loss function. While it performs well on general tasks, its performance is slightly worse in aerial power line data due to complex backgrounds, small foreign objects, and class imbalance. Therefore, this study changes the classification loss function to Adaptive Threshold Focal Loss (ATFL). ATFL is an improvement on Focal Loss. By adaptively adjusting loss weights and combining dynamic thresholds and focus mechanisms, ATFL effectively addresses hard-to-classify samples, improving model training performance and efficiency under class imbalance. Its calculation method is as follows:

[0037] In the formula, For hyperparameters, This is the current average predicted probability value. It is the predicted probability value of the true target predicted by the exponential smoothing fitting method, and its calculation method is as follows:

[0038] In the formula, This represents the average predicted probability value for each training cycle.

[0039] The ATFL loss function employs a dynamic adjustment mechanism for samples of varying difficulty, effectively optimizing the sample focus strategy during model training.

[0040] When the sample is a simple sample that is easy to classify, the model's prediction probability of the correct class is... Higher, ATFL will follow The increase in the number of samples automatically reduces the loss value. This design reduces the contribution of simple samples to the total loss, preventing the model from over-focusing on the samples it has already mastered, thus allowing the model to focus more on the key features of the learning target; when the samples are difficult to classify, The low accuracy and large discrepancy between predicted and true labels lead to a significant difference in the weight of the loss in ATFL. By increasing the importance of difficult samples in the loss calculation, the model focuses more on these hard-to-detect targets during training, enhancing its feature learning ability for such samples. Ultimately, this improves the detection accuracy and overall model performance for small and blurred targets in power transmission line inspection images.

[0041] In the ATFL loss function The design incorporates an adaptive mechanism, which avoids the need for repeated manual adjustment of hyperparameters, saving time and costs. At the same time, it can automatically adjust parameters based on the dataset and model training status, improving the model's performance and generalization ability. Example 2

[0042] This embodiment provides a foreign object detection system for power transmission lines, used to implement the foreign object detection method for power transmission lines described in Embodiment 1, including: The foreign object detection module for transmission lines is used to input the image of the transmission line to be detected into the trained improved YOLOv8x model and output the foreign object detection results of the transmission line. The improved YOLOv8x model is based on the YOLOv8x model. It expands the backbone network to four-scale detection, adds a 1 / 64 scale P6 stage at the end of the backbone network structure, replaces the first Conv module of the backbone network with a Focus module, and replaces the C2f module with a C3STR module fused with Swing Transformer in the P4, P5, and P6 stages of the backbone network. After upsampling in the shallow layer of the neck network, the backbone network features are spliced ​​together, and in the deep layer of the neck network, DW Conv is used for feature alignment before fusion. The improved YOLOv8x model uses an adaptive threshold focus loss function to calculate the model loss during training. Example 3

[0043] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the foreign object detection method for power transmission lines described in Embodiment 1. Example 4

[0044] This embodiment provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the foreign object detection method for transmission lines described in Embodiment 1.

[0045] In summary, this invention introduces a C3STR module incorporating the Swing Transformer architecture to achieve multi-scale feature fusion, enhancing the model's feature fusion and extraction capabilities, alleviating the common background noise problem in aerial power transmission line images, improving feature discrimination against complex backgrounds and small targets, and increasing the accuracy of small target detection. The use of DW Conv and Focus lightweight techniques significantly reduces the number of model parameters and slightly lowers the model's computational complexity while improving the overall detection performance, achieving real-time target detection while greatly improving detection accuracy and speed. The introduction of an adaptive threshold focus loss function to calculate the model's loss optimizes the problem of mAP imbalance across different categories, improving the model's target detection performance and ensuring more thorough learning of complex features.

[0046] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0047] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0048] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0049] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes. Obviously, those skilled in the art can make various modifications and variations to this invention without departing from the spirit and scope of the invention. Therefore, if these modifications and variations of the invention fall within the scope of the claims of the invention and their equivalents, the invention is also intended to include these modifications and variations.

Claims

1. A method for detecting foreign objects in power transmission lines, characterized in that, include: The image of the transmission line to be detected is input into the trained improved YOLOv8x model, and the output is the foreign object detection result of the transmission line; The improved YOLOv8x model is based on the YOLOv8x model. It expands the backbone network to four-scale detection, adds a 1 / 64 scale P6 stage at the end of the backbone network structure, replaces the first Conv module of the backbone network with a Focus module, and replaces the C2f module with a C3STR module fused with Swing Transformer in the P4, P5, and P6 stages of the backbone network. After upsampling in the shallow layer of the neck network, the backbone network features are spliced ​​together, and in the deep layer of the neck network, DW Conv is used for feature alignment before fusion. The improved YOLOv8x model uses an adaptive threshold focus loss function to calculate the model loss during training.

2. The method for detecting foreign objects in transmission lines according to claim 1, characterized in that, The Focus module slices each 2x2 pixel block into four parts and stacks them on the channel dimension, reducing the spatial dimension by half while increasing the number of channels by four times.

3. The method for detecting foreign objects in transmission lines according to claim 1, characterized in that, The C3STR module consists of a first module, Concat, and CBS modules connected in sequence. The first module consists of a second module and a CBS module connected in parallel. The second module consists of a CBS module and a Swin Transformer module connected in sequence. The CBS module consists of a Conv module, a BatchNorm module, and a SiLU activation function connected in sequence.

4. The method for detecting foreign objects in transmission lines according to claim 3, characterized in that, The Swin Transformer module includes a Patch Partition module, a first-stage module, a second-stage module, a third-stage module, and a fourth-stage module connected in sequence. The first-stage module includes several sets of Linear Embedding layers and Swin Transformer block layers connected in sequence. The second-stage, third-stage, and fourth-stage modules each include several sets of PatchMerging layers and Swin Transformer block layers connected in sequence. The Swin Transformer block layer includes an MLP layer, an LN layer, a W-MSA / SW-MSA layer, and an LN layer connected in sequence.

5. The method for detecting foreign objects in transmission lines according to claim 1, characterized in that, DW Conv breaks down the standard convolution operation into two steps: depthwise convolution and pointwise convolution, and performs convolution operations independently on each channel of the input features.

6. The method for detecting foreign objects in transmission lines according to claim 1, characterized in that, The improved YOLOv8x model training process includes: Preprocess the training images; The preprocessed training images are input into the backbone network of the improved YOLOv8x model to extract feature maps. The extracted feature maps are input into the neck network of the improved YOLOv8x model to effectively fuse and enhance the features at different levels, and organize them into feature representations with rich semantic and spatial detail information from layers P1 to P6. The features from layers P3 to P6 are fed into the decoupling head, and the loss of the improved YOLOv8x model is calculated using the adaptive threshold focus loss function to update and optimize the improved YOLOv8x model, resulting in a trained improved YOLOv8x model.

7. The method for detecting foreign objects in transmission lines according to claim 1, characterized in that, The adaptive threshold focus loss function is calculated as follows: ; in, Here, is a hyperparameter, is the current average predicted probability value, and is the predicted probability value of the true target predicted using the exponential smoothing fitting method. ; in, This represents the average predicted probability value for each training cycle.

8. A foreign object detection system for power transmission lines, characterized in that, include: The foreign object detection module for transmission lines is used to input the image of the transmission line to be detected into the trained improved YOLOv8x model and output the foreign object detection results of the transmission line. The improved YOLOv8x model is based on the YOLOv8x model. It expands the backbone network to four-scale detection, adds a 1 / 64 scale P6 stage at the end of the backbone network structure, replaces the first Conv module of the backbone network with a Focus module, and replaces the C2f module with a C3STR module fused with Swing Transformer in the P4, P5, and P6 stages of the backbone network. After upsampling in the shallow layer of the neck network, the backbone network features are spliced ​​together, and in the deep layer of the neck network, DW Conv is used for feature alignment before fusion. The improved YOLOv8x model uses an adaptive threshold focus loss function to calculate the model loss during training.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the foreign object detection method for transmission lines according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the foreign object detection method for transmission lines as described in any one of claims 1 to 7.