Track foreign matter detection method based on improved YOLO11s

By improving the YOLO11s model and combining it with the ADown module, EMA attention mechanism, and Focaler-WIoU loss function, the problems of low efficiency and accuracy in track detection are solved, and accurate real-time detection of small foreign objects is achieved.

CN120635409APending Publication Date: 2025-09-12NANJING SHIDAO INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510721910.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Traditional track detection methods rely on manual inspections, which are inefficient, greatly affected by subjective factors, and difficult to monitor in real time. In addition, deep learning methods have low detection accuracy in complex and changeable track environments.

Method used

The improved YOLO11s model is used to improve the accuracy and efficiency of small target detection through image preprocessing, data enhancement, feature extraction and loss function optimization, combined with the ADown module, EMA attention mechanism and Focaler-WIoU loss function.

Benefits of technology

It achieves accurate detection of small foreign objects in complex track environments, reduces missed detection and false detection rates, meets real-time detection requirements, and improves detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635409A_ABST
    Figure CN120635409A_ABST
Patent Text Reader

Abstract

The invention discloses an improved YOLO11s-based rail foreign matter detection method. The method comprises the following steps of S1, acquiring a rail image through image acquisition equipment; s2, carrying out image preprocessing on the acquired track foreign matter image; s3, making a track foreign matter data set; s4, expanding the track foreign matter data set, and performing data enhancement on the image; and S5, establishing a foreign matter detection model and training. The method can be suitable for identification and detection of various types of foreign matters in rail transit, the identification rate of small target foreign matters is well improved, and the detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of target detection technology, and in particular to a track foreign object detection method based on improved YOLO11s. Background Art

[0002] Traditionally, rail safety inspections rely on manual patrols. Workers walk along the tracks, visually inspecting for loose, missing, or corroded fasteners, as well as any foreign objects intruding into the track sections. This method is labor-intensive and time-consuming, resulting in low inspection efficiency. It is also subject to subjective factors, making it prone to missed inspections. Furthermore, manual inspections are limited in frequency, making it difficult to monitor track conditions in real time. Any unexpected foreign object intrusion or worsening fastener defects between inspections could pose significant risks to railway operations.

[0003] Traditional image processing methods struggle to cope with the complex and ever-changing trackscapes, and their high computational complexity makes them difficult to meet real-time requirements. Deep learning methods, with their powerful feature learning and pattern recognition capabilities, offer new opportunities for solving the problem of track area status detection. However, the complex and ever-changing environment along the tracks, including varying weather and lighting conditions, impacts detection accuracy. Summary of the Invention

[0004] The present invention aims to solve the technical problems existing in the prior art. In particular, it innovatively proposes a track foreign object detection method based on improved YOLO11s, which can be applied to the identification and detection of various types of foreign objects in rail transit, while greatly improving the recognition rate of small target foreign objects and improving detection efficiency.

[0005] In order to achieve the above objectives, the present invention provides a track foreign object detection method based on improved YOLO11s, comprising the following steps:

[0006] S1: Collect track images through image acquisition equipment;

[0007] S2: performing image preprocessing on the collected track foreign body images;

[0008] S3: Create a track foreign object dataset;

[0009] S4: Expand the orbital foreign object dataset by performing data augmentation on the images;

[0010] S5: Establish and train a foreign body detection model.

[0011] In the above scheme: step S2 includes the following steps:

[0012] S2-1: grayscale the image to eliminate color interference;

[0013] S2-2: Use the Sobel operator to calculate the horizontal and vertical gradients respectively;

[0014] S2-3: Calculate the gradient amplitude and variance of the image: The gradient amplitude calculation formula is

[0015]

[0016] Where G(x,y) is the gradient amplitude in the X-axis direction and the Y-axis direction, G x (x,y) represents the horizontal gradient, G y (x,y) represents the vertical gradient, I(x,y) represents the grayscale value of the input; * represents the convolution operation;

[0017] S2-4: Set a minimum variance threshold M. If the image gradient variance is less than M, the image is judged to be a low-quality image and is discarded.

[0018] S2-5: traverse all input image paths and execute S2-1 to S2-4 in a loop until all collected orbital foreign body images are processed;

[0019] Step S3 includes the following steps:

[0020] S3-1: Use labelimg image annotation tool to manually annotate the screened track foreign body images;

[0021] S3-2: After labeling is completed, the labeling information is saved and a dataset is generated.

[0022] In the above scheme: step S4 includes the following steps:

[0023] S4-1: Flip the track area image horizontally or vertically according to a certain probability;

[0024] S4-2: Rotate the track area image counterclockwise or clockwise at any angle with a certain probability;

[0025] S4-3: performing affine transformation on the track area image;

[0026] S4-4: Randomly add Gaussian noise to the image, simulating camera sensor noise with salt and pepper noise characteristics;

[0027] S4-5: Adds uneven lighting shadow noise to the image.

[0028] In the above scheme, step S5 includes the following steps:

[0029] S5-1: Input the track area image and adaptively adjust the size of the input track area image to the set size. Perform feature extraction through two Conv standard convolution modules, and output feature maps P1 and P2 respectively. The convolution operation formula of the Conv standard convolution module is:

[0030] X conv =Conv 3×3 (X in )

[0031] X BN =BN(X conv )

[0032] X out =SiLu(X BN )

[0033] Where, X in is the input image, X out is the output feature map, X conv is the feature map after convolution, X BN is the feature map after normalization, BN(·) is the normalization process, and SiLu(·) is the activation function;

[0034] S5-2: Shallow feature extraction: First, the input feature map P2 is enhanced by the C3K2 module, and then downsampled by the ADown module to generate the feature map P3;

[0035] S5-3: Mid-level feature extraction: First, the feature map P3 is further extracted through the C3K2 module to further extract its semantic information, and then downsampled through the Adown module to generate the feature map P4;

[0036] S5-4: Deep feature extraction: Continue the same operation on feature map P4 to perform deep feature abstraction and generate feature map P5;

[0037] S5-5: Through the spatial pyramid pooling module, the global receptive field of the feature map P5 is enhanced, multi-scale features are further extracted, and the output is sent to the cross-stage local spatial attention module;

[0038] S5-6: Enhance the spatial attention in feature map P5 through the cross-stage local spatial attention module to improve the model's attention to important parts of the image;

