Train track obstacle detection method based on improved YOLOv8

By introducing the FasterBlock module and WIoU loss function into the YOLOv8 network, the railway track obstacle detection model is optimized, solving the problem of insufficient efficiency and accuracy of traditional detection methods, and achieving more efficient detection results.

CN118629002APending Publication Date: 2024-09-10DALIAN NATIONALITIES UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410415561.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-08
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

It is difficult for traditional manual inspections to detect obstacles on railway tracks 24 hours a day, and the application of deep learning technology in this field has not been fully optimized, resulting in insufficient detection efficiency and accuracy.

Method used

Based on the improved YOLOv8 network, the FasterBlock module in FasterNet was introduced to replace the original Bottleneck module, and the CIoU loss function was replaced with the WIoU loss function, a train track obstacle data set was constructed, and the model was optimized to improve detection performance.

Benefits of technology

It achieves more efficient track obstacle detection, reduces computational redundancy and memory access, improves the balance and generalization performance of the model, and meets the requirements of real-time and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118629002A
    Figure CN118629002A
Patent Text Reader

Abstract

A train track obstacle detection method based on improved YOLOv8 belongs to the technical field of artificial intelligence and intelligent traffic, and comprises the following steps: selecting a YOLOv8n network with minimum network depth, fastest detection speed, minimum parameter quantity and relatively high precision as a basic model structure, and on the basis of the existing network, selecting a YOLOv8n network with minimum network depth, fastest detection speed, minimum parameter quantity and relatively high precision as a basic model structure; a Faster Block module in a Faster Net network which is lighter in weight and higher in detection speed is introduced to replace a Bottleneck module in a C2f module in a backbone network of an original YOLOv8, spatial features can be extracted more effectively by reducing redundant calculation and memory access, the detection speed is further increased, and the detection precision is improved. A WIoU loss function is used for replacing a CIoU loss function in an original YOLOv8 network, the WIoU function adopts a dynamic adjustment gradient distribution strategy on the basis of IOU, the penalty gap between anchor frames of different sizes is reduced, the WIoU function has better performance when facing targets with different geometric features, and the generalization performance of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence and intelligent transportation technology, and specifically relates to a train track obstacle detection method based on improved YOLOv8. Background Art

[0002] Due to the needs of China's social and economic development, the country has vigorously developed railway transportation. Therefore, China's railway industry has achieved remarkable achievements and provided strong impetus for the development of China's economy. At this stage, my country's railways have developed rapidly in terms of operating speed and operating mileage. By the end of 2021, China's total railway operating mileage has exceeded 150,000 kilometers, and the total high-speed rail operating mileage has exceeded 40,000 kilometers. The "National Comprehensive Three-dimensional Transportation Network Planning Outline" predicts that the scale of railways in the physical line network of the national comprehensive three-dimensional transportation network will reach 200,000 kilometers in 2035. China's "Fuxing" train has reached a speed of 350 kilometers per hour. The huge railway network and high operating speed have provided important value for my country's economic and social development, but at the same time, it has also put forward higher requirements for the safety of the railway train operating environment.

[0003] Since my country's railway lines have a large east-west and north-south span, the railway mileage is long and needs to cross different terrains, the railway lines are often affected by natural disasters such as landslides. More importantly, some human factors also affect the safety of train driving. For example, the limit intrusion caused by random obstacles such as the front car, people, and objects will have a serious impact on railway safety. Train safety accidents will pose a great threat to people's lives and property and national economic interests, so it is urgent to solve the problem of foreign body intrusion on the track. The traditional means of preventing foreign body intrusion detection is mainly manual line regular inspection, but the detection method using manual inspection consumes a lot of manpower and has low real-time performance, making it difficult to achieve 24-hour all-weather detection.

