Track foreign matter intrusion detection method based on improved YOLOv8 model
By improving the YOLOv8 model and using the ADown downsampling module, Triplet Attention module and WIoU loss function, the problem of difficulty in feature extraction of remote small objects in the natural environment of the track and difficulty in balancing detection accuracy and speed has been achieved, achieving high accuracy and efficiency. Track foreign object intrusion detection.
Patent Information
- Application Number
- CN202411288727.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-21
AI Technical Summary
In the natural environment of the track, there are many types of small objects at the far end and it is difficult to extract long-distance target features, resulting in inaccurate mis-checking and classification results. The existing detection models are difficult to balance the detection accuracy and speed, and cannot meet the real-time detection of railway foreign object intrusion detection. the need for sex and accuracy.
The improved YOLOv8 model is adopted, by replacing the traditional convolution with the ADown downsampling module in the backbone network, introducing the Triplet Attention module, and using the WIoU loss function to optimize the training process to improve the model's feature extraction capability and bounding box prediction performance.
It greatly reduces the rate of false detection and missed detection of foreign object intrusion on the track, significantly improves the detection accuracy and speed, meets the requirements for precise positioning and classification of foreign object intrusion on the track, and improves detection efficiency.
Smart Images

Figure CN119339314A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of foreign object intrusion detection, and in particular to a track foreign object intrusion detection method based on an improved YOLOv8 model. Background Art
[0002] With the rapid development of railways, the terrain covered by railways is constantly increasing, forming a complex train operation environment. The continuous increase in train speed has made the braking distance longer and longer. The intrusion of foreign objects such as illegal entry of pedestrians and animals along the railway and motor vehicles crossing the crossing will pose a serious threat to the safe operation of trains. Therefore, an effective intrusion detection method is a prerequisite for ensuring the healthy and vigorous development of railways.
[0003] At present, there are two main methods for railway intrusion detection: contact detection and non-contact detection. Among them, the contact detection methods mainly include power grid detection method, fiber grating detection method, etc., and the non-contact detection methods mainly include radar detection method, infrared barrier method, ultrasonic detection method, video image detection method, etc. The contact detection method relies on physical contact in railway foreign object intrusion detection and is only effective when objects are in contact. It cannot provide effective detection for some non-contact intrusion situations, and is limited by the detection range and equipment dependence, which is prone to false alarms and missed alarms, increasing the system operation cost and complexity.
[0004] Compared with traditional machine learning, deep learning algorithms can better extract features, making it possible to detect foreign body intrusion on tracks in natural environments. At present, foreign body detection methods can be divided into single-stage and two-stage. Common two-stage algorithms include R-CNN, Faster R-CNN, Mask Scoring R-CNN, etc., but these models are relatively complex, the detection speed is not ideal, and real-time detection cannot be achieved. Compared with the two-stage algorithm, the single-stage algorithm has a faster detection speed, making it possible to detect foreign body intrusion in real time in natural environments, but the existing algorithm has the problem of difficulty in balancing detection accuracy and speed, and cannot meet the real-time and accuracy requirements of railway foreign body intrusion detection. Based on this, a scientific and objective foreign body intrusion detection method for track is established to quickly and accurately locate and classify foreign body intrusion on the track, which has important practical significance for the identification and safety maintenance of foreign body intrusion on the track. Summary of the invention
[0005] The present invention aims at the problems that there are many types of small objects at the far end in the natural environment of the track, it is difficult to extract the features of long-distance targets, it is easy to cause missed detection and false detection, and the classification results of the existing detection model are inaccurate. A method for detecting foreign object intrusion on the track based on the improved YOLOv8 model is proposed. The detection method can realize the image detection of foreign object intrusion on the track in the natural environment, can greatly reduce the false detection and missed detection rate of foreign object intrusion on the track, and effectively improve the detection accuracy and speed, which greatly meets the actual requirements of accurate positioning and classification of foreign object intrusion on the track.
[0006] The present invention provides a track foreign body intrusion detection method based on an improved YOLOv8 model, comprising the following steps: Step (1) collect images of foreign matter intrusion in the track under natural environment and create a data set; Step (2) optimizing and improving the YOLOv8 model to form an improved YOLO model; Step (3) training the improved YOLO model; Step (4) deploys the model to the mobile terminal to obtain the detection results.
[0007] The data set production refers to: using a camera or image acquisition instrument to take clear images containing track foreign body intrusion, at different angles, distances and lighting conditions, and selecting some data with similar characteristics to the research object from the public data set (coco), and merging them to obtain the original data set. In order to conform to the actual situation in the natural environment, first delete the images that are not fully focused due to handheld shooting and the images that may interfere with the recognition algorithm due to human factors. In order to improve the stability and accuracy of model training, when screening images of track foreign body intrusion, focus on selecting clear images containing track foreign body intrusion, at different angles, distances and lighting conditions. To ensure the speed of model training, the image resolution is compressed to 640×640 pixels.
[0008] The data set production also includes: using data enhancement technology to expand the data set. In addition to using classic data enhancement methods: horizontal and vertical flipping, random translation, random cropping and filling methods are used to block or crop parts of the image. This method can effectively verify the anti-interference ability of the model. In order to ensure the diversity and robustness of the data set, 1 to 2 or more data enhancement methods are randomly used for data expansion. Through data enhancement processing, the images are randomly divided into training set, validation set and test set in a ratio of 8:1:1 in combination with the original data. The training set and validation set are used for single-round model training and result evaluation, and the test set is used for the final recognition effect evaluation of the model.
[0009] The method of optimizing and improving the YOLOv8 model to form an improved YOLO model includes replacing the traditional convolution with an ADown downsampling module in the YOLOv8 backbone network.
[0010] In the railway track scene, a large number of small distant objects are generated due to factors such as lighting, occlusion, and background. In the process of feature extraction by the backbone network, the traditional convolution operation uses a larger step size for downsampling. When the target is small or the feature is subtle, it may cause the loss of distant target features. Therefore, in order to improve the network feature extraction capability without increasing the computational cost too much.
[0011] Unlike traditional dynamic convolution, which uses a larger step size for downsampling (which may cause the loss of distant target features when the target is small or the features are subtle), ADown reduces the spatial dimension of the feature map by adjusting the stride of the convolution layer. While reducing the spatial resolution of the feature map, it can retain more image information and has a certain learnability, that is, it can be adaptively adjusted according to different detection scenarios. In addition, ADown optimizes the number of parameters in the convolution layer, reduces the complexity of the model by reducing the number of parameters, and keeps the model lightweight while improving the accuracy of target detection.
[0012] ADown combines average pooling with maximum pooling. Average pooling helps to retain global information, while maximum pooling helps to capture important local features. The two pooling operations are combined to achieve feature extraction at different scales.
[0013] The ADown downsampling process performs an average pooling operation on the input feature map X, divides the input feature map into two sub-feature maps X1 and X2 along the channel dimension, performs a convolution operation on X1, performs a maximum pooling operation on X2, and then performs a convolution operation, and finally concatenates the two sub-feature maps to output the feature map X. The introduction of a multi-branch structure provides more feature combinations and information interactions, retains more context information, and prevents excessive loss of small features.
[0014] The optimizing and improving the YOLOv8 model to form an improved YOLO model also includes: introducing a Triplet Attention module after the SPPF layer of the backbone of YOLOv8.
[0015] Triplet Attention proposes the concept of cross-dimensional interaction, which solves the separation problem of channel attention and spatial attention by capturing the interaction between the spatial dimension and channel dimension of the input tensor; cross-dimensional interaction is introduced in triplet attention by using three branches to capture the dependencies between the (C, H), (C, W) and (H, W) dimensions of the input tensor respectively; Triplet Attention designs Z-pool to reduce the 0th dimension of the tensor to 2 dimensions by connecting the average pooling and maximum pooling features on this dimension. This enables the layer to retain the rich representation of the actual tensor while reducing its depth to make further calculations lightweight, as follows:
[0016] 0d is the 0th dimension where the maximum pooling operation and the average pooling operation occur, such as the Z-Pool of a shape tensor Produces a tensor of shape ; In the first branch, the TripletAttention module establishes the interaction between the channel dimension C and the spatial dimension height H, and the input feature tensor ) is rotated 90° counterclockwise along the H axis to become of , and then through the Z-pool becomes of Here, a Z-pool layer is defined to reduce the tensor dimension from 0 to 2 to obtain the average pooling and maximum pooling features through the tensor; in the second branch, a counterclockwise rotation of 90 degrees along the W axis is performed. Therefore, the tensor is reduced to Shape This shape is The simplified tensor of The network passes through a standard convolutional layer defined by kernel size k, through a batch normalization layer, and finally through a sigmoid activation layer ( ) generates a shape of The attention weights are then applied to the input The output is then rotated 90° clockwise along the W axis to retain the input Same shape; the last branch, input tensor The number of channels is reduced to two by z-pooling. This shape is The simplified tensor of The output is passed through a sigmoid activation layer ( ) generates a shape of The attention weights are then applied to the input Then use a simple average method to calculate the shape of each of the three branches The fine tensor of is aggregated, and the final triple attention feature tensor y is represented as: y1, y2, y3 represent the three attention branches mentioned above, represents the sigmoid activation function, , , The output results of the 7×7 standard convolutional layer and normalization layer in the three branches of triple attention are as follows:
[0017] Different from other attention mechanisms, Triplet Attention effectively integrates input features from different foreign body intrusion images through 1×1 convolution operations after splicing in the channel dimension, thereby capturing global and local features under different receptive fields and scales. This comprehensive feature extraction strategy significantly enhances the network's ability to understand image details and can effectively process complex texture and edge information.
[0018] The improved YOLO model formed by optimizing and improving the YOLOv8 model also includes: introducing WloU as a loss function based on the original YOLOv8 model to reduce the interference of low-quality annotation boxes on detection performance and further improve accuracy; the WloU loss function takes into account the centroid distance and overlapping area, and also introduces a dynamic non-monotonic focusing mechanism, and adopts a reasonable gradient gain allocation strategy to evaluate the quality of the anchor box.
[0019] Since the detection effect of target detection depends largely on the selection of loss function, a reasonable definition of loss function can greatly improve the detection performance. Therefore, the WIoU loss function is introduced in the calculation of loss function, and the gradient gain allocation strategy is adopted to enhance the model's aggregation of low-quality anchor frames and improve the overall performance of the model in foreign object detection on rails.
[0020] The WloU version used is WloUv3, which uses the outlier degree β to measure the quality of the anchor frame, and constructs a non-monotonic focusing coefficient r based on β; the smaller the β value, the higher the quality of the anchor frame, which reduces the weight of the high-quality anchor frame in the larger loss function, and the β anchor frame has poor quality, and a smaller gradient gain is assigned to it, reducing the harmful gradients generated by the low-quality anchor frame.
[0021] Since LloU is dynamic, the anchor box quality division standard is also dynamic, which enables WloUv3 to dynamically formulate the gradient gain allocation strategy that best suits the current state; for the high proportion of small targets, occlusion and overlap in the detection of foreign objects on the rails, which increases the difficulty of detection, WIoUv3 can make the model focus on these difficult-to-identify samples, thereby improving the detection performance of the model. The details are as follows:
[0022] Where r is the dynamic non-monotonic focusing coefficient; β is the outlier degree; is the distance metric; is the horizontal coordinate of the center point of the prediction box; is the horizontal coordinate of the center point of the real frame; is the ordinate of the center point of the prediction box; is the ordinate of the center point of the real frame; The width of the minimum enclosing rectangle; is the height of the minimum enclosing rectangle; is the IoU loss.
[0023] WIoUv3 adopts a reasonable gradient gain allocation strategy to dynamically optimize the weights of high and low quality anchor boxes in the loss, so that the model focuses on samples with average quality and improves the overall performance of the model. Compared with the original loss calculation in the YOLOv8 model, the WIoUv3 loss function can dynamically optimize the loss weights of foreign objects of different scales in the task of foreign object detection on rails, thereby improving the detection performance of the model.
[0024] The improved YOLO model obtained after the training improvement refers to: in order to ensure the model training speed, the image resolution is compressed to 640×640 pixels; the GPU model is GeForceRTX4090, the Python version is 3.8, the Cuda version is 11.3, and the deep learning framework is Pytorch1.12.0; the YOLOv8n model is used for experiments, and the selected model depth factor is 0.33, the width factor is 0.25, and the maximum number of channels is 1024; SGD is selected as the optimizer, and the learning rate is adjusted in combination with the cosine decay strategy; the initial learning rate is 0.01, the training iterations are 200 times in total, the batchsize is 128, and the momentum is set to 0.937; during the training process, all networks do not use pre-trained weights, and use HSV random transformation, translation and flip transformation, mosaic splicing transformation and other methods for data enhancement; the above training parameters are used to train and optimize the original YOLOv8 model and the improved YOLO model, and finally the training results are compared to draw conclusions.
[0025] The deployment of the model to the mobile terminal to obtain the detection results refers to: evaluating the robustness and generalization of the model on a variety of data sets, optimizing the network for lightweighting, deploying it on mobile devices, and evaluating the portability of the network. Use the terminal device to capture images, transmit data, perform real-time detection, and display and save the detection results. It can achieve accurate positioning and classification of track foreign body intrusion in the natural environment, display the classification results on the system interface, and store the results in the device.
[0026] Compared with the prior art, the above technical solution has the following beneficial effects: (1) To address the intrusion of foreign objects on tracks, the YOLOv8 model is improved, including using the ADown module to replace the traditional convolution of the backbone network to improve the detection capability of small objects at a distance; introducing the Triplet Attention module after the SPPF layer to effectively integrate the input features from different images, thereby capturing the global and local features under different receptive fields and scales, enhancing the network's ability to understand image details, and being able to effectively process complex textures and edge information; by introducing the WIoU loss function and combining it with the DFL strategy to calculate the regression loss, the training process is optimized and the bounding box prediction regression performance is improved.
[0027] (2) Track foreign body intrusion Mobile equipment can not only acquire images of track foreign body intrusion in natural environments, but also display and save the detection results in real time. In addition, for track images that are difficult to collect and survey, mechanical equipment can be added to perform long-distance, non-contact image acquisition and foreign body intrusion detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1An overall flow chart of a track foreign body intrusion detection method based on an improved YOLOv8 model provided in an embodiment of the present application; Figure 2 It is a track foreign body intrusion image dataset in a natural environment in an embodiment of the present application; Figure 3 It is the structural diagram of the Adown downsampling process in this application; Figure 4 It is a schematic diagram of the Triplet Attention mechanism module in this application; Figure 5 This is the test result diagram of this application. DETAILED DESCRIPTION
[0029] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention, wherein the implementation examples are only part of the embodiments of the present invention, not all. Based on the embodiments in the embodiments, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] See also Figure 1 A track foreign body intrusion detection method based on an improved YOLOv8 model provided in an embodiment of the present invention specifically includes the following steps: Step (1): Collect images of foreign matter intrusion into the track and create a data set.
[0031] First, we collected images of foreign objects intruding on the track in a natural environment. To meet the actual situation in the natural environment, we first deleted images that were not fully focused due to handheld shooting and images that may interfere with the recognition algorithm due to human factors. To improve the stability and accuracy of model training, we selected clear images of foreign objects intruding on the track at different angles, distances and lighting conditions when screening images of foreign objects intruding on the track.
[0032] Furthermore, all images are compressed to 640×640 pixels required for model training. Then, the dataset is enhanced using Python tools. In addition to using classic data enhancement methods: horizontal and vertical flipping, random translation, random cropping and padding are used to block or crop parts of the image.
[0033] Finally, the Labelimg annotation tool is used to manually annotate the track foreign body intrusion image, and the annotation box selects the minimum bounding rectangle that contains the entire foreign body to reduce the background influence. The corresponding txt format file containing the track foreign body intrusion category and center coordinates, width, and height information is obtained.
[0034] Step (2): Optimize and improve the YOLOv8 model to form an improved YOLO model.
[0035] In the YOLOv8 backbone network, the traditional convolution is replaced with the ADown downsampling module.
[0036] ADown reduces the spatial dimension of the feature map by adjusting the stride of the convolution layer. While reducing the spatial resolution of the feature map, it can retain more image information and has a certain learnability, that is, it can be adaptively adjusted according to different detection scenarios. In addition, ADown optimizes the number of parameters in the convolution layer, reduces the complexity of the model by reducing the number of parameters, and keeps the model lightweight while improving the accuracy of target detection.
[0037] like Figure 2 As shown in the figure, during the ADown downsampling process, the input feature map X is average pooled, and the input feature map is divided into two sub-feature maps X1 and X2 along the channel dimension. A convolution operation is performed on X1, a maximum pooling operation is performed on X2, and then a convolution operation is performed. The two sub-feature maps are concat spliced to output the feature map X. The introduction of a multi-branch structure provides more feature combinations and information interactions, retains more context information, and prevents excessive loss of small features.
[0038] Furthermore, the Triplet Attention module is introduced after the SPPF layer of the backbone of YOLOv8 to solve the problem of separating channel attention and spatial attention by capturing the interaction between the spatial dimension and channel dimension of the input tensor.
[0039] Triplet Attention proposes the concept of cross-dimensional interaction, which solves the separation problem of channel attention and spatial attention by capturing the interaction between the spatial dimension and channel dimension of the input tensor; cross-dimensional interaction is introduced in triplet attention by using three branches to capture the dependencies between the (C, H), (C, W) and (H, W) dimensions of the input tensor respectively; Triplet Attention designs Z-pool to reduce the 0th dimension of the tensor to 2 dimensions by connecting the average pooling and maximum pooling features on this dimension. This enables the layer to retain the rich representation of the actual tensor while reducing its depth to make further calculations lightweight; based on this, Triplet Attention defines triple attention as a three-branch module, which enables the layer to retain the rich representation of the actual tensor while reducing its depth to further achieve lightweight calculations.
[0040] Furthermore, based on the original YOLOv8 model, WloU is introduced as a loss function to reduce the interference of low-quality annotation boxes on detection performance and further improve the accuracy. The WloU loss function takes into account the centroid distance and overlapping area, and also introduces a dynamic non-monotonic focusing mechanism, using a reasonable gradient gain allocation strategy to evaluate the quality of the anchor box.
[0041] Since the detection effect of target detection depends largely on the selection of loss function, a reasonable definition of loss function can greatly improve the detection performance. Therefore, the WIoU loss function is introduced in the calculation of loss function, and the gradient gain allocation strategy is adopted to enhance the model's aggregation of low-quality anchor frames and improve the overall performance of the model in foreign object detection on rails.
[0042] The WloU version used is WloUv3, which uses the outlier degree β to measure the quality of the anchor frame, and constructs a non-monotonic focusing coefficient r based on β; the smaller the β value, the higher the quality of the anchor frame, which reduces the weight of the high-quality anchor frame in the larger loss function. The β anchor frame has poor quality and is assigned a smaller gradient gain, which reduces the harmful gradients generated by the low-quality anchor frame. Since LloU is dynamic, the anchor frame quality division standard is also dynamic, which enables WloUv3 to dynamically formulate a gradient gain allocation strategy that best suits the current state; for the high proportion of small targets, occlusions, and overlaps in rail foreign body intrusion detection, which increases the difficulty of detection, WIoUv3 can enable the model to focus on these difficult-to-identify samples, thereby improving the detection performance of the model. The details are as follows:
[0043] Where r is the dynamic non-monotonic focusing coefficient; β is the outlier degree; is the distance metric; is the horizontal coordinate of the center point of the prediction box; is the horizontal coordinate of the center point of the real frame; is the ordinate of the center point of the prediction box; is the ordinate of the center point of the real frame; The width of the minimum enclosing rectangle; is the height of the minimum enclosing rectangle; is the IoU loss.
[0044] Step (3): Train the improved YOLO model.
[0045] The model was trained in a system with Windows 11 operating system, NVIDIA RTX 4090 deep learning graphics card, PyCharm development environment, and PyTorch deep learning framework. The initial learning rate was set to 0.01, and the YOLOv8n model was used for the experiment. The selected model depth factor was 0.33, the width factor was 0.25, and the maximum number of channels was 1024; SGD was selected as the optimizer, and the learning rate was adjusted in combination with the cosine decay strategy; the initial learning rate was 0.01, the training iterations totaled 200 times, the batch size was 128, and the momentum was set to 0.937; during the training process, all networks did not use pre-trained weights, and HSV random transformation, translation and flip transformation, mosaic splicing transformation and other methods were used for data enhancement.
[0046] At the same time, in order to evaluate the performance of the algorithm, we selected precision, recall, mean average precision (mAP), detection speed (FPS) and computational load (GFLOPs) as the evaluation indicators of the model. Precision refers to the ratio of correctly predicted positive samples to all predicted positive samples, as shown below: .
[0047] Recall refers to the ratio of correctly predicted positive samples to all true positive samples, as shown below: .
[0048] The real-time performance of the model is measured by the number of frames per second (FPS). The faster the detection speed, the higher the real-time performance of the model. The calculation formula is as follows: , where is the image preprocessing time, is the model inference time, Post-processing time.
[0049] The key parameter for measuring the model is mAP, which is the average of AP (Average Precision), as shown below: The mAP measurement indicators are divided into two types: mAP50 and mAP50:95. mAP50 represents the average detection accuracy of all target categories when the IoU threshold is 0.5. mAP50:95 represents the average detection accuracy of all 10 IoU thresholds from 0.50 to 0.95 with a step size of 0.05.
[0050] Then, the above training parameters are used to train the YOLOv8 basic model and the improved YOLO model. The training results are compared in terms of evaluation indicators, and various indicators are considered comprehensively. According to the training effect and comparison results, the module structure and parameters are continuously improved to obtain the best model suitable for production.
[0051] Step (4) deploys the model to the mobile terminal to obtain the detection results.
[0052] To further improve the model performance, the model robustness and generalization are evaluated on a variety of data sets, the network is optimized for lightweighting, the model is deployed on embedded devices, and the portability of the network is evaluated.
[0053] Finally, the model is deployed to the mobile terminal. The terminal device is used to capture images, transmit data, perform real-time detection, and display and save the detection results. It can accurately locate and classify foreign objects intruding on the specified track in the natural environment, display the classification results on the system interface, and store the results in the device.
[0054] The present invention aims to solve the problems of many types of remote small objects in the natural environment of the track, difficulty in extracting features of long-distance targets, easy missed detection and false detection, inaccurate classification results of existing detection models, etc. A track foreign body intrusion detection method based on the improved YOLOv8 model is proposed, which is an improvement of the YOLOv8 algorithm.
[0055] The traditional convolution of the backbone network is replaced by the ADown module to improve the detection capability of remote small objects; the Triplet Attention module is introduced after the SPPF layer to effectively integrate the input features from different images, thereby capturing the global and local features under different receptive fields and scales, enhancing the network's ability to understand image details, and being able to effectively process complex textures and edge information; by introducing the WIoU loss function and combining the DFL strategy to calculate the regression loss, the training process is optimized and the bounding box prediction regression performance is improved. Compared with the basic model, the improved YOLO model is smaller in size, faster in operation, and more accurate. It meets the requirements of precise positioning, accurate classification, and real-time detection of foreign body intrusion in orbit to a great extent, and improves the efficiency of foreign body intrusion detection to a certain extent.
[0056] Track foreign body intrusion detection mobile devices can not only realize the acquisition of track foreign body intrusion images in natural environments, but also display and save the detection results in real time. In addition, for track images that are difficult to collect and survey, mechanical equipment can be added to perform long-distance, non-contact image acquisition and foreign body intrusion detection.
Claims
1. A method for detecting foreign object intrusion on a track based on an improved YOLOv8 model, characterized in that: The following steps are involved: Step (1) collect images of foreign matter intrusion in the track under natural environment and create a data set; Step (2) optimizing and improving the YOLOv8 model to form an improved YOLOv8 model; Step (3) training the improved YOLO model; Step (4) deploys the model to the mobile terminal to obtain the detection results.
2. According to claim 1, a method for detecting track foreign body intrusion based on an improved YOLOv8 model is characterized in that: Use a camera or image acquisition instrument to capture clear images of track foreign object intrusion at different angles, distances, and lighting conditions, and select some data with similar characteristics to the research object from the public dataset (coco) to fuse them to obtain the original dataset.
3. According to the improved YOLOv8 model of claim 1, the track foreign body intrusion detection method is characterized in that: After obtaining the orbital foreign object intrusion images in the natural environment, in order to ensure the diversity and robustness of the data set, one or more data enhancement methods are randomly used for data expansion; the orbital foreign object intrusion images are categorized and labeled using the Labelimg annotation tool, and the annotation box selects the minimum enclosing rectangle containing the entire orbital foreign object to reduce the background influence; the above data set is randomly divided into training set, validation set and test set in the ratio of 8:1:
1.
4. According to claim 1, a method for detecting foreign body intrusion on a track based on an improved YOLOv8 model, characterized in that: The improved YOLO model is formed by optimizing and improving the YOLOv8 model, including: replacing the traditional convolution with the ADown downsampling module in the YOLOv8 backbone network; ADown combines average pooling with maximum pooling, and reduces the spatial dimension of the feature map by adjusting the stride of the convolution layer; while reducing the spatial resolution of the feature map, more image information is retained; Adown optimizes the number of parameters in the convolution layer, and reduces the complexity of the model by reducing the parameters; the Adown downsampling process first inputs the feature map X for average pooling operation, divides the input feature map into two sub-feature maps X1 and X2 along the channel dimension, performs convolution operation on X1, performs maximum pooling operation on X2, and then performs convolution operation, and finally concats the two sub-feature maps to output the feature map X, which provides more feature combinations and information interactions by introducing a multi-branch structure, and retains more contextual information.
5. According to claim 4, a method for detecting track foreign body intrusion based on an improved YOLOv8 model is characterized in that: The optimization and improvement of the YOLOv8 model to form an improved YOLO model also includes: introducing the Triplet Attention module after the SPPF layer of the backbone of YOLOv8 to solve the separation problem of channel attention and spatial attention by capturing the interaction between the spatial dimension and channel dimension of the input tensor; introducing cross-dimensional interaction in triplet attention by using three branches to capture the dependencies between the (C, H), (C, W) and (H, W) dimensions of the input tensor respectively; TripletAttention designs Z-pool to reduce the 0th dimension of the tensor to 2 dimensions by connecting the average pooling and maximum pooling features on this dimension; based on this, Triplet Attention defines triple attention as a three-branch module, so that the layer can retain the rich representation of the actual tensor while reducing its depth, further achieving lightweight computation.
6. According to a method for detecting track foreign body intrusion based on an improved YOLOv8 model as claimed in claim 1, it is characterized in that: The optimization and improvement of the YOLOv8 model to form an improved YOLO model also includes: introducing WloU (Wise Intersection over Union) as a loss function based on the original YOLOv8 model to reduce the interference of low-quality annotation boxes on detection performance and further improve accuracy; the WloU loss function takes into account the centroid distance and overlapping area, and also introduces a dynamic non-monotonic focusing mechanism, and adopts a reasonable gradient gain allocation strategy to evaluate the quality of the anchor box. For the detection of small targets, occlusions and high overlaps in the foreign body intrusion detection of rails, the detection difficulty is increased. WIoU can make the model focus on these difficult-to-identify samples, thereby improving the detection performance of the model.
7. According to claim 1, a method for detecting track foreign body intrusion based on an improved YOLOv8 model, characterized in that: The YOLO model obtained after training and improvement includes: to ensure the training speed of the model, the image resolution is compressed to 640×640 pixels; the GPU model is GeForceRTX4090, the Python version is 3.8, the Cuda version is 11.3, and the deep learning framework is Pytorch 1.12.0; the YOLOv8n model is used for experiments, and the selected model depth factor is 0.33, the width factor is 0.25, and the maximum number of channels is 1024; SGD is selected as the optimizer, and the learning rate is adjusted in combination with the cosine decay strategy; the initial learning rate is 0.01, the training iterations are 200 times in total, the batchsize is 128, and the momentum is set to 0.937; during the training process, all networks do not use pre-trained weights, and HSV random transformation, translation and flip transformation, mosaic splicing transformation and other methods are used for data enhancement; the above training parameters are used to train and optimize the original YOLOv8 model and the improved YOLO model, and finally the training results are compared to draw conclusions.
8. According to claim 1, a method for detecting track foreign body intrusion based on an improved YOLOv8 model, characterized in that: Deploying the model to a mobile terminal to obtain detection results includes: evaluating the robustness and generalization of the network model trained in claim 7 on a variety of data sets, and optimizing the network in the direction of lightweight; deploying it on a mobile device and obtaining target positioning and classification results.
Citation Information
Cited By
Rail transit foreign matter intrusion detection method and device, electronic equipment and storage medium
CN119964091A
Railway scene adaptive foreign matter intrusion detection method based on improved YOLOv8
CN121582545A