[0039] S5-7: Bidirectional feature fusion via progressive feature pyramid fusion;

[0040] S5-8: Object detection; The fused feature maps P3, P4, and P5 generated in the above steps are fed into the EMA attention mechanism for cross-space feature enhancement, and then enter the detection head to detect small, medium, and large objects respectively;

[0041] S5-9: Considering the quality and sample distribution of track foreign object images, the Focaler-IoU loss function is constructed for prediction.

[0042] In the above scheme, step S5-2 includes the following steps:

[0043] S5-2-1: Adaptive average pooling is used to preprocess the feature map P2 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure.

[0044] S5-2-2: The feature map P2 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhanced branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhanced branch uses a cascade operation of maximum pooling and 1×1 convolution to enhance the nonlinear expression ability of the features;

[0045] S5-2-3: Generate a fused feature map by splicing the multi-branch output through the channel, and generate a downsampled feature map containing rich context information; the calculation formula is:

[0046] F out =Concat(Conv 3×3 (X),MaxPool(X))

[0047] Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map;

[0048] S5-2-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity;

[0049] S5-2-5: Use 3×3 depth-wise separable convolution to extract local spatial features;

[0050] S5-2-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P3.

[0051] In the above scheme, step S5-3 includes the following steps:

[0052] S5-3-1: Adaptive average pooling is used to preprocess the feature map P3 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure.

[0053] S5-3-2: The feature map P3 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhanced branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhanced branch uses a cascade operation of maximum pooling and 1×1 convolution to enhance the nonlinear expression ability of the features;

[0054] S5-3-3: The multi-branch output is spliced ​​through the channel to form a fused feature map, generating a downsampled feature map containing rich context information; the calculation formula is:

[0055] F out =Concat(Conv 3×3 (X),MaxPool(X))

[0056] Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map;

[0057] S5-3-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity;

[0058] S5-3-5: Use 3×3 depth-wise separable convolution to extract local spatial features;

[0059] S5-3-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P3. S5-3-1: Preprocess the feature map P4 after the C3K2 module feature enhancement through adaptive average pooling, and reduce the sampling rate while maintaining the spatial structure.

[0060] In the above scheme, step S5-4 includes the following steps:

[0061] S5-4-1: Adaptive average pooling is used to preprocess the feature map P4 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure.

[0062] S5-4-2: The feature map P4 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhancement branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhancement branch uses a cascade operation of maximum pooling and 1×1 convolution to enhance the nonlinear expression ability of the features;

[0063] S5-4-3: Generate a fused feature map by splicing the multi-branch output through the channel, and generate a downsampled feature map containing rich context information; the calculation formula is:

[0064] F out =Concat(Conv 3×3 (X),MaxPool(X))

[0065] Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map;

[0066] S5-4-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity;

[0067] S5-4-5: Use 3×3 depth-wise separable convolution to extract local spatial features;

[0068] S5-4-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P5.

[0069] In the above scheme, step S5-7 includes the following steps:

[0070] S5-7-1: The feature maps of each layer are processed from high to low through the upsampling module, and the lower resolution feature maps are restored to a higher resolution and fused with the features of the previous layer. Each time the features of the current layer are fused with the features of the previous layer, the features are reconstructed through the C3K2 module to further enhance the fused feature representation.

[0071] S5-7-2: The enhanced feature map P5 is processed by the upsampling module Unsample and then concatenated with the feature map P4 through the Concat module to form a new feature map. The new feature map is sequentially enhanced by C3K2 features and further upsampled, and then concatenated and enhanced with the feature map P3 to generate a new fused feature map P3.

[0072] S5-7-3: The feature maps of each level are processed from low to high through the downsampling module. The features at the low-resolution level are passed to the high-resolution level through the downsampling module to further combine the global and local information.

[0073] S5-7-4: The fused feature map P3 is downsampled by the Adown module, and then concatenated with the feature map P5 and the feature map P4 fused together in step S5-7-2, and enhanced by C3K2 to form a new fused feature map P4;

[0074] S5-7-5: The fused feature map P4 is downsampled by the Adown module and then concatenated with the enhanced feature map P5. After concatenation, it is enhanced by the C3K2 module to form the fused feature map P5.

[0075] In the above scheme, step S5-8 includes the following steps:

[0076] S5-8-1: Divide the feature map into K sub-features along the channel dimension through feature grouping;

[0077] Y=[Y0,Y1,L,Y K-1 ],Y i ∈R C / K×H×W ;

[0078] Where C is the feature map channel; H is the feature map height; W is the feature map width; Y is the set of sub-features, Y0 is the first sub-feature, Y K-1 is the K-th sub-feature;

[0079] S5-8-2: Long-range dependency branch; dual-path one-dimensional global average pooling is used to encode global information in the horizontal and vertical directions respectively. The formula is as follows:

[0080] F hor (Y i )=GAP hor (Y i ),F ver (Y i )=GAP ver (Y i )

[0081] Where, F hor (Y i ) is the global information encoded in the horizontal direction, F ver (Y i ) is the global information encoded in the vertical direction, GAP hor Horizontal global average pooling, GAP ver Global average pooling in the vertical direction;

[0082] S5-8-3: Local dependency branch, extracting local cross-channel relationships through 3×3 depth-wise separable convolution:

[0083] F local =DWConv 3×3 (Y i )

[0084] Where, F local is the local information of the encoding; DWConv 3×3 (·) is a 3×3 depthwise separable convolution;

[0085] S5-8-4: Spatial context encoding; the dual-pooling output is first concatenated, and then a 1×1 convolution and Sigmoid activation function are used to generate a spatial attention map:

[0086] A(X i )=Sigmoid(Conv 1×1 (Concat(F hor (Y i ),F ver (Y i ))))

[0087] Where A(X i) is the spatial attention map; Sigmoid is the activation function; Conv 1×1 is a 1×1 convolution; Concat is a concatenation operation; F hor (Y i ) is the global information encoded in the horizontal direction, F ver (Y i ) is the vertical encoding global information;

[0088] S5-8-5: Local-global interaction, local features F local With global attention A(X i ) to perform cross-space fusion to obtain the final output feature map:

[0089] A fused =Sigmoid(Softmax(F local )·A(X i )+Softmax(A(X i )·F local ))

[0090] Y out =Y·A fused