[0004] In order to overcome the shortcomings of traditional detection methods, and with the continuous improvement of technology and equipment performance, deep learning technology has been widely used in the field of railway obstacle detection in recent years. Track obstacle detection based on deep learning can provide train drivers with accurate road condition information and timely warnings and reminders of obstacles, and has the advantages of good real-time performance, low cost, and high detection accuracy. Summary of the invention

[0005] In order to solve the above problems, the present invention proposes: a train track obstacle detection method based on improved YOLOv8, comprising the following steps:

[0006] S1. Establish the improved YOLOv8 network result as the detection model. In the existing YOLOv8 network, introduce the FasterBlock module in the FasterNet network to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network, and replace the CIoU loss function used in the original YOLOv8 network with the WIoU loss function.

[0007] S2. We construct a train track obstacle dataset by using public datasets in various target detection fields, taking obstacle images from real scene experiments, and collecting relevant obstacle images from the Internet. We randomly divide the dataset into training set, validation set, and test set in a ratio of 8:1:1.

[0008] S3, setting training parameters for the YOLOv8 network established in step S1, training the improved YOLOv8 model using the training set data in the data set constructed in step S2, and verifying the effectiveness of the trained network using the test set and validation set after training.

[0009] Furthermore, in step S1, the FasterBlock module in the FasterNet network is introduced to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network. Each FasterBlock block has a PConv layer, followed by two PWConv layers. PConv only applies conventional Conv to some input channels for spatial feature extraction, and does not do any processing on other channels. The FLOPs of PConv are only:

[0010]

[0011] Among them: h, w are the height and width of the feature, k is the size of the convolution kernel, C P To use part of the number of channels, the FLOPs of PConv is only 1 / 16 of that of regular convolution, and the memory access amount is:

[0012] h*w*2C P +k 2 *C P ≈h*w*2C p

[0013] The memory access amount is 1 / 4 of that of conventional convolution, and the redundancy of feature maps is used to further optimize the cost and reduce computational redundancy and memory access.

[0014] Furthermore, the algorithm flow of PConv is as follows: Assuming that the number of channels of the input feature map is C, a parameter n is set to represent the ratio of the feature map to be divided into partial convolution and unprocessed parts, and the input feature map is divided into two parts X1 and X2. The number of channels of X1 is C / n, and the number of channels of X2 is CC / n. Partial convolution is performed on X1, and X2 is not processed. The output result of X1 is concatenated with X2 in the channel dimension to obtain the output feature map and return it for subsequent operations.

[0015] Furthermore, in step S1, the WIoU loss function is used to replace and improve the original CIoU loss function of YOLOv8. In the target detection task, IOU is used to measure the overlap between the predicted bounding box and the true bounding box, which is defined as:

[0016]

[0017] where b and b gt Represents the center point of the predicted bounding box and the true bounding box. WIoU adopts a dynamic non-monotonic focusing mechanism based on IOU to narrow the penalty gap between anchor boxes of different sizes.

[0018] Furthermore, in step S2, the data set is a data set required for training the model using the PASCAL VOC2012 data set, a well-known public data set in the field of target detection, and obstacle images collected in field experiments and the Internet. The PASCAL VOC2012 data set is a challenging task for identifying visual targets in actual scenes. There are four major categories in total: Person, Animal, Vehicle, and Indoor, which are in line with the categories of obstacles that may appear on train tracks. The data set is divided into a training set, a validation set, and a test set by a random sampling method.

[0019] The beneficial effects of the present invention are as follows: the present invention is based on the train track obstacle detection method of improving YOLOv8. First, the FasterBlock module in the FasterNet network is introduced to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network. The module can extract spatial features more effectively by reducing redundant calculations and memory accesses at the same time, and also helps with subsequent rapid expansion and hardware deployment, reducing costs. Secondly, the original loss function is replaced with the WIoU loss function, so that the model can focus on the anchor box of the obstacle sample, thereby better ensuring the balance of the model performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is the original YOLOv8 model structure diagram;

