A lightweight dual-channel railway foreign body intrusion detection method

By constructing a lightweight inner-scale feature interaction module and a cross-scale feature fusion module, the RT-DETR network is improved, which solves the problems of large calculation amount and high model complexity in the existing railway foreign object detection technology, and achieves efficient and accurate detection of foreign objects on the rails. identification and real-time detection.

CN118587426BActive Publication Date: 2024-10-18CHENGDU UNIVERSITY OF TECHNOLOGY +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411070801.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-10-18
Estimated Expiration
2044-08-06

AI Technical Summary

Technical Problem

Existing railway foreign object detection technology has the problems of large amount of calculation, high model complexity, insufficient real-time performance and generalization ability, especially in the improved model based on YOLOv7 and Faster R-CNN network.

Method used

A lightweight dual-channel railway foreign object intrusion detection method is adopted, by constructing a lightweight inner-scale feature interaction module LAIFI and a lightweight cross-scale feature fusion module LCCFM, replacing the original AIFI and CCFM modules, using ResNet18 as the backbone network, and introducing Inner -SIoU loss function, improve RT-DETR network to reduce calculation amount and improve detection accuracy.

Benefits of technology

It achieves accurate identification of foreign objects on the railway track, reduces the amount of calculation, improves detection efficiency and accuracy, and more accurately defines potential dangerous areas through an improved edge detection algorithm, ensuring real-time detection of railway safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587426B_ABST
    Figure CN118587426B_ABST
Patent Text Reader

Abstract

The present invention discloses a lightweight dual-channel railway foreign body intrusion detection method, which belongs to the field of image data processing technology, and includes the steps of: constructing a railway foreign body data set; constructing two networks LAIFI and LCCFM; constructing an improved RT-DETR network based on LAIFI and LCCFM; training a railway foreign body recognition model with the railway foreign body data set; using the railway foreign body recognition model to identify foreign bodies on the rail image to be identified; if there are foreign bodies, using an improved edge detection algorithm to obtain a dangerous area; judging whether the foreign body is located in the dangerous area. The improved RT-DETR network in the present invention can not only enhance the ability to capture features of different scales, but also ensure detection accuracy while significantly reducing the amount of calculation, and the improved edge detection algorithm can accurately identify the edge of the railway, thereby more accurately defining the potential dangerous area. Finally, it is accurately and quickly judged whether the foreign body is in the dangerous area of ​​the rail.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and in particular to a lightweight dual-channel railway foreign body intrusion detection method. Background Art

[0002] With the rapid development of railway transportation, the safety environment of railway lines is crucial to the smoothness and safety of railway transportation. Debris on the track may cause derailment, collision or even equipment failure, posing a serious threat to driving safety. Therefore, it is particularly important to identify foreign objects on the railway in a timely and accurate manner. Using advanced railway foreign object recognition technology, potential dangers can be detected early.

[0003] At present, the technology of railway foreign body detection is mainly divided into two categories: sensor-based detection technology and target recognition-based detection technology.

[0004] (1) Sensor-based foreign body detection method

[0005] Professor D. Sinha's team placed acceleration sensors on the railway tracks to monitor track vibrations in real time and analyze vibration data to identify obstacle types. This method has high-precision recognition of wood and rocks, and can accurately detect wood within a range of 500 meters and rocks within a range of one kilometer.

[0006] Professor W. Zhangyu's team proposed a multi-sensor system that combines camera and lidar data to improve the detection efficiency of objects on the rails. The system uses a multi-scale prediction network to perform detailed pixel-level segmentation of images, then uses lidar sensors to accurately capture small obstacles, and accurately calculates the distance to the train ahead by aggregating lidar point data combined with a clustering algorithm.

[0007] This type of prevention has significant defects such as complex and expensive installation of sensor equipment, difficult daily maintenance, high missed detection rate, and large detection range limitations.

[0008] (2) Foreign body detection method based on target detection