[0091] Where A fused is an attention map that integrates global and local information; Sigmoid is the activation function; Softmax(·) converts the function into a probability distribution; Y out is the final output feature map; Y is the input feature map; F local is the local information of the code.

[0092] In the above scheme, step S5-9 includes the following steps:

[0093] S5-9-1: Suppress the harmful gradient interference caused by low-quality samples and combine β with L WIoUv1 Combining to get L WIoUv3 The calculation formula is as follows:

[0094]

[0095] Where, L WIoUv1 Represents the loss function considering the distance attention term, R WIoU ∈[1,e) is the distance attention term; L IoU ∈[0,1] is the common IoU loss, which is used to control the increase or decrease of the loss value; x represents the horizontal coordinate of the center point of the prediction box, and y represents the vertical coordinate of the center point of the prediction box; gt Represents the horizontal coordinate of the center point of the real frame, y gt Represents the vertical coordinate of the center point of the real frame; W gRepresents the width of the minimum bounding rectangle of the predicted bounding box and the true bounding box, H g Represents the height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, (·) * Representatives will W g and H g Separate from the calculation problem. (When backpropagating to calculate the gradient, the default is to propagate the gradient along the calculation graph path to update the parameters. When a tensor is separated from the calculation graph, the gradient will no longer flow through the tensor, which can be used to avoid unnecessary gradient calculations and updates.) exp(·) represents the exponential function; β represents the abnormality of the anchor box, L * IoU Represents the loss function of the intersection-over-union ratio of the current anchor box separated by the computational graph; is the exponential sliding average of the IoU loss, r represents the non-monotonic focusing coefficient, and δ and α are both hyperparameters; L WIoUv3 It is the loss function considering the distance attention term after introducing the non-monotonic focusing coefficient;

[0096] S5-9-2: Construct the loss function as follows:

[0097]

[0098] Where IoU focaler is the reconstructed Focaler-IoU; IoU is the intersection-over-union ratio; d and u are the upper and lower limits of the threshold;

[0099] S5-9-3: Apply the Focaler-IoU loss function to the existing WIoUv3-based boundary regression loss function and define L Focaler-WIoU as follows:

[0100] L Focaler-WIoU =L WIoUv3 +IoU-IoU focaler

[0101] Where, L Focaler-WIoU is the boundary regression loss function, L WIoUv3 It is the loss function considering the distance attention term after introducing the non-monotonic focusing coefficient, IoU focaler is the reconstructed Focaler-IoU; IoU is the intersection-over-union ratio.

[0102] In summary, the beneficial effects of the present invention are as follows: in the backbone and Neck structure of the network, an ADown dynamic downsampling module is designed, which reduces the amount of computation while retaining detailed features through multi-branch feature fusion and lightweight convolution; secondly, an EMA reconstruction detection head is introduced in the Head structure of the network to enhance the positioning accuracy of small targets through cross-space learning; finally, the Focaler-WIoU loss function is innovatively integrated to dynamically allocate sample weights to alleviate data imbalance and poor sample quality problems. Finally, experiments have shown that mAP0.5 is improved by 2.11% compared with the baseline model, and the number of parameters is reduced by 19.8%. At the same time, compared with the other series of YOLO models, a balance between accuracy and speed is achieved, and the missed detection and false detection rates are effectively reduced. Starting from multiple aspects such as network structure optimization, feature extraction method improvement, and model training strategy adjustment, a deep learning detection model that is more adaptable to the complex environment of the track is constructed. It can not only achieve accurate detection of small target foreign objects, but also take into account detection accuracy and speed, meet the requirements of real-time detection, and thus provide more reliable technical guarantees for track safety operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0103] Figure 1 It is a network structure diagram of the model of the present invention;

[0104] Figure 2 This is the structure diagram of the Conv module;

[0105] Figure 3 This is the Adown module structure diagram;

[0106] Figure 4 This is the parallel subnet module structure diagram of EMA;

[0107] Figure 5 This is the overall structure diagram of the EMA module;

[0108] Figure 6 It is the calculation flow chart of the improved loss function;

[0109] Figure 7 In the figure a, the average accuracy comparison of the original model YOLO11 and the improved model of this technical solution for detecting different categories of targets is shown under the mAP_0.5 parameter and when the IoU threshold is 0.5. Figure 7 Figure b is a comparison of the comprehensive detection performance of the original model YOLO11 and the improved model of this technical solution at different IoU thresholds under the mAP_0.5-0.95 parameter. Figure 7 Figure c is a comparison of the difference between the bounding box predicted by the original model YOLO11 and the actual bounding box of the improved model of this technical solution during training. Figure 7Figure d is a comparison of the difference between the model predicted bounding box and the true bounding box on the validation set between the original model YOLO11 and the improved model of this technical solution;

[0110] Figure 8 It detects heat Figure 1 ;

[0111] Figure 9 It detects heat Figure 2 ;

[0112] Figure 10 It detects heat Figure 3 ;

[0113] Figure 11 is a schematic diagram of the test results;

[0114] Figure 12 It is a diagram of the marked page. DETAILED DESCRIPTION

[0115] The present invention will be further described below by way of examples and in conjunction with the accompanying drawings:

[0116] like Figures 1 to 12 As shown, a track foreign object detection method based on improved YOLO11s includes the following steps:

[0117] S1: Collect track images through image acquisition equipment;

[0118] S2: performing image preprocessing on the collected track foreign body images;

[0119] S2-1: grayscale the image to eliminate color interference;

[0120] S2-2: Use the Sobel operator to calculate the horizontal and vertical gradients respectively;

[0121] S2-3: Calculate the gradient amplitude and variance of the image: The gradient amplitude calculation formula is

[0122]

[0123] Where G(x,y) is the gradient amplitude in the X-axis direction and the Y-axis direction, G x (x,y) represents the horizontal gradient, G y (x,y) represents the vertical gradient, I(x,y) represents the grayscale value of the input; * represents the convolution operation;

[0124] S2-4: Set a minimum variance threshold M. If the image gradient variance is less than M, the image is judged to be a low-quality image and is discarded.

[0125] S2-5: traverse all input image paths and execute S2-1 to S2-4 in a loop until all collected orbital foreign body images are processed;

[0126] S3: Create a track foreign object dataset;