[0021] Figure 2This is the FasterBlock structure diagram;

[0022] Figure 3 This is the structure diagram of the improved YOLOv8 model of the present invention. DETAILED DESCRIPTION

[0023] In order to make the technical means and objectives adopted by the present invention easy to understand, the present invention is further described below in combination with a specific implementation method. A train track obstacle detection method based on improved YOLOv8 includes the following steps:

[0024] S1. Establish the improved YOLOv8 network result as the detection model. In the existing YOLOv8 network, introduce the FasterBlock module in the FasterNet network to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network, and replace the CIoU loss function used in the original YOLOv8 network with the WIoU loss function.

[0025] S2. A train track obstacle dataset is constructed by using public datasets in various target detection fields, taking obstacle images from real scene experiments, and collecting relevant obstacle images from the Internet. The dataset is randomly divided into training set, validation set, and test set in a ratio of 8:1:1.

[0026] S3, setting training parameters for the YOLOv8 network established in step S1, training the improved YOLOv8 model using the training set data in the data set constructed in step S2, and verifying the effectiveness of the trained network using the test set and validation set after training.

[0027] In step S1, the FasterBlock module in the FasterNet network is introduced to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network. Each FasterBlock block has a PConv layer, followed by two PWConv layers. PConv only applies conventional Conv to some input channels for spatial feature extraction, and does not do any processing on other channels. Therefore, the FLOPs of PConv are only:

[0028]

[0029] Among them: h, w are the height and width of the feature, k is the size of the convolution kernel, C P To use part of the number of channels, the FLOPs of PConv is only 1 / 16 of that of regular convolution, and the memory access amount is:

[0030] h*w*2C P +k 2*C P ≈h*w*2C p

[0031] The memory access is 1 / 4 of that of regular convolution, so we can use the redundancy of feature maps to further optimize the cost and reduce computational redundancy and memory access.

[0032] The algorithm flow of PConv can be briefly described as follows: Assuming that the number of channels of the input feature map is C, we set a parameter n to represent the ratio of the feature map to be divided into partial convolution and unprocessed parts, and divide the input feature map into two parts X1 and X2. The number of channels of X1 is C / n, and the number of channels of X2 is CC / n. Partial convolution is performed on X1, and X2 is not processed. The output result of X1 is concatenated with X2 in the channel dimension to obtain the output feature map and return it for subsequent operations.

[0033] Among them, step S1 uses the WIoU loss function to replace and improve the original CIoU loss function of YOLOv8. In the target detection task, IOU is usually used to measure the overlap between the predicted bounding box and the true bounding box, which is defined as:

[0034]

[0035] Where b and bgt represent the center points of the predicted bounding box and the true bounding box. The original YOLOv8 uses CIoU to calculate the regression loss of the bounding box. CIoU introduces the concept of the center point distance between the predicted bounding box and the true bounding box. It adds a minimum center point penalty term based on the IoU loss function, and considers the difference between the aspect ratio of the predicted bounding box and the aspect ratio of the true bounding box. However, this method will greatly reduce the detection effect when dealing with those detection targets with blurred boundaries and irregularities, so WIoU is introduced. WIoU adopts a dynamic non-monotonic focusing mechanism based on IOU to narrow the penalty gap between anchor boxes of different sizes, so that the model can focus on the anchor box of the obstacle sample, thereby better ensuring the balance of model performance.

[0036] Among them, the data set of step S2 is the data set required for the training of this model, which is built using the well-known public data set PASCAL VOC 2012 data set in the field of target detection and obstacle images collected in field experiments and the Internet. The PASCAL VOC 2012 data set is a challenging task for identifying visual targets in actual scenes. There are four major categories in total: Person, Animal, Vehicle, and Indoor, which basically meet the categories of obstacles that may appear on train tracks. The data set is divided into a training set, a validation set, and a test set by a random sampling method, providing reliable data support for model training, validation, and evaluation of model performance, ensuring that the model can fully learn detection tasks in different situations and enhance generalization performance.