[0009] Meng Caixia and other researchers have innovated a railway foreign body intrusion detection method that optimizes YOLOv5s, and proposed an improved railway foreign body intrusion detection model SD-YOLO. The model uses the SSA hybrid attention mechanism and DW-DecoupledHead decoupled detection head, introduces the bounding box regression loss function SIoU, and uses transposed convolution as a sampling method. These methods make the model sampling more adaptable to the size and proportion of railway foreign bodies, improve the recognition ability of small targets, the convergence speed of the network and the detection accuracy. However, the YOLO technology relies on the non-maximum method, has low computational efficiency, and its real-time performance needs to be improved. Wang Wenshuo and other researchers proposed a new railway foreign body detection algorithm based on YOLOv7. They improved the feature fusion network of YOLOv7 into a weighted bidirectional feature pyramid network to enhance the communication between features at each level, thereby improving the detection accuracy of foreign bodies. At the same time, they used the SIoU loss function to replace the original CIoU loss function, optimized the bounding box regression, reduced the degree of freedom of the loss function, and thus improved the positioning accuracy of the border. Li Xueshun and other researchers used micro aerial vehicles to collect images along the track and added foreign object intrusion photos taken by the aircraft to the VOC2007 dataset. They improved the FasterR-CNN network and introduced the Inside-Outside Net structure to improve the detection accuracy of occluded objects and achieve higher foreign object detection accuracy.

[0010] However, although the new railway foreign object detection algorithm based on YOLOv7 has improved the accuracy and positioning precision of railway foreign object detection, it may face the challenges of increased model complexity and increased computing resource requirements. The improved Faster R-CNN network has enhanced the detection capability of occluded foreign objects, but the real-time and generalization capabilities of the model still need to be further verified.

[0011] RT-DETR: An improved model based on DETR. DETR (Detection Transformer) is an end-to-end object detection model proposed by Facebook AI Research (FAIR) in 2020. DETR adopts the Transformer architecture, which is different from traditional region-based object detection methods. It predicts objects in images through global context without using previous candidate boxes or region proposal networks. DETR uses the global capabilities of the Transformer to replace the mechanism of generating anchors in the Decoder with a learnable object query. It uses a newly designed objective function combined with a bipartite graph matching method so that the model only generates one prediction box for an object without the need for subsequent NMS processing. In 2023, the Baidu PaddlePaddle team provided the industry with a highly practical end-to-end real-time object detection model RT-DETR (Real-Time Detection Transformer), which reduces operations to achieve real-time performance without affecting accuracy.

[0012] From a structural point of view, RT-DETR is mainly divided into three parts: the backbone network, the neck network and the head network. The backbone network is used to extract features from the image and output feature maps of three different sizes. The neck network uses a layer of Transformer encoder, called Efficient Hybrid Encoder, which is called efficient hybrid encoder in Chinese. The efficient hybrid encoder consists of two parts: AIFI (Attention-based Intra-scale Feature Interaction) and CCFM (CNN-based Cross-scale Feature-fusion). The two-part decoder variant Hybrid Encoder decouples the simultaneous interaction between scales. The head network is the decoder of the auxiliary prediction head. The working principle of RT-DETR is as follows: First, the features of the last three stages {F3, F4, F5} of the backbone are used as the input of the encoder. The efficient hybrid encoder converts multi-scale features into image feature sequences through AIFI and CCFM. Use iou-aware query selection to select a fixed number of image features as the initial object query of the decoder. Finally, the decoder with an auxiliary prediction head iteratively refines the object query to generate boxes and confidence scores.

[0013] In the prior art, the fusion block structure in the CCFM module is shown in Figure 5 , which consists of 2 1×1 convolutional layers and N RepBlock blocks. Figure 5In this case, N=3. RepBlock is translated as a heavily parameterized convolutional layer. The features of the input CCFM are divided into two processing paths: Path 1 contains only a 1×1 convolutional layer, and the second path includes a 1×1 convolutional layer and N RepBlocks in turn. The outputs of Path 1 and Path 2 are element-wise added to form a feature map.

[0014] ShuttleNetv2: It was proposed in 2018 and is an improved network based on ShuffleNet V1, including basic units and downsampling units. The present invention uses the basic units in ShuttleNetv2 to replace the RepBlock in the fusion block in the CCFM module.

[0015] SWDA: Sliding Window Dilated Attention, also known as sliding window dilated attention, is a very simple idea, mainly inspired by dilated convolution, centered on the query, and uses dilated methods to sample keys and values, thereby expanding the window attention receptive field without increasing computational costs. The SWDA module also adopts a multi-head design, dividing the channels of the feature map into n different heads, and using different dilation rates on different heads to perform sliding window dilated attention, outputting multiple head features. Summary of the invention