[0127] S3-1: Use the labelimg image annotation tool to manually annotate the screened track foreign body images; use the labelimg image annotation tool to draw a rectangular frame on the image to completely select the track foreign body area and mark the corresponding foreign body category. The annotation interface is as follows Figure 12 As shown;

[0128] S3-2: After the annotation is completed, save the annotation information and generate a dataset; save the annotation content in a txt file with the same file name as the corresponding image. The txt file contains the numbers of common track foreign objects and the normalized pixel coordinates of the manually selected foreign object area in the image;

[0129] S4: Expand the track foreign body dataset by performing data augmentation on the images. Based on the labeled image dataset in step S3, use image augmentation to perform data augmentation on the images in the dataset while retaining the labeled information. This method expands the dataset and enhances the generalization ability of the model.

[0130] S4-1: Flip the track area image horizontally or vertically with a probability of 0.3;

[0131] S4-2: Rotate the track area image counterclockwise or clockwise at any angle with a certain probability;

[0132] S4-3: performing affine transformation on the track area image;

[0133] S4-4: Randomly add Gaussian noise to the image, simulating camera sensor noise with salt and pepper noise characteristics;

[0134] S4-5: Add uneven lighting shadow noise to the image;

[0135] S5: Establish a foreign object detection model and use the track foreign object dataset expanded in S4 to train the foreign object detection model to achieve automatic detection and identification of track foreign objects;

[0136] S5-1: Input the track area image and adaptively adjust the size of the input track area image to the set size of 3×640×640. Perform feature extraction through the 3×3 convolution operation of two Conv standard convolution modules, and output feature maps P1 and P2 respectively. The sizes of the two feature maps P1 and P2 are 16×320×320 and 32×160×160 respectively. The convolution operation formula of the Conv standard convolution module is:

[0137] X conv =Conv 3×3 (X in )

[0138] X BN =BN(X conv )

[0139] X out =SiLu(X BN )

[0140] Where, X in is the input image, X out is the output feature map, X conv is the feature map after convolution, X BN is the feature map after normalization, BN(·) is the normalization process, and SiLu(·) is the activation function;

[0141] S5-2: Shallow feature extraction: First, the input feature map P2 is enhanced through the C3K2 module, and then downsampled through the ADown module to generate the feature map P3; the size of the feature map P3 is 64×80×80. During the processing of the C3K2 module, the local features of the feature map P2 are enhanced through the residual Bottleneck structure, and then output to the ADown module;

[0142] S5-2-1: Adaptive average pooling is used to preprocess the feature map P2 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure.

[0143] S5-2-2: The feature map P2 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhanced branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhanced branch uses a cascade operation of maximum pooling and 1×1 convolution to enhance the nonlinear expression ability of the features;

[0144] S5-2-3: Generate a fused feature map by splicing the multi-branch output through the channel, and generate a downsampled feature map containing rich context information; the calculation formula is:

[0145] F out =Concat(Conv3×3 (X),MaxPool(X))

[0146] Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map;

[0147] S5-2-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity;

[0148] S5-2-5: Use 3×3 depth-wise separable convolution to extract local spatial features;

[0149] S5-2-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P3.

[0150] Since the Conv standard convolution module is the main module responsible for feature extraction in the Backbone and Neck structures, its structure is as follows Figure 3 As shown, it uses the kernel size of standard convolution, i.e. 3×3, and only focuses on local areas, making it difficult to directly model long-distance dependencies. In addition, the number of parameters and computational complexity of standard convolution grows with the square of the number of channels.

[0151] To this end, the present invention introduces the Adown module, which effectively retains the target detail information while reducing the resolution of the feature map by introducing a combined structure of multi-scale pooling and lightweight convolution. Its core design includes three key links: first, the input feature map is preprocessed by adaptive average pooling to reduce the sampling rate while maintaining the spatial structure; second, the feature map is divided into a main branch and an enhanced branch along the channel dimension. The main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhanced branch strengthens the nonlinear expression ability of the feature through the cascade operation of maximum pooling and 1×1 convolution; finally, multi-branch feature fusion is achieved through channel splicing to generate a downsampled feature map containing rich contextual information. The innovative design of this module significantly improves the performance of small target detection. Its structure is as follows: Figure 3 shown.

[0152] The ADown module offers significant advantages over traditional convolutional downsampling. It combines the advantages of average pooling and max pooling to more comprehensively extract multi-scale feature information of track objects. By segmenting the input feature map and applying pooling, the ADown module reduces the size of the feature map directly involved in the convolution calculation, significantly reducing the overall computational load. This improvement not only enhances the model's feature representation capabilities but also improves the detection accuracy of track objects, effectively meeting the practical needs of complex environments.

[0153] The comparison of standard downsampling and Adown downsampling parameters is shown in Table 1 below.

[0154] Table 1. Comparison of complexity between standard Conv downsampling and Adown

[0155]

[0156] S5-3: Mid-layer feature extraction: First, the feature map P3 is further extracted through the C3K2 module to further extract its semantic information, and then downsampled through the Adown module to generate the feature map P4. The size of the feature map P4 is 128×40×40.

[0157] S5-3-1: Adaptive average pooling is used to preprocess the feature map P3 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure.

[0158] S5-3-2: The feature map P3 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhanced branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhanced branch uses a cascade operation of maximum pooling and 1×1 convolution to enhance the nonlinear expression ability of the features;

[0159] S5-3-3: The multi-branch output is spliced ​​through the channel to form a fused feature map, generating a downsampled feature map containing rich context information; the calculation formula is:

[0160] F out =Concat(Conv 3×3 (X),MaxPool(X))

[0161] Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map;

[0162] S5-3-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity;

[0163] S5-3-5: Use 3×3 depth-wise separable convolution to extract local spatial features;

[0164] S5-3-6: Perform residual connection on the processed feature map and the input feature map to form feature map P3. S5-3-1: Perform adaptive average pooling preprocessing on feature map P4 after feature enhancement by C3K2 module, and reduce the sampling rate while maintaining the spatial structure.

[0165] S5-4: Deep feature extraction: Continue the same operation on feature map P4 to perform deep feature abstraction and generate feature map P5 with a size of 256×20×20;

[0166] S5-4-1: Adaptive average pooling is used to preprocess the feature map P4 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure.

[0167] S5-4-2: The feature map P4 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhanced branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhanced branch uses a cascade operation of maximum pooling and 1×1 convolution to enhance the nonlinear expression ability of the features;

