General grey spot detection and grey spot area calculation method for steel rail surface
Through YOLOv8 image recognition technology and deep learning algorithms, the problem of low intelligence and high complexity of rail surface defect detection is solved, efficient and accurate gray spot detection and area calculation are achieved, and railway safety and operational efficiency are improved.
Patent Information
- Application Number
- CN202410650634.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-05-23
AI Technical Summary
The level of intelligence in rail surface defect detection is low, and there is a lack of specialized research on cold rails. Light and shadow interference, background interference, and three-dimensional to two-dimensional conversion lead to high detection complexity, affecting detection efficiency and accuracy.
YOLOv8 image recognition and image segmentation technology is used to construct a rail surface gray spot data set and a partition data set. The deep learning algorithm is used to train the model, and image enhancement technology and CAD graphics data are combined to achieve gray spot detection and area calculation.
It improves the intelligence of rail surface quality monitoring, improves detection efficiency and accuracy, reduces false detections and missed detections, provides a quantitative basis for the impact on railway safety, and is suitable for real-time monitoring systems.
Smart Images

Figure CN118608464A
Abstract
Description
Technical Field
[0001] The invention belongs to the field of rail surface detection and is a method for universal gray spot detection and gray spot area calculation on the rail surface. Background Art
[0002] Rails are the cornerstone of modern railway systems, and their quality and integrity are crucial to ensuring the safety and efficient operation of railway traffic. The manufacturing quality of rails not only directly affects the smoothness of train operation, but also determines the service life of the tracks. Therefore, implementing high standards for rail manufacturing and implementing strict quality control measures are the top priorities to ensure railway safety. In recent years, the Ministry of Railways has increasingly stringent requirements on the surface quality of rails, among which surface defects have become a key technical indicator for measuring the surface quality of rails.
[0003] Currently, the field of rail surface defect detection faces several significant challenges. The first is the low level of intelligence: many large steel rail and beam factories, such as Panzhihua Iron and Steel and Baotou Steel, still rely on manual visual inspection to monitor the surface quality of rails, which is not only inefficient but also has limited reference value for subsequent process improvements. Secondly, there is a lack of specialized research on cold rails: Although the defect detection technology for steel products such as steel plates is relatively mature, there is relatively little research on cold rails, resulting in the lagging development of rail defect detection technology. Finally, the particularity of the surface material of the rail brings additional processing difficulties: due to the high reflectivity of the rail, the grayscale variation of its surface is small, which puts higher requirements on the imaging quality and defect segmentation algorithm, and increases the complexity and challenge of detection.
[0004] Secondly, the difficulty of area measurement through photo recognition technology lies in: 1) Interference from light and shadow, which also poses a challenge to area measurement. Uneven lighting may cause the image to be too dark or too bright in some areas, and shadows may interfere with the system's correct recognition of the object boundary. 2) Background interference and object occlusion, the coverage or overlap of the background and objects also poses a challenge to area measurement. When the environment is complex or there is overlap between objects, it becomes difficult to distinguish between objects and backgrounds, as well as the boundaries between different objects. This requires the recognition system to have advanced pattern recognition capabilities to accurately distinguish and measure each object in a complex environment. 3) Conversion from three-dimensional to two-dimensional is an important challenge. In the real world, objects are three-dimensional, but they are converted into two-dimensional images after taking a photo. This conversion may lead to the loss of important information, especially when the object being measured is not completely flat. Therefore, accurately measuring the area of non-planar objects becomes more complicated.
[0005] With the development of technology, the use of artificial intelligence for rail defect detection has become increasingly important. Artificial intelligence, especially in image processing and pattern recognition, can significantly improve the accuracy and efficiency of detection. It can identify tiny defects that are difficult to detect with the naked eye, reduce human intervention, achieve real-time monitoring, and optimize maintenance strategies by analyzing accumulated data. Therefore, applying AI technology to rail defect detection can not only improve safety, but also improve the operational efficiency of the entire railway system. Summary of the invention
[0006] In order to overcome the defects of the above-mentioned prior art, the present invention proposes a universal gray spot detection and gray spot area calculation method for rail surface, which adopts advanced image recognition and image segmentation technologies such as YOLOv8, and is a digital analysis system specifically for gray spots on rail fractures. The system greatly improves the intelligence level of rail surface quality monitoring by automatically identifying gray spots, calculating their area and accurately locating them; it not only improves the detection efficiency, but also ensures higher accuracy, effectively meets the strict requirements of the Ministry of Railways on rail surface quality, and is of great significance to improving railway safety.
[0007] The present invention provides a method for detecting and calculating the area of gray spots on a rail surface, comprising the following steps:
[0008] Step 1: Construct the rail surface gray spot dataset and rail partition dataset.
[0009] a. Rail surface gray spot dataset
[0010] Under different environmental conditions and lighting conditions, multiple rail fractures are photographed from multiple angles to collect gray spot images. The collected gray spot images are annotated, including size, shape and exact location, to form a gray spot dataset on the rail surface.
[0011] b. Rail partition dataset
[0012] The collected gray spot images are used to mark rail partitions, including the upper, middle and lower areas of the rail, to form a rail partition dataset.
[0013] Step 2: Use the gray spot image dataset constructed in step 1 to train the YOLOv8 model, and use the YOLOv8 image segmentation algorithm to detect gray spots on the rail surface.
[0014] Step 3: Use the rail partition dataset constructed in step 1 to train the YOLOv8 model, build a rail three-partition model, and use the YOLOv8 image segmentation algorithm to segment the rail surface area.
[0015] Step 4: According to the rail surface gray spot detection results and rail surface area segmentation results, detect the new rail image and calculate the gray spot area according to the gray spot area ratio.
[0016] 1) Calculation of actual area of different rail types
[0017] Firstly, the area of different parts of the rail is accurately quantified as a basis for evaluating and calculating the actual proportion of gray spots on the rail.
[0018] 2) Calculation of rail bottom area
[0019] The rail three-partition model in step 3 is used to subdivide the rail image and determine the area ratio of the rail bottom in the entire image. The ratio is calculated by calculating the ratio of the number of pixels in the rail bottom area to the number of pixels in the entire image. The specific calculation formula is:
[0020]
[0021] Among them, P rail_bottom Indicates the ratio of the bottom area of the rail to the total area of the image, A rail_bottom Indicates the number of pixels in the bottom area of the rail, A total Represents the number of pixels in the entire image.
[0022] 3) Gray spot area calculation
[0023] The gray spots on the rails are identified by the detection model in step 2. The detected gray spot area ratio, i.e., the ratio of the number of pixels in the gray spot area to the number of pixels in the entire image, is calculated by the following formula:
[0024]
[0025] Among them, P spot Indicates the ratio of the bottom area of the rail to the total area of the image, A spot Indicates the number of pixels in the detected gray spot area.
[0026] Finally, the actual area of the gray spots is estimated based on the calculated gray spot ratio and rail bottom ratio: The actual area of the gray spots is calculated using the following formula:
[0027]
[0028] Among them, A spot_real Indicates the actual area of the gray spot to be calculated, A rail_bottom_real Indicates the actual area of the bottom of the rail.
[0029] The advantages of the present invention are:
[0030] 1. In terms of gray spot detection on the rail surface, the YOLOv8-n model used in this invention is combined with image enhancement technology to achieve highly accurate and robust detection performance. The model is optimized through deep learning algorithms and can accurately identify gray spot features in complex environmental variables (such as different lighting conditions and background noise). In addition, the fast processing capability makes this method suitable for real-time monitoring systems. This advanced detection technology not only improves recognition accuracy, but also significantly reduces the possibility of false detection and missed detection.
[0031] 2. The present invention achieves accurate area estimation in gray spot area calculation by combining high-precision CAD graphic data and algorithm processing. This calculation method not only improves the accuracy of gray spot size assessment, but also provides a quantitative basis for determining the severity of the impact of gray spots on railway safety. Accurate area measurement is crucial for subsequent maintenance work decisions, making railway maintenance work more targeted and efficient. This method effectively combines image processing technology with traditional engineering measurement, providing an innovative solution for railway maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 The present invention is a flow chart of the universal gray spot detection and gray spot area calculation method on the rail surface.
[0033] Figure 2 Schematic diagram of the subdivision area of standard rail cross section. DETAILED DESCRIPTION
[0034] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0035] The present invention provides a universal gray spot detection and gray spot area calculation method on the rail surface, such as Figure 1 As shown, the specific steps are as follows:
[0036] Step 1: Construct the rail surface gray spot dataset and rail partition dataset.
[0037] In the field of rail integrity monitoring, the core capabilities of supervised learning algorithms, especially deep learning technology, rely on high-quality annotated data sets. Therefore, the present invention constructs a targeted data set, which specifically collects and annotates samples of whiteboard defects on the surface of rails, as follows:
[0038] 1) Dataset Collection
[0039] Multiple rail fractures were photographed under different environmental conditions and lighting to ensure that the images obtained covered all possible gray spot types and rail conditions. When collecting images, high-resolution cameras were used to capture images from multiple angles and distances to ensure that the images were clear and representative.
[0040] Table 1 shows the source of the dataset, with a special focus on 501 images of gray spot defects on the rail surface under different lighting conditions, brightness contrasts, and multi-angle shooting. It can be seen that the method of the present invention carefully constructs an image dataset specifically for gray spot defects on the rail surface, recorded as Rail-501. Such a dataset captures the performance of gray spot defects under the influence of various environmental factors, including different production batches, different lighting conditions, different angles, and different heights, providing a comprehensive and variable training sample for the deep learning model to ensure that the model can efficiently and accurately identify and evaluate this specific type of track defect in the real world.
[0041] Table 1 Data source of Rail-501 dataset
[0042]
[0043]
[0044] 2) Dataset Annotation
[0045] In order to train an efficient and accurate gray spot detection model, first, the gray spot images collected in step 1) were annotated in detail using Labelme software. In these images, a total of 2380 gray spot instances were marked to form a gray spot dataset on the rail surface, recorded as Rail Gray Spot-2380. Each gray spot was accurately annotated, including its size, shape, and exact location, to ensure that the model can fully learn the key features of gray spots.
[0046] Then, in addition to the gray spot images, the 501 images of gray spot defects on the rail surface were used for rail partition annotation, focusing on the annotation of different areas of the rail, such as the upper, middle and lower parts of the rail, forming a rail partition dataset - Rail Partition-501. These images focus on different areas of the rail, such as the upper, middle and lower parts. This method ensures that the model can not only identify gray spots, but also identify their distribution in different areas of the rail. This partition annotation is very important for the subsequent gray spot location and analysis.
[0047] Step 2: Use the YOLOv8 image segmentation algorithm to detect gray spots on the rail surface.
[0048] In order to effectively prevent overfitting and improve the robustness and generalization ability of the YOLOv8 model in practical applications, advanced image enhancement techniques are introduced, including random rotation, scaling, flipping, and illumination adjustment, which can simulate environmental changes in various practical application scenarios. Among them, through random rotation, images can be processed at different angles, simulating changes in camera angles or different orientations of objects. Scaling allows images to be resized while maintaining their original proportions to adapt to display requirements of different resolutions. Flipping functions, including horizontal or vertical flipping, can generate mirror effects, which are very useful for creating symmetrical data sets. In addition, illumination adjustment is another key technology in image enhancement, which simulates different lighting conditions by changing the brightness and contrast of the image. This is particularly important for training machine learning models, which can help the model learn to maintain stable recognition capabilities under various lighting environments encountered in practical applications. The above image enhancement techniques are not limited to random rotation, scaling, flipping, and illumination adjustment, and techniques such as color saturation adjustment, sharpening, and noise injection can also be applied.
[0049] In the present invention, the YOLOv8 model is configured and optimized to meet the specific needs of gray spot detection, including
[0050] 1) Model selection
[0051] In the field of automatic recognition of core functions, especially the application of gray spot recognition technology, this paper adopts the advanced algorithm in the current segmentation field - YOLO (You Only Look Once) series model. This choice is based on the wide application and excellent performance of the YOLO series in the field of computer vision. The method focuses on in-depth algorithm design and model implementation based on the latest version of YOLOv8.
[0052] Since its launch, the YOLO series of models has been one of the most popular models in the field of computer vision. Its core innovation is to transform the target detection task into a regression problem, so as to achieve simultaneous prediction of all target bounding boxes and category probabilities. This architecture has been continuously evolving in the past eight years since it was first proposed, and a series of improved versions have been born. As the latest member of the series, YOLOv8 not only inherits the advantages of the previous generation models, but also introduces a number of new features and improvements to improve performance and flexibility. Specifically, the model design of YOLOv8 includes a new backbone network, an innovative anchor-free detection head, and an efficient loss function. In addition, the model is compatible with the features of previous versions, which makes it easy for users to switch versions and compare performance in different scenarios.
[0053] YOLOv8 includes five models of different sizes: YOLOv8-n, s, m, l, and x, to meet different application requirements and hardware conditions. As the depth and width of the model increase, the number of model parameters and the amount of computation increase accordingly. Users can choose the appropriate network structure based on the actual application scenario. In particular, the YOLOv8-n model is optimized for NVIDIA Jetson Nano devices, which can provide faster detection speed and higher accuracy on embedded devices, and is an ideal choice for low-cost, low-resource devices.
[0054] In the present invention, since the gray spots involved account for a small proportion in the rails, a YOLOv8-m model with higher accuracy is selected for training.
[0055] 2) Image data preprocessing in the dataset
[0056] In the process of image data preprocessing, the image needs to be resized first, and the image needs to be adjusted to a uniform resolution of 1280x1280 pixels to ensure the consistency of the input data. Then, the format conversion is performed to convert the image file into the format required for model processing, and the files in JPEG, JPG, TIF and other formats are converted to PNG. Finally, normalization is performed, that is, the pixel values of the image are standardized to a fixed range (i.e., floating point numbers between 0 and 1), which helps the model learn and extract features more effectively and eliminate uprising samples.
[0057] 3) Use the preprocessed images in the dataset to train the YOLOv8 model;
[0058] Model training was performed on a high-performance server equipped with four NVIDIA 4090 graphics cards to ensure sufficient computing resources and high efficiency. In order to maximize the learning ability and generalization performance of the model, 1000 training cycles (epochs) were set, and the image size (imgsz) was set to 2560, which helps the model capture more subtle image features. At the same time, the batch size was set to 64, which is a balanced choice that takes into account GPU memory limitations while ensuring training efficiency.
[0059] During the training process, the simulated cosine annealing adaptive learning rate adjustment strategy was adopted. Simulated cosine annealing is a learning rate adjustment strategy based on the cosine function, which is used to optimize the learning rate during model training. This method imitates the periodic decrease and increase of the cosine function to achieve effective global search and local fine-tuning. At different stages of training, the learning rate is periodically adjusted in the form of a cosine function, so that a large-scale search is performed in the early stage and refined to the optimal solution in the later stage. The learning rate adjustment formula is as follows:
[0060]
[0061] Where η(t) is the learning rate at time t, η min and η max are the minimum and maximum learning rates respectively, and T is the total number of iterations in a cycle.
[0062] In addition, regularization techniques such as Dropout and weight decay are used to prevent overfitting.
[0063] Dropout is a technique that randomly "discards" some neural network units during training. In each training iteration, each neuron has a certain probability of being temporarily removed from the network and does not participate in forward and backward propagation. This method reduces the model's dependence on specific neurons and increases the generalization ability of the network. In each iteration, a probability p = 0.5 is applied to each hidden layer, a portion of neurons are randomly selected for activation, and the outputs of the remaining neurons are set to 0.
[0064] Weight decay is achieved by adding a penalty term proportional to the square of the weight to the loss function of the training model. This method tends to learn smaller weight values, making the model simpler and reducing the risk of overfitting. Adding a regularization term λ∑ to the loss function w w 2 , where λ is the regularization coefficient and w is the model weight.
[0065] Through the above method, the YOLOv8 model is trained for multiple rounds of iterations to fine-tune the parameters of the model, and the generalization ability of the model is ensured through cross-validation.
[0066] 4) Optimize the detection results through non-maximum suppression algorithm.
[0067] In the object detection task, detection models (such as YOLO, SSD, etc.) usually generate a large number of candidate bounding boxes to locate the target object. However, there are often a large number of overlapping boxes in these candidate boxes, all pointing to the same target. If not handled, this will lead to duplicate targets in the detection results, affecting the final detection accuracy and efficiency.
[0068] Non-Maximum Suppression (NMS) is a key algorithm for target detection in the field of computer vision. This algorithm is mainly used to remove redundant bounding boxes during target detection and retain the best bounding box, thereby improving detection accuracy.
[0069] The present invention adopts the non-maximum suppression algorithm to solve this problem through the following steps:
[0070] 1. Confidence sorting: First, the confidence of each bounding box (i.e., the probability of containing an object in the box) is sorted according to the YOLOv8 model.
[0071] 2. Select the box with the highest confidence: The bounding box with the highest confidence is selected as the reference box and kept in the final result.
[0072] 3. Calculate the overlapping area: For the remaining bounding boxes, calculate the degree of overlap between the remaining bounding boxes and the reference box, usually measured by the intersection over union (IoU).
[0073] 4. Remove overlapping boxes: If the IoU between a bounding box and a reference box exceeds a preset threshold (e.g. 0.5), the two boxes are considered to point to the same target and the box is removed from the candidate list.
[0074] 5. Repeat processing: Repeat steps 2 to 4 until all bounding boxes have been processed.
[0075] Through this process, the non-maximum suppression algorithm is used to effectively remove overlapping bounding boxes and only retain the most representative boxes. This not only improves the accuracy of object detection, but also reduces the computational burden of subsequent processing steps.
[0076] Step 3: Use the YOLOv8 image segmentation algorithm to build a three-partition model of the rail and perform rail surface area segmentation.
[0077] This step is the same as step 2, including model selection, data set image data preprocessing, model training, and non-maximum suppression algorithm to optimize the segmentation results. Except for model selection and model training (including the use of different data sets), the rest of the process is the same as step 2.
[0078] As for model selection, the YOLOv8-n model is selected in the present invention to train the Rail Partition-501 data set because of its superior performance balance. YOLOv8-n, as a lightweight neural network, although its model size and computational complexity are low, the detection accuracy it provides meets the requirements of gray spot detection on the rail surface. This model is particularly suitable for fast image processing in resource-constrained environments, such as embedded systems, which is particularly important for real-time detection on site. In addition, YOLOv8-n can speed up training and improve the efficiency of model iteration, which is necessary for rapid adaptation to the ever-changing railway detection environment. Despite the simplified model structure, YOLOv8-n still maintains robustness to various environmental changes, ensuring reliable gray spot detection under various working conditions. In general, YOLOv8-n optimizes the use of computing resources while ensuring the required detection performance, making it an ideal choice for processing large numbers of images and performing continuous monitoring.
[0079] For model training, model training was performed on a high-performance server equipped with 4 NVIDIA 4090 graphics cards to ensure sufficient computing resources and high efficiency. In order to maximize the learning ability and generalization performance of the model, 1000 training cycles (epochs) were set, and the image size (imgsz) was set to 1280, which is conducive to the model capturing more subtle image features. At the same time, the batch size (batch size) was set to 128, which is a balanced choice that takes into account GPU memory limitations while ensuring training efficiency.
[0080] During the training process, an adaptive learning rate adjustment strategy is also adopted. In addition, regularization techniques such as dropout and weight decay are used to prevent overfitting.
[0081] Step 4: According to the rail surface gray spot detection results and rail surface area segmentation results, detect the new rail image and calculate the gray spot area according to the gray spot area ratio.
[0082] 1) Calculation of actual area of different rail types
[0083] In the present invention, as a preliminary preparation stage for calculating the area of gray spots, the area of different parts of the rail is first accurately quantified in professional CAD software. This process involves multiple key areas such as the upper, middle and lower parts of the rail, as well as specific surfaces where gray spots may appear. According to the rail image segmented by the three-partition model of the rail in step 3, combined with the high-precision mapping capability of the CAD software, accurate actual area data of each partition of the rail is obtained, and the area of the rail cross-section image is determined as the basis for evaluating and calculating the actual proportion of gray spots on the rail.
[0084] 2) Calculation of rail bottom area
[0085] The goal of the calculation is to determine the area ratio of the bottom of the rail in the entire image. This step calculates the ratio of the number of pixels in the bottom area of the rail to the number of pixels in the entire image, which is the key reference data for the subsequent calculation of the gray spot area. The specific calculation formula is:
[0086]
[0087] Among them, P rail_bottom Indicates the ratio of the bottom area of the rail to the total area of the image, A rail_bottom Indicates the number of pixels in the bottom area of the rail, A total Represents the number of pixels in the entire image.
[0088] 3) Gray spot area calculation
[0089] The gray spots at the bottom of the rail can be accurately detected from the rail image by using the detection model in step 2 to identify the gray spots at the bottom of the rail. The area ratio of the detected gray spots is also calculated in the same way, that is, the ratio of the number of pixels in the gray spot area to the number of pixels in the entire image.
[0090]
[0091] Among them, P spot Indicates the ratio of the bottom area of the rail to the total area of the image, A spot Indicates the number of pixels in the detected gray spot area.
[0092] Finally, based on the calculated gray spot ratio and rail bottom ratio, the actual area of the gray spot at the bottom of the rail can be estimated. The actual area of the gray spot at the bottom of the rail can be calculated using the following formula:
[0093]
[0094] Among them, A spot_real Indicates the actual area of the gray spot at the bottom of the rail to be calculated, A rail_bottom_real Indicates the actual area of the bottom of the rail.
[0095] 4) Gray spot area calculation
[0096] The rail cross-section image is manually partitioned using the threshold method. The threshold method is a simple and effective image processing technique that distinguishes different areas in an image by setting a specific pixel value (threshold).
[0097] In the present invention, firstly, the rail image cross-section image is partitioned more finely according to the proportion to ensure that each area can be evaluated independently, such as Figure 2 The figure shows the schematic diagram of the subdivided areas of the standard rail section. Next, by calculating the degree of overlap between each gray spot and these pre-divided areas, the location of each gray spot can be accurately identified and classified. Specifically, if the area of a gray spot overlaps with a certain area by more than 80%, it is determined that the gray spot belongs to the area.
[0098] The universal gray spot detection and gray spot area calculation method for the rail surface of the present invention, for the specific rail gray spot-2380 data set, the trained model shows excellent performance, and the accuracy of gray spot detection is as high as 96.45%. In addition, for the rail partition-501 data set, the partition detection accuracy of the model reached 99.89%, indicating the extremely high accuracy of the model in distinguishing different areas of the rail. These results not only verify the effectiveness of the model architecture and training methods, but also confirm the reliability and accuracy of the model in practical applications.
[0099] In terms of performance, the model proposed in this paper can complete the detection and area calculation process of gray spots on the rail within 2 seconds, showing excellent computational efficiency. This fast response time is particularly important for real-time monitoring systems, ensuring that accurate data analysis and evaluation can be provided in a timely manner even in emergency situations. Overall, the method of the present invention can provide fast and reliable reasoning capabilities in a CPU environment while maintaining high-precision detection, which is of great significance for railway safety monitoring and maintenance.
Claims
1. A method for detecting and calculating the area of gray spots on a rail surface, characterized in that: The following steps are involved: Step 1: Construct the rail surface gray spot dataset and rail partition dataset; Rail surface gray spots dataset: Under different environmental conditions and lighting conditions, multiple rail fractures are photographed from multiple angles to collect gray spot images. The collected gray spot images are annotated, including size, shape and exact location, to form a gray spot dataset on the rail surface. Rail partition dataset; The collected gray spot images are used to mark rail partitions, including the upper, middle and lower areas of the rails, to form a rail partition data set; Step 2: Use the gray spot image dataset constructed in step 1 to train the YOLOv8 model, and use the YOLOv8 image segmentation algorithm to detect gray spots on the rail surface; Step 3: Use the rail partition dataset constructed in step 1 to train the YOLOv8 model, build a rail three-partition model, and use the YOLOv8 image segmentation algorithm to segment the rail surface area; Step 4: According to the detection results of gray spots on the rail surface and the segmentation results of the rail surface area, the new rail image is detected, and the gray spot area is calculated according to the gray spot area ratio; 1) Calculation of actual area of different rail types Firstly, the area of different parts of the rail is accurately quantified as a basis for evaluating and calculating the actual proportion of gray spots on the rail; 2) Calculation of rail bottom area The rail three-partition model in step 3 is used to subdivide the rail image and determine the area ratio of the rail bottom in the entire image. The ratio is calculated by calculating the ratio of the number of pixels in the rail bottom area to the number of pixels in the entire image. The specific calculation formula is: Among them, P rail_bottom Indicates the ratio of the bottom area of the rail to the total area of the image, A rail_bottom Indicates the number of pixels in the bottom area of the rail, A total Represents the number of pixels of the entire image; 3) Gray spot area calculation The gray spots on the rails are identified by the detection model in step 2. The detected gray spot area ratio, i.e., the ratio of the number of pixels in the gray spot area to the number of pixels in the entire image, is calculated by the following formula: Among them, P spot Indicates the ratio of the bottom area of the rail to the total area of the image, A spot Indicates the number of pixels in the detected gray spot area; Finally, the actual area of the gray spots is estimated based on the calculated gray spot ratio and rail bottom ratio: The actual area of the gray spots is calculated using the following formula: Among them, A spot_real Indicates the actual area of the gray spot to be calculated, A rail_bottom_real Indicates the actual area of the bottom of the rail.
2. A method for detecting and calculating gray spots on a rail surface as claimed in claim 1, characterized in that: In step 2, the YOLOv8-m model is used.
3. A method for detecting and calculating gray spots on a rail surface as claimed in claim 1, characterized in that: In step 3, the YOLOv8-n model is used.
4. A method for detecting and calculating gray spots on a rail surface as claimed in claim 1, characterized in that: In steps 2 and 3, image enhancement technology is introduced to enable the YOLOv8 model to simulate environmental changes in various practical application scenarios.
5. A universal gray spot detection and gray spot area calculation method for rail surface as claimed in claim 1, characterized in that: Preprocess the data set created in step 1 by First, the image needs to be resized to a uniform resolution of 1280x1280 pixels to ensure the consistency of the input data; then, format conversion is performed to convert the image file into the format required for model processing and convert the file format to PNG; finally, normalization is performed to standardize the pixel values of the image to a fixed range.
6. A universal gray spot detection and gray spot area calculation method for rail surface as claimed in claim 1, characterized in that: The non-maximum suppression algorithm is used to optimize the gray spot detection results in step 2 and the region segmentation results in step 3, specifically: A. Confidence sorting: Sort the confidence of each bounding box according to the YOLOv8 model; B. Select the box with the highest confidence: Select the bounding box with the highest confidence as the reference box and keep it in the final result; C. Calculate the overlapping area: For the remaining bounding boxes, calculate the degree of overlap between the remaining bounding boxes and the reference box, and use the intersection-over-union ratio to measure; D. Remove overlapping boxes: If the IoU between a bounding box and a reference box exceeds a preset threshold, the two boxes point to the same target and the box is removed from the candidate list; E. Repeat processing: Repeat steps 2 to 4 until all bounding boxes have been processed.
7. A universal gray spot detection and gray spot area calculation method for rail surface as claimed in claim 1, characterized in that: In step 2, the model is trained on a high-performance server equipped with four NVIDIA 4090 graphics cards, with 1000 training cycles and the image size set to 2560; at the same time, the batch size is set to 64.
8. A universal gray spot detection and gray spot area calculation method for rail surface as claimed in claim 1, characterized in that: In step 3, the model is trained on a high-performance server equipped with four NVIDIA 4090 graphics cards, with 1000 training cycles and the image size set to 1280; at the same time, the batch size is set to 128.
9. A universal gray spot detection and gray spot area calculation method for rail surface as claimed in claim 1, characterized in that: In step 2 and step 3, the simulated cosine annealing adaptive learning rate adjustment strategy is used to optimize the learning rate during model training. At different stages of training, the learning rate is periodically adjusted in the form of a cosine function, so that a large-scale search is performed in the early stage and refined to the optimal solution in the later stage. The learning rate adjustment formula is as follows: Where η(t) is the learning rate at time t, η min and η max are the minimum and maximum learning rates respectively, and T is the total number of iterations in a cycle; In addition, Dropout and weight decay techniques are used to prevent overfitting; by adding a penalty term proportional to the square of the weight to the loss function of the training model: Among them, λ is the regularization coefficient and w is the model weight.
10. A universal gray spot detection and gray spot area calculation method for rail surface as claimed in claim 1, characterized in that: After determining the area of the gray spot, determine the location of the gray spot by the following method: After the rail partitions are identified, the threshold method is used to manually partition the rails. First, the rail image is further partitioned in proportion to ensure that each area can be evaluated independently. Next, the position of each gray spot can be accurately identified and classified by calculating the degree of overlap between each gray spot and each partition. If the area of a gray spot overlaps with a certain area by more than 80%, it is determined that the gray spot belongs to that area.
Citation Information
Patent Citations
Rail surface defect detection method based on depth learning network
CN109064461A
Silicon block impurity detection method based on image processing
CN111307814A
Intelligent profile online detection system for steel rail
CN112033299A
Steel rail surface defect detection method and device based on few-sample learning
CN112330591A
Appearance inspection method and appearance inspection system
JP2003149160A