[0016] The purpose of the present invention is to provide a lightweight dual-channel railway foreign object intrusion detection method that solves the above-mentioned problems, reduces the amount of calculation and improves the detection accuracy.

[0017] In order to achieve the above object, the technical solution adopted by the present invention is as follows: a lightweight dual-channel railway foreign body intrusion detection method, comprising the following steps;

[0018] S1, construct railway foreign body dataset;

[0019] Collect rail images containing different foreign objects in different scenes, pre-process each rail image and manually annotate the foreign objects, use the annotated rail images as samples, and all samples constitute the railway foreign object dataset;

[0020] S2, constructing a lightweight intrascale feature interaction module LAIFI, including steps S21~S22,

[0021] S21, construct an LMSDA network, including the first convolutional layer, the SWDA layer, the depth-separable convolutional layer, and the second convolutional layer;

[0022] Input features of LMSDA network , The features are obtained through the first convolutional layer , After the SWDA layer, multiple head features are obtained. After the multiple head features are concatenated through channels and the linear layer, the output features are ; and Multiply element by element to get features , and then output features through the depth-separable convolutional layer , and Add element by element to get features , and then the second convolutional layer obtains the feature , and Add element by element to get the output features of the LMSDA network ;

[0023] S22, constructing LAIFI based on the LMSDA network, including two LMSDA networks, which are marked as the first LMSDA network and the second LMSDA network respectively;

[0024] Input features of LAIFI , after the first normalization layer, feature segmentation layer, segmentation into the first input feature and the second input feature , As the input feature of the second LMSDA network, the output feature of the second LMSDA network is marked as , and Multiply element by element, then pass through 1×1 convolution layer and activation function layer to get features , and Add element by element to get , As the input feature of the first LMSDA network, the output feature of the first LMSDA network is marked as , and Multiply element by element, then pass through 1×1 convolution layer and activation function layer to get features , and Perform channel splicing to obtain features , The features are obtained through the depth-separable convolution layer, the second normalization, the activation function layer, and the Drout regularization layer. , and Add element by element, then pass through 1×1 convolution layer and Dropath regularization layer to get features , and Add element by element to get the output features of LAIFI ;

[0025] S3, construct a lightweight cross-scale feature fusion module LCCFM;

[0026] Select a CCFM module, the CCFM module includes a fusion block, replace the heavy parameter convolution layer in the fusion block with the basic unit in ShuttleNetv2, and use the replaced CCFM module as LCCFM;

[0027] S4, constructing an improved RT-DETR network, including steps S41-S42;

[0028] S41, selecting an RT-DETR network, including a backbone network, a high-efficiency hybrid encoder and a decoder, wherein the high-efficiency hybrid encoder includes an AIFI module and a CCFM module;

[0029] S42, using the ResNet18 network as the backbone network, and the feature maps F3, F4, and F5 of the last three stages of the ResNet18 network as the feature outputs of the backbone network; replacing the AIFI module with LAIFI, and replacing the CCFM module with LCCFM to obtain an improved RT-DETR network;

[0030] S5, train the improved RT-DETR network with the railway foreign object dataset to obtain the railway foreign object recognition model;

[0031] S6, obtaining the rail image to be identified, inputting the rail foreign object identification model, and outputting the foreign object identification result.

[0032] Preferably, if there is a foreign object in the recognition result of S6, the following steps are also included:

[0033] S7, improving the Canny edge detection algorithm to obtain an improved edge detection algorithm;

[0034] The Canny edge detection algorithm includes Gaussian filtering, calculation of gradient amplitude and direction, non-maximum suppression, double threshold processing and edge linking, and is used to input a grayscale image to be detected and output an edge image;

[0035] The improvement is to replace Gaussian filtering with median filtering, and in double threshold processing, the high threshold Th H and low threshold Th L According to the following formula:

[0036] ,

[0037] ,

[0038] In the formula, , Gradient histograms The gradient amplitude of the i-th pixel and the i+1-th pixel, the gradient histogram is the image obtained after the grayscale image to be detected is filtered by median, and the gradient amplitude and direction are calculated. Indicates the first point where the difference between adjacent gradient amplitudes is zero;

[0039] S8, processing the rail image to be identified into a grayscale image, and obtaining a corresponding edge image using an improved edge detection algorithm;