[0168] S5-4-3: Generate a fused feature map by splicing the multi-branch output through the channel, and generate a downsampled feature map containing rich context information; the calculation formula is:

[0169] F out =Concat(Conv 3×3 (X),MaxPool(X))

[0170] Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map;

[0171] S5-4-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity;

[0172] S5-4-5: Use 3×3 depth-wise separable convolution to extract local spatial features;

[0173] S5-4-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P5.

[0174] S5-5: The spatial pyramid pooling module SPPF is used to enhance the global receptive field of the feature map P5, further extract multi-scale features, and output them to the cross-stage local spatial attention module;

[0175] S5-6: Enhance the spatial attention in the feature map P5 through the cross-stage local spatial attention module C2PSA, improving the model's attention to important parts of the image;

[0176] S5-7: Bidirectional feature fusion via progressive feature pyramid fusion;

[0177] S5-7-1: The feature maps of each layer are processed from high to low through the upsampling module, and the lower resolution feature maps are restored to a higher resolution and fused with the features of the previous layer. Each time the features of the current layer are fused with the features of the previous layer, the features are reconstructed through the C3K2 module to further enhance the fused feature representation.

[0178] S5-7-2: The enhanced feature map P5 is processed by the upsampling module Unsample and then concatenated with the feature map P4 through the Concat module to form a new feature map. The new feature map is sequentially enhanced by C3K2 features and further upsampled, and then concatenated and enhanced with the feature map P3 to generate a new fused feature map P3.

[0179] S5-7-3: The feature maps of each level are processed from low to high in sequence through the downsampling module; the features at the low-resolution level are passed to the high-resolution level through the downsampling module to achieve further integration of global and local information; this bottom-up path allows the network to have deep semantic information even at higher resolution levels.

[0180] S5-7-4: The fused feature map P3 is downsampled by the Adown module, and then concatenated with the feature map P5 and the feature map P4 fused together in step S5-7-2, and enhanced by C3K2 to form a new fused feature map P4;

[0181] S5-7-5: The fused feature map P4 is downsampled by the Adown module and then concatenated with the enhanced feature map P5. After concatenation, it is enhanced by the C3K2 module to form the fused feature map P5.

[0182] S5-8: Target detection; The fused feature maps P3, P4, and P5 generated in the above steps are sent to the EMA attention mechanism for cross-space feature enhancement, and then enter the detection head to detect small targets, medium targets, and large targets respectively.

[0183] S5-8-1: Divide the feature map into K sub-features along the channel dimension through feature grouping;

[0184] Y=[Y0,Y1,L,Y K-1 ],Y i ∈R C / K×H×W ;

[0185] Where C is the feature map channel; H is the feature map height; W is the feature map width; Y is the set of sub-features, Y0 is the first sub-feature, Y K-1 is the K-th sub-feature;

[0186] Through this feature grouping, different sub-features can focus on learning different semantic information.

[0187] S5-8-2: Long-range dependency branch; dual-path one-dimensional global average pooling is used to encode global information in the horizontal and vertical directions respectively. The formula is as follows:

[0188] F hor (Yi )=GAP hor (Y i ),F ver (Y i )=GAP ver (Y i )

[0189] Where, F hor (Y i ) is the global information encoded in the horizontal direction, F ver (Y i ) is the global information encoded in the vertical direction, GAP hor Horizontal global average pooling, GAP ver Global average pooling in the vertical direction;

[0190] S5-8-3: Local dependency branch, extracting local cross-channel relationships through 3×3 depth-wise separable convolution:

[0191] F local =DWConv 3×3 (Y i )

[0192] Where, F local is the local information of the encoding; DWConv 3×3 (·) is a 3×3 depthwise separable convolution;

[0193] S5-8-4: Spatial context encoding; perform matrix multiplication on the dual-way pooling output to generate a spatial attention map:

[0194] A(X i )=Sigmoid(Conv 1×1 (Concat(F hor (Y i ),F ver (Y i ))))

[0195] Where A(X i ) is the spatial attention map; Sigmoid is the activation function; Conv 1×1 is a 1×1 convolution; Concat is a concatenation operation; F hor (Y i ) is the global information encoded in the horizontal direction, F ver (Y i ) is the vertical encoding global information;

[0196] S5-8-5: Local-global interaction, local features F local With global attention A global Weighted fusion:

[0197] A fused =Sigmoid(Softmax(F local )·A(X i )+Softmax(A(X i )·F local ))

[0198] Y out =Y·A fused

[0199] Where A fused is an attention map that integrates global and local information; Sigmoid is the activation function; Softmax(·) converts the function into a probability distribution; Y out is the final output feature map; Y is the input feature map; F local is the local information of the code.

[0200] The EMA module innovatively combines multi-scale convolution and cross-space learning techniques. Without performing channel dimensionality reduction, it effectively captures both long-range and short-range dependencies in feature maps, improving the model's ability to perceive objects of varying scales. EMA primarily consists of three components: feature grouping, parallel subnetworks, and cross-space learning.

[0201] First, feature grouping is to divide the input feature map into K sub-features along the channel dimension, Y = [Y0, Y1, L, Y K-1 ], where Y i ∈R C / K×H×W Through this feature grouping, different sub-features can focus on learning different semantic information.

[0202] Secondly, the parallel subnet is mainly used to solve the computational efficiency and multi-scale information capture problems faced by deep convolutional neural networks in feature extraction. EMA uses parallel subnets to distribute computational tasks to different branches. Specifically, a triple parallel branch structure is used to extract the attention weights of the grouped feature maps, where two parallel branches are placed in the 1×1 branch and the third branch is placed in the 3×3 branch. The structure of the parallel subnet is as follows: Figure 4 shown.

[0203] Finally, the cross-space learning structure first extracts long-range contextual dependencies through 1×1 convolution and global average pooling, while using 3×3 convolution to retain local structural features; then the two features are reshaped and matrix dot multiplication is performed to generate a spatial attention map. Through weighted fusion and Sigmoid normalization, the network adaptively enhances the response of key areas, which not only alleviates the problem of multi-scale feature coupling, but also takes into account global semantic association and local detail retention, significantly improving the model's ability to understand complex image content.

[0204] S5-9: Considering the quality and sample distribution of track foreign object images, the Focaler-IoU loss function is constructed for prediction;