[0037] In order to meet the requirements of real-time and accuracy of train track obstacle detection, the FasterBlock module in the FasterNet network is first introduced to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network, which can reduce redundant calculations and memory accesses at the same time, thereby improving the detection speed. The loss function of the original model is then replaced with WIoU to better maintain the balance of the model.

[0038] The YOLOv8 network is mainly composed of the following parts:

[0039] The backbone network of YOLOv8 is based on the CSPDarkNet network structure, just like YOLOv5, but uses the c2f module instead of the C3 module of YOLOv5. The C2f module first splits the input tensor (n,c,h,w) through the Conv1 layer into two parts (n,0.5c,h,w), one part directly passes through n Bottlenecks, and the other part is shortcutted with a size of (n,0.5c,h,w) after each operation layer, and finally output through the Conv2 layer convolution. That is, it corresponds to the n+2 shortcut (the branch tensor of the first layer Conv1 and the tensor after splitting are 2+n Bottlenecks).

[0040] Compared with C3, the number of channels of each Bottleneck input Tensor in C2f is only 0.5 times that of the previous level, so the amount of calculation is significantly reduced. On the other hand, the increase in gradient flow can also significantly improve the convergence speed and convergence effect.

[0041] YOLOv8's Neck uses the PANet structure. After the final SPPF module (Layer9), H and W are downsampled by 32 times, and correspondingly, Layer4 is downsampled by 8 times, and Layer6 is downsampled by 16 times. The input image resolution is 640*640, and the resolutions of Layer4, Layer6, and Layer9 are 80*80, 40*40, and 20*20 respectively.

[0042] Layer4, Layer6, and Layer9 are used as the input of the PANet structure. After upsampling and channel fusion, the three output branches of PANet are finally sent to the Detect head for loss calculation or result resolution. Unlike FPN (unidirectional, top-down), PANet is a bidirectional path network that introduces a bottom-up path, making it easier for the bottom-level information to be transmitted to the top layer.

[0043] The head part of YOLOv8 has been greatly changed compared to YOLOv5. The coupling head is directly changed to a decoupled head structure similar to Yolox (Decoupled-Head), the regression branch and the prediction branch are separated, and the integral form representation proposed in the Distribution Focal Loss strategy is used for the regression branch. The previous target detection network predicted the regression coordinates as a deterministic single value, and DFL transforms the coordinates into a distribution. The original network structure of YOLOv8 is as follows Figure 1 shown.

[0044] The method includes the following detection steps:

[0045] Step 1: Construct a track obstacle dataset and divide the labeled data into two parts using a ratio of 8:1:1.

[0046] Step 2: Build an improved YOLOv8 network structure, introduce the FasterBlock module in the FasterNet network to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network, and extract features more efficiently by reducing redundant calculations and memory accesses. Although partial convolution can use a small number of parameters to establish partially connected convolutions, it reduces the problem of small receptive fields in local areas and increases computing performance through parallel computing, but bottlenecks may still occur for deeper and more complex neural networks, so PWConv is added after the partial convolution. The PWConv module only contains a 1*1 convolution kernel, which can change the number of feature channels without changing the size of the feature map, which can effectively reduce computational complexity. The FasterBlock structure is shown in the figure. Figure 2As shown. Then the loss function is changed to WIoU. WIoU adopts a dynamic non-monotonic focusing mechanism based on IOU to reduce the penalty gap between anchor boxes of different sizes, so that the model can focus on the anchor box of obstacle samples, thereby better ensuring the balance of model performance. The improved network structure is shown in Figure 3 shown.

[0047] Step 3: Perform model training on the training set, configure the project environment in the running environment, set the training to 800 rounds, the batch size to 32, the initial learning rate to 0.01, and the optimizer to use SGD for training. After the training is completed, the weight file and training log will be automatically saved.