[0040] S9, preset a safe distance L between the foreign object and the track, and mark the pixel points within the edge image and within the distance L from the edge image as dangerous areas;

[0041] S10, determining whether the foreign object is located in the danger zone, if so, it is considered as a foreign object intrusion, otherwise, it is not considered as a foreign object intrusion.

[0042] Preferably, the foreign object recognition result is a foreign object category and a bounding box, and the foreign objects include people, fallen rocks, kites, cows and sheep.

[0043] As a preferred embodiment: In S5, the improved RT-DETR network is trained using the railway foreign object dataset, and the loss function is the Inner-SIoU loss.

[0044] Preferably, the basic unit includes a channel segmentation layer, and the channel segmentation layer is used to segment the input basic unit features into first segmentation features according to the channels. and the second segmentation feature , The features are obtained after 1×1 convolution layer, 3×3 depth-separable convolution layer, and 1×1 convolution layer. , and Concatenate by channel to get features , Then the channel shuffle operation is performed through the channel shuffle layer to output the features , as the output of the basic unit.

[0045] Preferably, in the LMSDA network, the first convolution layer and the second convolution layer are both 1×1 convolution layers, and the depthwise separable convolution layer is a 3×3 depthwise separable convolution layer.

[0046] The present invention uses ResNet18 as the backbone network to generate three feature maps of different scales;

[0047] The present invention designs an LMSDA network. For the LMSDA network, the SWDA layer can consider the global context information of the input data in the feature extraction process, and multiple head features are merged together through the connection operation, which increases the model's ability to capture different feature dimensions. The linear layer in the LMSDA network helps to adjust the dimension of the feature, preparing for subsequent fusion and processing. Finally, the output features of the LMSDA network can well realize the integration of features, providing a rich feature representation that integrates multi-scale and multi-dimensional information for downstream tasks.

[0048] The present invention constructs a lightweight intrascale feature interaction module LAIFI, in which the feature segmentation layer is used to segment the normalized features into two independent parts, and two LMSDA networks are used to extract the specific features to obtain multi-scale features, and then the final output is obtained through operations such as feature fusion, channel splicing, and regularization. Feature segmentation can reduce the amount of calculation of the original AIFI, the LMSDA network enables the attention mapping to be well distributed in space, the Dropt regularization layer can reduce the risk of overfitting, and the Dropat regularization layer can further optimize the model structure to prevent overfitting.

[0049] The present invention constructs an improved lightweight cross-scale feature fusion module LCCFM, which replaces the heavy parameter convolution layer of the fusion block in the original CCFM module with the basic unit in the ShuttleNetv2 network. Compared with the original CCFM module, it can reduce parameters and calculation amount, lower hardware requirements, and improve detection efficiency.

[0050] During training, the loss function of the present invention is Inner-SIoU loss, which is composed of Inner-IoU and SIoU. SIoU loss introduces a more complex bounding box regression method by incorporating angle considerations and scale sensitivity, which solves the limitations of previous loss functions. Considering the angle between the vectors of the expected regression, the angle penalty metric is redefined, which can make the prediction box drift quickly to the nearest axis, and then only one coordinate needs to be regressed, which effectively reduces the total number of degrees of freedom. The SIoU loss function contains four components: angle loss, distance loss, shape loss, and a fourth unspecified component.

[0051] Compared with the prior art, the advantages of the present invention are:

[0052] (1) The present invention designs an improved RT-DETR network to detect foreign objects on rails, which uses the self-created lightweight intra-scale feature interaction module LAIFI and the improved lightweight cross-scale feature fusion module LCCFM. The two work together to not only enhance the model's ability to capture features of different scales, but also significantly reduce the amount of calculation while ensuring detection accuracy, so that the trained railway foreign object recognition model can realize accurate recognition of foreign objects on rails.

[0053] (2) The present invention improves the Canny edge detection algorithm to obtain a new algorithm: an improved edge detection algorithm, which is used to perform edge detection on rail images, and can accurately identify the edge of the railway, thereby more accurately defining potential danger areas.

[0054] (3) The present invention proposes a new method for judging the intrusion of foreign objects on railways. The foreign objects are initially identified by the railway foreign object recognition model. If the foreign objects exist, the improved edge detection algorithm is used to define the dangerous area. Finally, the recognition results of the railway foreign object recognition model and the dangerous area of ​​the improved edge detection algorithm are combined to accurately judge whether the foreign objects are in the dangerous area of ​​the railway track. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a flow chart of the present invention;