[0205] S5-9-1: Suppress the harmful gradient interference caused by low-quality samples and combine β with L WIoUv1 Combining to get L WIoUv3 The calculation formula is as follows.

[0206]

[0207] Where L WIoUv1 Represents the loss function considering the distance attention term, R WIoU ∈[1,e) is the distance attention term; L IoU ∈[0,1] is the common IoU loss, which is used to control the increase or decrease of the loss value; x represents the horizontal coordinate of the center point of the prediction box, and y represents the vertical coordinate of the center point of the prediction box; gt Represents the horizontal coordinate of the center point of the real frame, y gt Represents the vertical coordinate of the center point of the real frame; W g Represents the width of the minimum bounding rectangle of the predicted bounding box and the true bounding box, H g Represents the height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, (·) * Representatives will W g and H g Separate from the calculation problem. (When backpropagating to calculate the gradient, the default is to propagate the gradient along the calculation graph path to update the parameters. When a tensor is separated from the calculation graph, the gradient will no longer flow through the tensor, which can be used to avoid unnecessary gradient calculations and updates.) exp(·) represents the exponential function; β represents the abnormality of the anchor box, L * IoU Represents the loss function of the intersection-over-union ratio of the current anchor box separated by the computational graph; is the exponential sliding average of the IoU loss, r represents the non-monotonic focusing coefficient, and δ and α are both hyperparameters; L WIoUv3 It is a loss function that takes into account the distance attention term after introducing a non-monotonic focusing coefficient. In the middle and late stages of training, harmful gradient interference is suppressed by dynamically assigning lower gradient gains to low-quality anchor boxes.

[0208] S5-9-2: Construct the loss function as follows:

[0209]

[0210] Where IoU focaler is the reconstructed Focaler-IoU; IoU is the intersection-union ratio; d and u are the upper and lower limits of the threshold; By adjusting these two thresholds, IoU focalerFocus on different regression samples; improve the impact of the distribution of difficult and easy samples on regression, dynamically adjust the focus of IoU loss through linear interval mapping, and solve the problem of difficult and easy sample distribution.

[0211] S5-9-3: Apply the Focaler-IoU loss function to the existing WIoUv3-based boundary regression loss function and define L Focaler-WIoU as follows:

[0212] L Focaler-WIoU =L WIoUv3 +IoU-IoU focaler

[0213] Where, L Focaler-WIoU is the boundary regression loss function, L WIoUv3 It is the loss function considering the distance attention term after introducing the non-monotonic focusing coefficient, IoU focaler is the reconstructed Focaler-IoU; IoU is the intersection-over-union ratio.

[0214] The model training is carried out under the pytorch framework, the system is ubuntu20.04, and the YOLO basic model version is YOLO11s.

[0215] This paper adopts WIoUv3 to construct a dynamic non-monotonic focusing mechanism: the outlier degree is used to evaluate the quality of the anchor frame, and the gradient gain adaptive strategy is combined to enhance the gradient response of high-quality samples and suppress the interference of low-quality samples, effectively improving the robustness of target positioning in complex scenarios.

[0216] S5-10: Model training;

[0217] The experiment used a self-developed track foreign object dataset for training and validation, and conducted six ablation experiments covering six common types of foreign objects in rail transit. The experimental evaluation metrics used included eight YOLI metrics: mAP0.5, mAP0.5:95, Precision, Recall, Params, GFLOPs, number of parameters, model size, and FPS.

[0218] The performance results of the six ablation experiments on the test set are shown in the following table:

[0219] Table 2 Comparison of ablation experiment model accuracy

[0220]

[0221] Table 3. Comparison of ablation experiment model parameters

[0222]

[0223]

[0224] The improved YOLO11s outperformed the original model in detecting foreign objects on the track dataset. At the category level, except for the tape-measure category, where mAP0.5 and mAP0.5-0.95 decreased slightly (0.896 to 0.892 and 0.586 to 0.585 respectively), the other five categories all saw varying degrees of improvement: the precision of the wrench category increased significantly from 0.877 to 0.901, a 2.74% increase; the mAP0.5 of pliers saw the largest increase, from 0.896 to 0.926 (+3.35%); and the mAP0.5-0.95 of the screwdriver category saw a 5.87% increase. In terms of overall indicators, the improved model's Precision (0.948 vs 0.934), Recall (0.877 vs 0.862), mAP0.5 (0.919 vs 0.9) and mAP0.5-0.95 (0.666 vs 0.655) were all improved, verifying the effectiveness of the improved scheme in improving the model's detection accuracy, coverage and multi-scale adaptability.

[0225] like Figure 7 As shown in the figure, we can see that compared with the original model YOLO11, the loss of the improved model decreases significantly faster, and lower losses can be achieved in the early training. Further observation of mAP shows that the improved model has better performance.

[0226] The heat map comparison of the original model and the final improved model on some data sets is as follows Figure 8 、 9 , 10, wherein, Figure 8 、 9 ,The top of 10 is the input image, the middle is the image processed by the original model, and the bottom is the image processed by the final improved model.

[0227] Analysis shows that the original YOLO11s model has obvious problems of missed detection and false detection. Figure 8 Screwdriver on the left side of the sleeper, Figure 9 The screwdrivers on the right side of the sleeper were not detected, which exposed the model's problem of missed detection of targets; Figure 10The middle model mistakenly identifies the background area as a foreign object, resulting in a false detection phenomenon. In essence, the original model is severely disturbed by background noise, and the attention mechanism is distracted by irrelevant background, resulting in the failure of foreign object feature extraction and the inability to accurately capture the target location and category information. The improved model accurately identifies track foreign objects. The heat map shows that its high-attention area (red and yellow highlights) accurately covers the actual location of the foreign object, and the response to background noise is greatly reduced, which can focus on extracting the core features of the foreign object. This comparison fully demonstrates that the improved model has a stronger track foreign object feature extraction capability in complex environments, effectively improves the accuracy and detection accuracy of target recognition in complex backgrounds, and significantly enhances the application reliability of the model in actual scenarios. Finally, the PyTorch file after training is obtained.

[0228] S6: Model deployment:

[0229] S6-1: Install the appropriate CUDA and TensorRT software packages, Python environment, and PyTorch and other related dependent libraries on the Nvidia Jetson Xavier NX computing board.