[0048] Step 4: Use the validation set to verify and tune the trained model. Load the weight file obtained after training into the model. The model will detect the images in the validation set and generate target detection results.

[0049] Step 5: Load the model that has been trained and validated in the previous steps to ensure that the model is in optimal condition, and then apply the model to the images in the test set.

[0050] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A train track obstacle detection method based on improved YOLOv8, characterized in that: The steps include: S1. Establish the improved YOLOv8 network result as the detection model. In the existing YOLOv8 network, introduce the FasterBlock module in the FasterNet network to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network, and replace the CIoU loss function used in the original YOLOv8 network with the WIoU loss function. S2. We construct a train track obstacle dataset by using public datasets in various target detection fields, taking obstacle images from real scene experiments, and collecting relevant obstacle images from the Internet. We randomly divide the dataset into training set, validation set, and test set in a ratio of 8:1:

1. S3, setting training parameters for the YOLOv8 network established in step S1, training the improved YOLOv8 model using the training set data in the data set constructed in step S2, and verifying the effectiveness of the trained network using the test set and validation set after training.

2. The train track obstacle detection method based on improved YOLOv8 as claimed in claim 1, characterized in that: In step S1, the FasterBlock module in the FasterNet network is introduced to replace the Bottleneck module in the C2f module in the original YOLOv8 backbone network. Each FasterBlock block has a PConv layer, followed by two PWConv layers. PConv only applies conventional Conv to some input channels for spatial feature extraction, and does not do any processing on other channels. The FLOPs of PConv are only: FLOPs=h*w*k 2 *C P 2 Among them: h, w are the height and width of the feature, k is the size of the convolution kernel, C P To use part of the number of channels, the FLOPs of PConv is only 1 / 16 of that of regular convolution, and the memory access amount is: h*w*2C P +k 2 *C P ≈h*w*2C p The memory access amount is 1 / 4 of that of conventional convolution, and the redundancy of feature maps is used to further optimize the cost and reduce computational redundancy and memory access.

3. The train track obstacle detection method based on improved YOLOv8 as claimed in claim 2, characterized in that: The algorithm flow of PConv is as follows: Assuming that the number of channels of the input feature map is C, a parameter n is set to represent the ratio of the feature map to be divided into partial convolution and unprocessed parts. The input feature map is divided into two parts X1 and X2. The number of channels of X1 is C / n, and the number of channels of X2 is CC / n. Partial convolution is performed on X1, and X2 is not processed. The output result of X1 is concatenated with X2 in the channel dimension to obtain the output feature map and return it for subsequent operations.

4. The train track obstacle detection method based on improved YOLOv8 as claimed in claim 1, characterized in that: In step S1, the WIoU loss function is used to replace and improve the original CIoU loss function of YOLOv8. In the target detection task, IOU is used to measure the overlap between the predicted bounding box and the real bounding box, which is defined as: where b and b gt Represents the center point of the predicted bounding box and the true bounding box. WIoU adopts a dynamic non-monotonic focusing mechanism based on IOU to narrow the penalty gap between anchor boxes of different sizes.

5. The train track obstacle detection method based on improved YOLOv8 as claimed in claim 1, characterized in that: In step S2, the data set is a data set required for model training using the PASCAL VOC2012 data set, a well-known public data set in the field of target detection, and obstacle images collected in field experiments and the Internet. The PASCAL VOC2012 data set is a challenging task for identifying visual targets in actual scenes. There are four major categories in total: Person, Animal, Vehicle, and Indoor, which are in line with the categories of obstacles that may appear on train tracks. The data set is divided into a training set, a validation set, and a test set by a random sampling method.

Citation Information

Cited By

  • Lightweight tunnel crack segmentation identification method based on improved YOLOv8

    CN119515791A

  • Rail transit foreign matter intrusion detection method and device, electronic equipment and storage medium

    CN119964091A