[0056] Figure 2 This is a diagram of the improved RT-DETR network structure of the present invention;

[0057] Figure 3 This is the LMSDA network structure diagram;

[0058] Figure 4 This is the structural diagram of the lightweight intrascale feature interaction module LAIFI;

[0059] Figure 5 It is a schematic diagram of a fusion block in the prior art;

[0060] Figure 6 Schematic diagram of the fusion block after replacing the heavy parameter convolution layer in the fusion block with the basic unit;

[0061] Figure 7 This is a flowchart of model training and detection in Example 1. DETAILED DESCRIPTION

[0062] The present invention will be further described below in conjunction with the accompanying drawings.

[0063] Example 1: See Figures 1 to 7 ,A lightweight dual-channel railway foreign body intrusion detection method comprises the following steps;

[0064] S1, construct railway foreign body dataset;

[0065] Collect rail images containing different foreign objects in different scenes, pre-process each rail image and manually annotate the foreign objects, use the annotated rail images as samples, and all samples constitute the railway foreign object dataset;

[0066] S2, constructing a lightweight intrascale feature interaction module LAIFI, including steps S21~S22,

[0067] S21, construct an LMSDA network, including the first convolutional layer, the SWDA layer, the depth-separable convolutional layer, and the second convolutional layer;

[0068] Input features of LMSDA network , The features are obtained through the first convolutional layer , After the SWDA layer, multiple head features are obtained. After the multiple head features are concatenated through channels and the linear layer, the output features are ; and Multiply element by element to get features , and then output features through the depth-separable convolutional layer , and Add element by element to get features , and then the second convolutional layer obtains the feature , and Add element by element to get the output features of the LMSDA network ;

[0069] S22, constructing LAIFI based on the LMSDA network, including two LMSDA networks, which are marked as the first LMSDA network and the second LMSDA network respectively;

[0070] Input features of LAIFI , after the first normalization layer, feature segmentation layer, segmentation into the first input feature and the second input feature , As the input feature of the second LMSDA network, the output feature of the second LMSDA network is marked as , and Multiply element by element, then pass through 1×1 convolution layer and activation function layer to get features , and Add element by element to get , As the input feature of the first LMSDA network, the output feature of the first LMSDA network is marked as , and Multiply element by element, then pass through 1×1 convolution layer and activation function layer to get features , and Perform channel splicing to obtain features , The features are obtained through the depth-separable convolution layer, the second normalization, the activation function layer, and the Drout regularization layer. , and Add element by element, then pass through 1×1 convolution layer and Dropath regularization layer to get features , and Add element by element to get the output features of LAIFI ;

[0071] S3, construct a lightweight cross-scale feature fusion module LCCFM;

[0072] Select a CCFM module, the CCFM module includes a fusion block, replace the heavy parameter convolution layer in the fusion block with the basic unit in ShuttleNetv2, and use the replaced CCFM module as LCCFM;

[0073] S4, constructing an improved RT-DETR network, including steps S41-S42;

[0074] S41, selecting an RT-DETR network, including a backbone network, a high-efficiency hybrid encoder and a decoder, wherein the high-efficiency hybrid encoder includes an AIFI module and a CCFM module;

[0075] S42, using the ResNet18 network as the backbone network, and the feature maps F3, F4, and F5 of the last three stages of the ResNet18 network as the feature outputs of the backbone network; replacing the AIFI module with LAIFI, and replacing the CCFM module with LCCFM to obtain an improved RT-DETR network;

[0076] S5, train the improved RT-DETR network with the railway foreign object dataset to obtain the railway foreign object recognition model;

[0077] S6, obtaining the rail image to be identified, inputting the rail foreign object identification model, and outputting the foreign object identification result.

[0078] Example 2: See Figures 1 to 7 , based on Example 1, if there is a foreign object in the recognition result of S6, the following steps are also included;

[0079] S7, improving the Canny edge detection algorithm to obtain an improved edge detection algorithm;

[0080] The Canny edge detection algorithm includes Gaussian filtering, calculation of gradient amplitude and direction, non-maximum suppression, double threshold processing and edge linking, and is used to input a grayscale image to be detected and output an edge image;