[0230] S6-2: Use the torch.onnx.export() function to export the PyTorch model to ONNX format.

[0231] S6-3: Use the TensorRT Python API to load the ONNX model generated in the previous step, generate a TensorRTEngine model, and save the generated model to the specified directory of Jetson Xavier NX.

[0232] S6-4: Write inference code, load and run the TensorRT Engine model, and provide a calling interface. Obtain input data, pass it to the model for inference, and output the inference results.

[0233] S7: Hardware device connection and data processing:

[0234] S7-1: The hardware device deployment device of the present invention mainly includes an Nvidia Jetson Xavier NX computing board, a camera, and some display devices.

[0235] S7-2: Connect the camera to the computing board and obtain the camera's real-time image through the SDK. Then, call the model calling interface in step S7-4 to pass the image to the model for processing. The model obtains information such as the location frame and confidence level of the track foreign object in the image.

[0236] S8: Results display:

[0237] According to the output results, use OpenCV to mark the target and display it through a visual interface, such as Figure 12 shown.

Claims

1. A track foreign object detection method based on improved YOLO11s, characterized by: The following steps are involved: S1: Collect track images through image acquisition equipment; S2: performing image preprocessing on the collected track foreign body images; S3: Create a track foreign object dataset; S4: Expand the orbital foreign object dataset by performing data augmentation on the images; S5: Build and train a foreign body detection model.

2. The track foreign object detection method based on improved YOLO11s according to claim 1, characterized in that: Step S2 includes the following steps: S2-1: grayscale the image to eliminate color interference; S2-2: Use the Sobel operator to calculate the horizontal and vertical gradients respectively; S2-3: Calculate the gradient amplitude and variance of the image: The gradient amplitude calculation formula is Where G(x,y) is the gradient amplitude in the X-axis direction and the Y-axis direction, G x (x,y) represents the horizontal gradient, G y (x,y) represents the vertical gradient, I(x,y) is the input grayscale value; * represents the convolution operation; S2-4: Set a minimum variance threshold M. If the image gradient variance is less than M, the image is judged to be a low-quality image and is discarded. S2-5: traverse all input image paths and execute S2-1 to S2-4 in a loop until all collected orbital foreign body images are processed; Step S3 includes the following steps: S3-1: Use labelimg image annotation tool to manually annotate the screened track foreign body images; S3-2: After labeling is completed, the labeling information is saved and a dataset is generated.

3. The track foreign object detection method based on improved YOLO11s according to claim 1, characterized in that: Step S4 includes the following steps: S4-1: Flip the track area image horizontally or vertically according to a certain probability; S4-2: Rotate the track area image counterclockwise or clockwise at any angle with a certain probability; S4-3: performing affine transformation on the track area image; S4-4: Randomly add Gaussian noise to the image, simulating camera sensor noise with salt and pepper noise characteristics; S4-5: Adds uneven lighting shadow noise to the image.

4. The track foreign object detection method based on improved YOLO11s according to claim 1, characterized in that: Step S5 includes the following steps: S5-1: Input the track area image and adaptively adjust the size of the input track area image to the set size. Perform feature extraction through two Conv standard convolution modules, and output feature maps P1 and P2 respectively. The convolution operation formula of the Conv standard convolution module is: X conv =Conv 3×3 (X in ) X BN =BN(X conv ) X out =SiLu(X BN ) Where, X in is the input image, X out is the output feature map, X conv is the feature map after convolution, X BN is the feature map after normalization, BN(·) is the normalization process, and SiLu(·) is the activation function; S5-2: Shallow feature extraction: First, the input feature map P2 is enhanced by the C3K2 module, and then downsampled by the ADown module to generate the feature map P3; S5-3: Mid-level feature extraction: First, the feature map P3 is further extracted through the C3K2 module to further extract its semantic information, and then downsampled through the Adown module to generate the feature map P4; S5-4: Deep feature extraction: Continue the same operation on feature map P4 to perform deep feature abstraction and generate feature map P5; S5-5: Enhance the global receptive field of feature map P5 through the spatial pyramid pooling module and output it to the cross-stage local spatial attention module; S5-6: Enhance the spatial attention in feature map P5 through the cross-stage local spatial attention module to improve the model's attention to important parts of the image; S5-7: Bidirectional feature fusion via progressive feature pyramid fusion; S5-8: Object detection; The fused feature maps P3, P4, and P5 generated in the above steps are fed into the EMA attention mechanism for cross-space feature enhancement, and then enter the detection head to detect small, medium, and large objects respectively; S5-9: Considering the quality and sample distribution of track foreign object images, the Focaler-IoU loss function is constructed for prediction.

5. The track foreign object detection method based on improved YOLO11s according to claim 4, characterized in that: Step S5-2 includes the following steps: S5-2-1: Adaptive average pooling is used to preprocess the feature map P2 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure. S5-2-2: The feature map P2 is processed into a multi-branch structure along the channel dimension, which is divided into a main branch and an enhancement branch. The main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhancement branch uses a cascade operation of maximum pooling and 1×1 convolution. S5-2-3: Generate a fused feature map by splicing the multi-branch output through the channel, and generate a downsampled feature map containing rich context information; the calculation formula is: F out =Concat(Conv 3×3 (X),MaxPool(X)) Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map; S5-2-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity; S5-2-5: Use 3×3 depth-wise separable convolution to extract local spatial features; S5-2-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P3.

6. The track foreign object detection method based on improved YOLO11s according to claim 4, characterized in that: Step S5-3 includes the following steps: S5-3-1: Adaptive average pooling is used to preprocess the feature map P3 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure. S5-3-2: The feature map P3 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhancement branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhancement branch uses a cascade operation of maximum pooling and 1×1 convolution; S5-3-3: The multi-branch output is spliced ​​through the channel to form a fused feature map, generating a downsampled feature map containing rich context information; the calculation formula is: F out =Concat(Conv 3×3 (X),MaxPool(X)) Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map; S5-3-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity; S5-3-5: Use 3×3 depth-wise separable convolution to extract local spatial features; S5-3-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P3.