[0081] The improvement is to replace Gaussian filtering with median filtering, and in double threshold processing, the high threshold Th H and low threshold Th L According to the following formula:

[0082] ,

[0083] ,

[0084] In the formula, , Gradient histograms The gradient amplitude of the i-th pixel and the i+1-th pixel, the gradient histogram is the image obtained after the grayscale image to be detected is filtered by median, and the gradient amplitude and direction are calculated. Indicates the first point where the difference between adjacent gradient amplitudes is zero;

[0085] S8, processing the rail image to be identified into a grayscale image, and obtaining a corresponding edge image using an improved edge detection algorithm;

[0086] S9, preset a safe distance L between the foreign object and the track, and mark the pixel points within the edge image and within the distance L from the edge image as dangerous areas;

[0087] S10, determining whether the foreign object is located in the danger zone, if so, it is considered as a foreign object intrusion, otherwise, it is not considered as a foreign object intrusion.

[0088] The foreign object recognition result is a foreign object category and a bounding box, and the foreign objects include people, fallen rocks, kites, cows and sheep.

[0089] In S5, the improved RT-DETR network is trained using the railway foreign object dataset, and the loss function is the Inner-SIoU loss.

[0090] The basic unit includes a channel segmentation layer, and the channel segmentation layer is used to segment the input basic unit features into first segmentation features according to the channels. and the second segmentation feature , The features are obtained after 1×1 convolution layer, 3×3 depth-separable convolution layer, and 1×1 convolution layer. , and Concatenate by channel to get features , Then the channel shuffle operation is performed through the channel shuffle layer to output the features , as the output of the basic unit.

[0091] In the LMSDA network, the first convolutional layer and the second convolutional layer are both 1×1 convolutional layers, and the depthwise separable convolutional layer is a 3×3 depthwise separable convolutional layer.

[0092] Example 3: See Figures 1 to 7 Based on Example 1, we used our own data set to conduct ablation experiments and obtained the following Table 1. We also selected several different detection models for comparative experiments and obtained the following Table 2:

[0093] Table 1. Comparison of ablation experiment results

[0094] Model Precision Recall <![CDATA[mAp 0.5 ]]> <![CDATA[mAp 0.5:0.9 ]]> GFLOPs RT-DETR Network 0.820 0.738 0.917 0.465 57.2 RT-DETR Network + Inner-SIoU 0.882 0.822 0.928 0.474 57.2 Improved RT-DETR network 0.893 0.834 0.967 0.491 38.3 Improved RT-DETR network + Inner-SIoU 0.912 0.877 0.971 0.521 27.8

[0095] Table 2. Comparison of detection performance of different detection models

[0096] Model Precision Recall <![CDATA[mAP 0.5 ]]> <![CDATA[mAP 0.5:0.9 ]]> YOLOV5 0.725 0.648 0.757 0.372 YOLOV6 0.744 0.739 0.764 0.354 YOLOV8 0.754 0.753 0.810 0.406 RT-DETR 0.820 0.738 0.917 0.465

[0097] In Table 1 and Table 2, Precision is accuracy, Recall is recall, mAp is 0.5 Represents the average precision when IoU is set to 0.5, mAP 0.5:0.9 It represents the average precision when IoU ranges from 0.5 to 0.95 with a step size of 0.05.

[0098] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A lightweight dual-channel railway foreign body intrusion detection method, characterized by: The steps include: S1, construct railway foreign body dataset; Collect rail images containing different foreign objects in different scenes, pre-process each rail image and manually annotate the foreign objects, use the annotated rail images as samples, and all samples constitute the railway foreign object dataset; S2, constructing a lightweight intrascale feature interaction module LAIFI, including steps S21~S22, S21, construct an LMSDA network, including the first convolutional layer, the SWDA layer, the depth-separable convolutional layer, and the second convolutional layer; Input features of LMSDA network , The features are obtained through the first convolutional layer , After the SWDA layer, multiple head features are obtained. After the multiple head features are concatenated through channels and the linear layer, the output features are ; and Multiply element by element to get features , and then output features through the depth-separable convolutional layer , and Add element by element to get features , and then the second convolutional layer obtains the feature , and Add element by element to get the output features of the LMSDA network ; S22, constructing LAIFI based on the LMSDA network, including two LMSDA networks, which are marked as the first LMSDA network and the second LMSDA network respectively; Input features of LAIFI , after the first normalization layer, feature segmentation layer, segmentation into the first input feature and the second input feature , As the input feature of the second LMSDA network, the output feature of the second LMSDA network is marked as , and Multiply element by element, then pass through 1×1 convolution layer and activation function layer to get features , and Add element by element to get , As the input feature of the first LMSDA network, the output feature of the first LMSDA network is marked as , and Multiply element by element, then pass through 1×1 convolution layer and activation function layer to get features , and Perform channel splicing to obtain features , The features are obtained through the depth-separable convolution layer, the second normalization, the activation function layer, and the Drout regularization layer. , and Add element by element, then pass through 1×1 convolution layer and Dropath regularization layer to get features , and Add element by element to get the output features of LAIFI ; S3, construct a lightweight cross-scale feature fusion module LCCFM; Select a CCFM module, the CCFM module includes a fusion block, replace the heavy parameter convolution layer in the fusion block with the basic unit in ShuttleNetv2, and use the replaced CCFM module as LCCFM; S4, constructing an improved RT-DETR network, including steps S41-S42; S41, selecting an RT-DETR network, including a backbone network, a high-efficiency hybrid encoder and a decoder, wherein the high-efficiency hybrid encoder includes an AIFI module and a CCFM module; S42, using the ResNet18 network as the backbone network, and the feature maps F3, F4, and F5 of the last three stages of the ResNet18 network as the feature outputs of the backbone network; replacing the AIFI module with LAIFI, and replacing the CCFM module with LCCFM to obtain an improved RT-DETR network; S5, train the improved RT-DETR network with the railway foreign object dataset, and the loss function is Inner-SIoU loss to obtain the railway foreign object recognition model; S6, obtaining a rail image to be identified, inputting a railway foreign object identification model, and outputting a foreign object identification result; The basic unit includes a channel segmentation layer, and the channel segmentation layer is used to segment the input basic unit features into first segmentation features according to the channels. and the second segmentation feature , The features are obtained after 1×1 convolution layer, 3×3 depth-separable convolution layer, and 1×1 convolution layer. , and Concatenate by channel to get features , Then the channel shuffle operation is performed through the channel shuffle layer to output the features , as the output of the basic unit.

2. A lightweight dual-channel railway foreign body intrusion detection method according to claim 1, characterized in that: If there is a foreign object in the recognition result of S6, the following steps are also included; S7, improving the Canny edge detection algorithm to obtain an improved edge detection algorithm; The Canny edge detection algorithm includes Gaussian filtering, calculation of gradient amplitude and direction, non-maximum suppression, double threshold processing and edge linking, and is used to input a grayscale image to be detected and output an edge image; The improvement is to replace Gaussian filtering with median filtering, and in double threshold processing, the high threshold Th H and low threshold Th L According to the following formula: , , In the formula, , Gradient histograms The gradient amplitude of the i-th pixel and the i+1-th pixel, the gradient histogram is the image obtained after the grayscale image to be detected is filtered by median, and the gradient amplitude and direction are calculated. Indicates the first point where the difference between adjacent gradient amplitudes is zero; S8, processing the rail image to be identified into a grayscale image, and obtaining a corresponding edge image using an improved edge detection algorithm; S9, preset a safe distance L between the foreign object and the track, and mark the pixel points within the edge image and within the distance L from the edge image as dangerous areas; S10, determining whether the foreign object is located in the danger zone, if so, it is considered as a foreign object intrusion, otherwise, it is not considered as a foreign object intrusion.

3. A lightweight dual-channel railway foreign body intrusion detection method according to claim 1, characterized in that: The foreign object recognition result is a foreign object category and a bounding box, and the foreign objects include people, fallen rocks, kites, cows and sheep.

4. A lightweight dual-channel railway foreign body intrusion detection method according to claim 1, characterized in that: In the LMSDA network, the first convolutional layer and the second convolutional layer are both 1×1 convolutional layers, and the depthwise separable convolutional layer is a 3×3 depthwise separable convolutional layer.

Citation Information

Patent Citations

  • Small target detection method and device for unmanned aerial vehicle based on improved DETR

    CN116958687A

  • Railway freight foreign matter detection and identification method and system based on improved CNST-YOLOv5

    CN118071707A