7. The track foreign object detection method based on improved YOLO11s according to claim 4, characterized in that: Step S5-4 includes the following steps: S5-4-1: Adaptive average pooling is used to preprocess the feature map P4 after feature enhancement by the C3K2 module, reducing the sampling rate while maintaining the spatial structure. S5-4-2: The feature map P4 is processed into a multi-branch structure along the channel dimension, divided into a main branch and an enhancement branch; the main branch uses 3×3 convolution for feature extraction and dimensionality reduction, and the enhancement branch uses a cascade operation of maximum pooling and 1×1 convolution; S5-4-3: Generate a fused feature map by splicing the multi-branch output through the channel, and generate a downsampled feature map containing rich context information; the calculation formula is: F out =Concat(Conv 3×3 (X),MaxPool(X)) Where X is the input feature map, Conv is the 3×3 convolution operation, MaxPool is the maximum pooling; F out is the output feature map; S5-4-4: Adjust the number of channels through 1×1 convolution to reduce computational complexity; S5-4-5: Use 3×3 depth-wise separable convolution to extract local spatial features; S5-4-6: Perform a residual connection between the processed feature map and the input feature map to form feature map P5.

8. The track foreign object detection method based on improved YOLO11s according to claim 4, characterized in that: Step S5-7 includes the following steps: S5-7-1: The feature maps of each layer are processed from high to low through the upsampling module, the lower resolution feature maps are restored to a higher resolution, and are fused with the features of the previous layer; each time the features of the current layer are fused with the features of the previous layer, the features are reconstructed through the C3K2 module; S5-7-2: The enhanced feature map P5 is processed by the upsampling module (Unsample) and then concatenated with the feature map P4 through the Concat module to form a new feature map. The new feature map is sequentially enhanced by C3K2 features and further upsampled, and then concatenated and enhanced with the feature map P3 to generate a new fused feature map P3. S5-7-3: Process the feature maps of each level from low to high through the downsampling module; pass the features at the low-resolution level to the high-resolution level through the downsampling module; S5-7-4: The fused feature map P3 is downsampled by the Adown module, and then concatenated with the feature map P5 and the feature map P4 fused together in step S5-7-2, and enhanced by C3K2 to form a new fused feature map P4; S5-7-5: The fused feature map P4 is downsampled by the Adown module and then concatenated with the enhanced feature map P5. After concatenation, it is enhanced by the C3K2 module to form the fused feature map P5.

9. The track foreign object detection method based on improved YOLO11s according to claim 4, characterized in that: Step S5-8 includes the following steps: S5-8-1: Divide the feature map into K sub-features along the channel dimension through feature grouping; Y=[Y0,Y1,L,Y K-1 ],Y i ∈R C / K×H×W ; Where C is the feature map channel; H is the feature map height; W is the feature map width; Y is the set of sub-features, Y0 is the first sub-feature, Y K-1 is the K-th sub-feature; S5-8-2: Long-range dependency branch; dual-path one-dimensional global average pooling is used to encode global information in the horizontal and vertical directions respectively. The formula is as follows: F hor (Y i )=GAP hor (Y i ),F ver (Y i )=GAP ver (Y i ) Where, F hor (Y i ) is the global information encoded in the horizontal direction, F ver (Y i ) is the vertical encoding global information, GAP hor Horizontal global average pooling, GAP ver Global average pooling in the vertical direction; S5-8-3: Local dependency branch, extracting local cross-channel relationships through 3×3 depth-wise separable convolution: F local =DWConv 3×3 (Y i ) Where, F local is the local information of the encoding; DWConv 3×3 (·) is a 3×3 depthwise separable convolution; S5-8-4: Spatial context encoding; the dual-pooling output is first concatenated, and then a 1×1 convolution and Sigmoid activation function are used to generate a spatial attention map: A(X i )=Sigmoid(Conv 1×1 (Concat(F hor (Y i ),F ver (Y i )))) Where A(X i ) is the spatial attention map; Sigmoid is the activation function; Conv 1×1 is a 1×1 convolution; Concat is a concatenation operation; F hor (Y i ) is the global information encoded in the horizontal direction, F ver (Y i ) is the vertical encoding global information; S5-8-5: Local-global interaction, local features F local With global attention A(X i ) to perform cross-space fusion to obtain the final output feature map: A fused =Sigmoid(Softmax(F local )·A(X i )+Softmax(A(X i )·F local )) AND out =Y·A fused Where A fused is an attention map that integrates global and local information; Sigmoid is the activation function; Softmax(·) converts the function into a probability distribution; Y out is the final output feature map; Y is the input feature map; F local is the local information of the code.

10. The track foreign object detection method based on improved YOLO11s according to claim 4, characterized in that: Step S5-9 includes the following steps: S5-9-1: Suppress the harmful gradient interference caused by low-quality samples and combine β with L WIoUv1 Combining to get L WIoUv3 The calculation formula is as follows: Where, L WIoUv1 Represents the loss function considering the distance attention term, R WIoU ∈[1,e) is the distance attention term; L IoU ∈[0,1] is the common IoU loss, which is used to control the increase or decrease of the loss value; x represents the horizontal coordinate of the center point of the prediction box, and y represents the vertical coordinate of the center point of the prediction box; gt Represents the horizontal coordinate of the center point of the real frame, y gt Represents the vertical coordinate of the center point of the real frame; W g Represents the width of the minimum bounding rectangle of the predicted bounding box and the true bounding box, H g Represents the height of the minimum bounding rectangle of the predicted bounding box and the true bounding box, (·) * Representatives will W g and H g Separated from the calculation problem, exp(·) represents the exponential function; β represents the abnormality of the anchor box, L * IoU Represents the loss function of the intersection-over-union ratio of the current anchor box separated by the computational graph; is the exponential sliding average of the IoU loss, r represents the non-monotonic focusing coefficient, and δ and α are both hyperparameters; L WIoUv3 It is the loss function considering the distance attention term after introducing the non-monotonic focusing coefficient; S5-9-2: Construct the loss function as follows: Where IoU focaler is the reconstructed Focaler-IoU; IoU is the intersection-over-union ratio; d and u are the upper and lower limits of the threshold; S5-9-3: Apply the Focaler-IoU loss function to the existing WIoUv3-based boundary regression loss function and define L Focaler-WIoU as follows: L Focaler-WIoU =L WIoUv3 +IoU-IoU focaler Where, L Focaler-WIoU is the boundary regression loss function, L WIoUv3 It is the loss function considering the distance attention term after introducing the non-monotonic focusing coefficient, IoU focaler is the reconstructed Focaler-IoU; IoU is the intersection-over-union ratio.