A method, system, device and medium for constructing a railway crack detection model

CN122799366APending Publication Date: 2026-09-22GUANGZHOU INST OF RAILWAY TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611169694.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-04
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

[0005]为了解决上述背景技术中提到的关于现有铁路裂痕检测模型复杂度高导致难以部署于边缘设备、小目标裂痕检测能力弱导致漏检率的问题,本发明提供了一种铁路裂痕检测模型的构建方法、系统、设备与介质

Benefits of technology

[0051]1、采用YOLOX-Nano作为基础架构,对主干网络和颈部网络中的冗余卷积层进行结构重参数化处理,并通过深度可分离卷积替换标准卷积,在保证特征提取能力的前提下降低模型参数量和计算量,使模型能够高效部署于边缘计算设备,满足铁路现场实时检测的需求;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122799366A_ABST
    Figure CN122799366A_ABST
Patent Text Reader

Abstract

The application discloses a kind of railway crack detection model construction method, system, equipment and medium, belong to computer vision target detection technical field;Method includes: obtaining track surface image, crack area is labeled and enhanced, constructs training dataset;With YOLOX-Nano as basic framework, the redundant convolution layer of main stem and neck network is reparameterized, and with depth separable convolution replaces standard convolution, obtains light model and trains, obtains initial detection model;Introduce Shuffle attention mechanism, combine channel and spatial attention, retain small crack features with low computational complexity, and optimize regression loss function as Alpha-CIoU loss function, obtain optimized detection model;Finally, generate railway crack detection model through deep learning training.The application maintains high-precision detection of small and dense cracks while reducing model complexity, and supports edge computing devices for real-time railway crack detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision target detection technology, specifically to a method, system, equipment, and medium for constructing a railway crack detection model. Background Technology

[0002] As a vital national infrastructure, the structural safety of railways directly impacts transportation efficiency and the safety of people's lives and property. Cracks on the track surface and in the fastener area are common safety hazards. Traditional manual inspection methods rely on visual inspection by professionals, which is not only inefficient and labor-intensive but also susceptible to factors such as lighting, weather, and fatigue, leading to missed inspections and misjudgments.

[0003] In recent years, deep learning-based target detection methods, especially the YOLO series algorithms, have been gradually introduced into the field of railway defect detection. In existing technologies, in order to ensure the detection accuracy of small cracks and dense crack areas, the detection models used are usually complex in structure and have a large number of parameters, resulting in large computational load and slow inference speed. They are difficult to deploy on edge computing devices and cannot meet the engineering application requirements of real-time detection on railway sites.

[0004] Therefore, there is an urgent need for a lightweight and robust method for constructing railway crack detection models that can effectively reduce model complexity while ensuring detection accuracy, and also meet the real-time deployment requirements of edge computing devices and the accurate detection of small cracks. Summary of the Invention

[0005] To address the issues mentioned in the background section regarding the high complexity of existing railway crack detection models, which makes them difficult to deploy on edge devices, and the weak detection capability for small target cracks, which leads to a high false negative rate, this invention provides a method, system, device, and medium for constructing a railway crack detection model.

[0006] The above-mentioned objective of this application is achieved through the following technical solution:

[0007] A method for constructing a railway crack detection model, the method comprising the following steps:

[0008] Acquire orbital surface images under different conditions, annotate the cracked areas in the images, perform data augmentation on the annotated images, and construct a training dataset;

[0009] Using the YOLOX-Nano network model as the basic architecture, the redundant convolutional layers in the backbone and neck networks of the basic architecture are structurally reparameterized, and the standard convolutions are replaced by depthwise separable convolutions to obtain a lightweight railway crack detection model; the lightweight railway crack detection model is trained using the training dataset to obtain an initial detection model;

[0010] A Shuffle attention mechanism is introduced between the backbone and neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost. The regression loss function is optimized into an Alpha-CIoU loss function. By adjusting the parameters of the Alpha-CIoU loss function, the contribution of positive and negative samples is controlled to obtain the optimized detection model.

[0011] The optimized detection model is trained using deep learning, and a railway crack detection model is generated based on the verification results during the training process.

[0012] By adopting the above technical solution, firstly, track surface images under different conditions are acquired, and crack areas are labeled and data augmented to construct a training dataset containing diverse scenarios, providing data support for model training. Then, using YOLOX-Nano as the basic architecture, structural reparameterization is performed, and standard convolutions are replaced with depthwise separable convolutions. This effectively reduces the number of model parameters and computational cost while maintaining detection accuracy, enabling the model to meet the deployment requirements of edge computing devices. Next, a Shuffle attention mechanism is introduced between the backbone and neck networks, combining channel attention and spatial attention mechanisms through channel shuffling. This preserves the feature information of small cracks with lower computational overhead, while optimizing the regression loss function to an Alpha-CIoU loss function. By adjusting parameters to control the contribution of positive and negative samples, the model focuses more on densely packed small target crack samples that are difficult to detect during training. Finally, the optimized detection model is trained using deep learning, and a railway crack detection model is generated based on the validation results. The entire solution effectively reduces model complexity while maintaining high-precision detection capabilities for both small and densely packed crack areas, achieving a balance between accuracy and lightweight design.

[0013] In a preferred embodiment, this application can be further configured as follows: acquiring orbital surface images under different conditions, annotating crack areas in the images, and performing data augmentation on the annotated images, including the following steps:

[0014] Track surface images are collected under different lighting conditions, weather conditions, and line conditions using track inspection vehicles, drones, or handheld devices.

[0015] Exposure detection is performed on the track surface image. When the image is overexposed or underexposed, exposure compensation processing or histogram equalization processing is performed on the image to restore the detailed information of the crack area.

[0016] The cracked areas in the processed image were annotated using an annotation tool;

[0017] Data augmentation is performed on the labeled image data, including at least one of geometric transformation, biomimetic transformation, hue adjustment, saturation adjustment, brightness adjustment, and mosaic enhancement.

[0018] By employing the above technical solutions, track surface images under different lighting, weather, and line conditions are collected using track inspection vehicles, drones, or handheld devices. This ensures that the training data covers diverse real-world detection scenarios, avoiding the problem of insufficient detection capability in practical applications due to a single sample. Exposure detection is performed on the collected images, and exposure compensation or histogram equalization is applied when the images are overexposed or underexposed to restore detailed information in crack areas. This ensures that cracks remain clearly visible even under extreme lighting conditions, preventing the inability to label and identify crack areas due to abnormal lighting. Labeling tools are used to annotate the processed images, providing accurate supervision signals for model training. At least one of the following data augmentation techniques—geometric transformation, biomimetic transformation, tone adjustment, saturation adjustment, brightness adjustment, and mosaic enhancement—is applied to the annotated images to simulate complex interferences such as rust, stains, and shadows in real-world scenarios. This expands the diversity of training samples, enabling the model to adapt to crack detection needs under different lighting, weather, and line conditions, thus enhancing the model's generalization ability and robustness in practical deployments.

[0019] In a preferred embodiment, this application can be further configured as follows: The redundant convolutional layers in the backbone and neck networks of the infrastructure undergo structural reparameterization, and standard convolutions are replaced with depthwise separable convolutions, including the following steps:

[0020] The redundant convolutional layers in the backbone network and the neck network are constructed into a multi-branch convolutional structure, and the multi-branch convolutional structure is trained using the training dataset to generate the trained multi-branch convolutional structure.

[0021] The trained multi-branch convolutional structure is folded into a single-branch standard convolutional structure to generate a single-branch standard convolutional structure for the inference stage.

[0022] At least some of the standard convolutions in the backbone network and the neck network are replaced with depthwise separable convolutions to generate a lightweight network structure.

[0023] By adopting the above technical solution, redundant convolutional layers in the backbone and neck networks are constructed into multi-branch convolutional structures and trained. The multi-branch structure enhances the network's non-linear expressive power during training, enabling the model to more fully learn the morphological features of cracks and ensuring that the model's feature extraction capability is not diminished by subsequent lightweighting. The trained multi-branch convolutional structure is folded into a single-branch standard convolutional structure. During inference, the additional branch parameters introduced during training are fused into the standard convolution, maintaining the feature expressive power learned during training while eliminating the additional inference computational overhead introduced by the multi-branch structure. At least some standard convolutions in the backbone and neck networks are replaced with depthwise separable convolutions. The computational process of standard convolutions is decomposed using depthwise convolution and pointwise convolution, reducing the number of multiplications and additions and the number of parameters while maintaining similar feature extraction capabilities, resulting in a lightweight network structure. Overall, the multi-branch structure ensures the model's feature expressive power during training, while structural folding and depthwise separable convolutions reduce the number of parameters and computational load during inference, allowing the model to meet the real-time deployment requirements of edge computing devices while maintaining detection accuracy.

[0024] In a preferred embodiment, this application can be further configured such that the Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling, including the following steps:

[0025] The channel attention mechanism calculates the weight of each channel in the input data of the Shuffle attention mechanism, and multiplies the weight with the data of the corresponding channel in the input data of the Shuffle attention mechanism to generate channel-enhanced data;

[0026] The spatial attention mechanism calculates the weight of each spatial location in the channel augmentation data, and multiplies the weight calculated by the spatial attention mechanism with the data of the corresponding spatial location in the channel augmentation data to generate spatial augmentation data;

[0027] The channels of the spatially augmented data are rearranged by channel shuffling to generate Shuffle attention mechanism output data.

[0028] By employing the above technical solutions, the weights of each channel in the input data of the Shuffle attention mechanism are calculated through a channel attention mechanism. These weights are then multiplied by the corresponding channel data in the input data to filter out channels containing key crack feature information and enhance their responses. This allows the model to focus on feature channels that contribute to crack detection and suppress interference from irrelevant channels. Similarly, the weights of each spatial location in the channel-enhanced data are calculated through a spatial attention mechanism. These weights are then multiplied by the corresponding spatial location data in the channel-enhanced data to filter out key spatial locations where cracks are located and enhance their responses. This allows the model to focus on pixel locations in the crack region and suppress interference from the background region. Channel shuffling rearranges the channels of the spatially enhanced data, achieving information fusion between different channels without increasing computational overhead. Overall, this approach enhances the feature responses of small cracks in both the channel and spatial dimensions with low computational cost, retains weak feature information of small cracks, improves the model's ability to detect small cracks, and avoids missed detections due to feature loss.

[0029] In a preferred example, this application can be further configured to: optimize the regression loss function into an Alpha-CIoU loss function, including the following steps:

[0030] Obtain the complete intersection-union loss function, which is used to simultaneously constrain the differences between the predicted box and the ground box in three dimensions: overlap area, center point distance, and aspect ratio.

[0031] Based on the complete intersection-union ratio loss function, a power exponent parameter is introduced to generate the Alpha-CIoU loss function. By adjusting the power exponent parameter, the gradient contribution ratio of positive and negative samples is controlled to increase the gradient contribution of dense small target crack samples that are difficult to detect during training.

[0032] By adopting the above technical solution, a complete intersection-union loss function is obtained. This loss function simultaneously constrains the differences between the predicted bounding box and the ground truth bounding box in three dimensions: overlap area, center point distance, and aspect ratio. This makes the predicted bounding box more consistent with the ground truth crack region in terms of position, size, and shape, thereby improving the localization accuracy of crack targets. Based on the complete intersection-union loss function, a power exponent parameter is introduced to generate an Alpha-CIoU loss function. By adjusting the value of the power exponent parameter, the gradient contribution ratio of the loss function to different samples is changed. This increases the gradient contribution of dense small target crack samples that are difficult to detect during training, making the model pay more attention to these difficult-to-detect samples during training. This improves the model's ability to detect dense small target cracks and enhances the detection effect of dense crack regions.

[0033] In a preferred embodiment, this application can be further configured as follows: The step of training the optimized detection model using deep learning and generating a railway crack detection model based on the verification results during the training process includes the following steps:

[0034] Using a deep learning framework, the optimized detection model is iteratively trained on the training dataset to generate the trained optimized detection model;

[0035] The trained and optimized detection model is validated on the validation dataset to generate validation results;

[0036] Based on the verification results, the effectiveness of the Shuffle attention mechanism and the Alpha-CIoU loss function were verified by ablation experiments.

[0037] The model parameters were adjusted based on the verification results of the ablation experiment to generate a railway crack detection model.

[0038] By adopting the above technical solution and employing a deep learning framework, the optimized detection model is iteratively trained on the training dataset. Through multiple iterations, the model continuously updates network weights, gradually converging to its optimal state and learning the optimal parameters suitable for railway crack detection. The trained optimized detection model is then validated on a validation dataset, generating validation results. These results quantify the model's detection accuracy and generalization ability on unseen data, determining whether the model has achieved the expected detection performance. Based on the validation results, ablation experiments are conducted to verify the effectiveness of the Shuffle attention mechanism and the Alpha-CIoU loss function, quantifying the independent contribution of each improved module to the model's detection accuracy and clarifying the actual role of each module. The model parameters are adjusted based on the ablation experiment validation results, retaining the validated improved modules and their optimal parameter configurations to generate a railway crack detection model that achieves an optimal balance between detection accuracy and inference speed.

[0039] The second objective of this invention is achieved through the following technical solution:

[0040] A system for constructing a railway crack detection model, comprising:

[0041] The acquisition module is used to acquire images of the track surface under different conditions, annotate the crack areas in the images, perform data augmentation on the annotated images, and construct a training dataset.

[0042] The training module, whose input is connected to the output of the acquisition module, is used to perform structural reparameterization on redundant convolutional layers in the backbone and neck networks of the YOLOX-Nano network model as the basic architecture, and replace standard convolutions with depthwise separable convolutions to obtain a lightweight railway crack detection model. The lightweight railway crack detection model is then trained using the training dataset to obtain an initial detection model.

[0043] The model processing module, whose input is connected to the output of the training module, is used to introduce a Shuffle attention mechanism between the backbone network and the neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost, and optimizes the regression loss function into an Alpha-CIoU loss function. By adjusting the parameters of the Alpha-CIoU loss function, the contribution of positive and negative samples is controlled to obtain an optimized detection model.

[0044] A model generation module, whose input is connected to the output of the model processing module, is used to perform deep learning training on the optimized detection model and generate a railway crack detection model based on the verification results during the training process.

[0045] By adopting the above technical solution, the railway crack detection model construction system consists of a data acquisition module, a training module, a model processing module, and a model generation module connected sequentially, forming a complete automated construction link from data acquisition to model generation. The data acquisition module acquires track surface images under different conditions, annotates crack areas, and performs data augmentation to construct a training dataset covering diverse scenarios, providing a data foundation for subsequent model training. The training module uses the YOLOX-Nano network model as its basic architecture, and performs lightweight processing by replacing standard convolutions with structure reparameterization and depthwise separable convolutions, reducing the number of model parameters and computational load, and generating a lightweight railway crack detection model. The model is tested and initially trained to obtain an initial detection model. The model processing module introduces a Shuffle attention mechanism between the backbone and neck networks of the initial detection model. By combining channel attention and spatial attention mechanisms through channel shuffling, it preserves the feature information of small cracks with low computational cost and optimizes the regression loss function to an Alpha-CIoU loss function. By adjusting parameters to control the contribution of positive and negative samples, the detection accuracy of small and dense cracks is improved on the basis of a lightweight model, generating an optimized detection model. The model generation module trains the optimized detection model with deep learning and generates the final railway crack detection model based on the validation results. The four modules work together to effectively reduce model complexity while ensuring detection accuracy, generating a railway crack detection model that can be directly deployed on edge computing devices, realizing the automation and intelligence of railway crack detection.

[0046] The above-mentioned objective three of this application is achieved through the following technical solution:

[0047] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method for constructing a railway crack detection model.

[0048] The fourth objective of this application is achieved through the following technical solution:

[0049] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method for constructing a railway crack detection model.

[0050] In summary, this application includes at least one of the following beneficial technical effects:

[0051] 1. Using YOLOX-Nano as the basic architecture, the redundant convolutional layers in the backbone network and neck network are structurally reparameterized, and the standard convolution is replaced by depthwise separable convolution. This reduces the number of model parameters and computational cost while ensuring feature extraction capability, enabling the model to be efficiently deployed on edge computing devices to meet the needs of real-time detection at railway sites.

[0052] 2. A Shuffle attention mechanism is introduced between the backbone network and the neck network. By channel shuffling, the channel attention mechanism and the spatial attention mechanism are efficiently combined to enhance the feature response of small cracks in the channel dimension and spatial dimension with low computational cost. This effectively preserves the weak feature information of small cracks and improves the model's ability to detect small cracks and dense crack regions.

[0053] 3. The regression loss function is optimized into the Alpha-CIoU loss function. Based on the constraints of the complete intersection-union loss function on the three dimensions of overlapping area, center point distance and aspect ratio, a power exponent parameter is introduced. By adjusting the parameter, the gradient contribution ratio of positive and negative samples is controlled, so that the model pays more attention to the dense small target crack samples that are difficult to detect during training, thereby improving the localization accuracy and detection effect of dense crack areas.

[0054] 4. Collect track surface images under different lighting conditions, weather conditions, and line conditions using track inspection vehicles, drones, or handheld devices. Combine exposure compensation or histogram equalization processing with diverse data augmentation strategies such as geometric transformation, biomimetic transformation, hue adjustment, saturation adjustment, brightness adjustment, and mosaic enhancement to make the training data cover diverse real-world detection scenarios and enhance the model's generalization ability and robustness under different lighting, weather, and line conditions.

[0055] 5. The data acquisition module, training module, model processing module, and model generation module are connected in sequence to form a complete automated construction chain from data acquisition to model generation. Each module is independent and decoupled, and can be quickly adapted to crack detection tasks of other infrastructure such as bridges, tunnels, and pavements according to actual needs. It has good scalability and engineering application value. Attached Figure Description

[0056] Figure 1 This is a flowchart illustrating an embodiment of the method for constructing a railway crack detection model according to this application.

[0057] Figure 2 This is a flowchart illustrating the implementation of step S10 in an embodiment of the method for constructing a railway crack detection model according to this application.

[0058] Figure 3 This is a flowchart illustrating the implementation of step S20 in an embodiment of the method for constructing a railway crack detection model according to this application.

[0059] Figure 4 This is a flowchart illustrating the implementation of step S30 in an embodiment of the method for constructing a railway crack detection model according to this application.

[0060] Figure 5 This is a flowchart illustrating the implementation of step S30 in an embodiment of the method for constructing a railway crack detection model according to this application.

[0061] Figure 6 This is a flowchart illustrating the implementation of step S40 in an embodiment of the method for constructing a railway crack detection model according to this application.

[0062] Figure 7 This is a schematic diagram of an embodiment of a railway crack detection model construction system according to this application. Detailed Implementation

[0063] The following is in conjunction with the appendix Figure 1-7 This application will be described in further detail.

[0064] In one embodiment, such as Figure 1 As shown, this application discloses a method for constructing a railway crack detection model, which specifically includes the following steps:

[0065] S10: Obtain track surface images under different conditions, annotate the crack areas in the images, perform data augmentation on the annotated images, and construct a training dataset.

[0066] In this embodiment, the track surface image refers to the image of the track surface and fastener area collected by a track inspection vehicle, drone or handheld device; the crack area refers to the area of ​​structural damage such as cracks and fissures on the track surface; data augmentation refers to a series of transformations and perturbations on the original labeled image to expand the diversity of training samples; the training dataset refers to the set of image samples used for model training after labeling and data augmentation.

[0067] Specifically, track surface images are collected using track inspection vehicles, drones, or handheld devices under varying lighting, weather, and track conditions to ensure the collected samples cover actual railway inspection scenarios. After collection, the LabelImg annotation tool is used to label crack areas in the images, drawing rectangular bounding boxes closely aligned with the crack areas and assigning a "crack" category label to generate an annotation file. The labeled images then undergo data augmentation processing, including geometric transformations, biomimetic transformations, tone adjustments, saturation adjustments, brightness adjustments, and mosaic enhancement, to simulate complex interference in real-world scenarios, generating an augmented training dataset. This processed training dataset covers diverse detection scenarios, providing a data foundation for subsequent model training and enhancing the model's generalization ability in different environments.

[0068] S20: Using the YOLOX-Nano network model as the basic architecture, the redundant convolutional layers in the backbone and neck networks of the basic architecture are structurally reparameterized, and the standard convolution is replaced by depthwise separable convolution to obtain a lightweight railway crack detection model; the lightweight railway crack detection model is trained using the training dataset to obtain an initial detection model.

[0069] In this embodiment, the YOLOX-Nano network model is a lightweight version of the YOLOX series, containing a backbone network and a neck network, suitable for deployment on resource-constrained edge devices; structural reparameterization refers to reducing the computational cost during inference while maintaining the model's feature extraction capabilities through specific structural transformations; depthwise separable convolution decomposes standard convolution into two steps: depthwise convolution and pointwise convolution, used to reduce the number of model parameters and computational cost; the lightweight railway crack detection model refers to the detection model whose parameter and computational cost are lower than the original YOLOX-Nano after lightweight processing; training refers to using a pre-constructed training dataset to learn the model's parameters, enabling the model to identify and locate crack regions.

[0070] Specifically, the YOLOX-Nano network model was selected as the basic architecture. Redundant convolutional layers in the backbone and neck networks underwent structural reparameterization, transforming them into multi-branch convolutional structures for training to enhance feature representation capabilities. After training, these multi-branch convolutional structures were folded into single-branch standard convolutional structures to reduce inference computation. Simultaneously, at least some standard convolutions in the backbone and neck networks were replaced with depthwise separable convolutions, further reducing the number of model parameters and computational cost, resulting in a lightweight railway crack detection model. The lightweight model was then trained using the training dataset constructed in step S10. The difference between the predicted results and the labeled data was calculated through forward propagation, and the network weights were continuously updated through backpropagation, allowing the model to gradually learn the morphological features of the cracks, thus obtaining the initial detection model. Through these lightweighting processes, the model effectively reduces both the number of parameters and computational cost while maintaining detection accuracy, meeting the deployment requirements of edge computing devices.

[0071] S30: A Shuffle attention mechanism is introduced between the backbone network and the neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost. The regression loss function is optimized into an Alpha-CIoU loss function. The contribution of positive and negative samples is controlled by adjusting the parameters of the Alpha-CIoU loss function to obtain an optimized detection model.

[0072] In this embodiment, the Shuffle attention mechanism is a lightweight combined attention module that efficiently fuses the outputs of channel attention and spatial attention through channel shuffling to enhance feature representation with low computational cost. The channel attention mechanism assigns importance weights to each channel of the input data, filtering channels that contain key feature information about cracks. The spatial attention mechanism assigns importance weights to each spatial location, filtering key spatial locations where cracks are located. The Alpha-CIoU loss function is a loss function that introduces a power-law parameter on top of the complete intersection-union loss, used to control the gradient contribution ratio of positive and negative samples.

[0073] Specifically, a Shuffle attention mechanism is introduced between the backbone network and the neck network of the initial detection model. The Shuffle attention mechanism first calculates the weights of each channel in the input data through a channel attention mechanism, multiplies the weights by the data of the corresponding channel, filters out the channels containing key feature information of cracks and enhances their feature responses, generating channel-enhanced data. Then, it calculates the weights of each spatial location in the channel-enhanced data through a spatial attention mechanism, multiplies the weights by the data of the corresponding spatial location, filters out the key spatial locations where cracks are located and enhances their feature responses, generating spatial-enhanced data. Finally, the channels of the spatial-enhanced data are rearranged through channel shuffling to achieve interactive fusion of information between different channels, generating Shuffle attention mechanism output data and passing it to the neck network, preserving the weak feature information of small cracks with low computational cost. Simultaneously, the regression loss function is optimized into an Alpha-CIoU loss function, obtaining a complete intersection-union loss function to simultaneously constrain the differences between the predicted and ground truth bounding boxes in three dimensions: overlap area, center point distance, and aspect ratio. Then, a power-law parameter is introduced into the complete intersection-union loss function to generate the Alpha-CIoU loss function. By adjusting the power-law parameter, the gradient contribution ratio of positive and negative samples is controlled, increasing the gradient contribution of dense, small crack samples that are difficult to detect during training, resulting in an optimized detection model. These improvements enhance the model's detection accuracy for both small and densely packed crack regions while maintaining its lightweight design.

[0074] S40: Perform deep learning training on the optimized detection model, and generate a railway crack detection model based on the verification results during the training process.

[0075] In this embodiment, deep learning training refers to iteratively training the optimized detection model using a deep learning framework, so that the model parameters gradually converge to the optimal state; the verification result refers to the quantitative indicators such as detection accuracy and recall obtained by evaluating the model performance through the verification dataset during the training process; the railway crack detection model refers to the final model generated after training and verification, which can be directly deployed on edge devices for crack detection.

[0076] Specifically, using the PyTorch deep learning framework, the optimized detection model is iteratively trained on the training dataset. Through multiple rounds of forward and backpropagation, the network weights are continuously updated, allowing the model to gradually converge to its optimal state, generating the trained optimized detection model. This optimized model is then validated on a validation dataset to evaluate its detection accuracy and generalization ability on unseen data, generating validation results. Based on the validation results, ablation experiments are conducted to verify the effectiveness of the Shuffle attention mechanism and the Alpha-CIoU loss function, comparing the detection accuracy and recall before and after introducing each improved module to quantify the actual contribution of each module. Based on the validation results of the ablation experiments, the model parameters are adjusted, retaining the validated improved modules and their optimal parameter configurations to generate a railway crack detection model, achieving an optimal balance between detection accuracy and inference speed. The generated railway crack detection model can be deployed on edge computing devices for real-time crack detection in actual railway inspection scenarios. In actual deployment, the model can be mounted on edge computing devices on track inspection vehicles or drones to perform frame-by-frame detection on track surface images collected in real time during the inspection process. When a crack target is detected, the location and category information of the crack are immediately output to help inspection personnel quickly locate areas with safety hazards.

[0077] In one embodiment, such as Figure 2 As shown, in step S10, namely acquiring orbital surface images under different conditions, marking the crack areas in the images, and performing data augmentation on the marked images, the steps include:

[0078] S101: Collect track surface images under different lighting conditions, weather conditions, and line conditions using track inspection vehicles, drones, or handheld devices.

[0079] In this embodiment, different lighting conditions include direct strong light, diffused light on cloudy days, backlight, shadow coverage, and other lighting changes that may be encountered during actual inspections; different weather conditions include sunny days, cloudy days, rainy days, foggy days, etc.; and different line conditions include straight sections, curved sections, turnout areas, tunnels, viaducts, etc.

[0080] Specifically, during the data acquisition phase, a track inspection vehicle is used to complete full-coverage image acquisition of the railway line, covering existing lines with different service years and different degrees of damage. This ensures that the collected samples can cover most of the possible types of cracks and scene interferences that may occur on the railway site, providing a comprehensive and reliable raw data foundation for subsequent model training.

[0081] S102: Perform exposure detection on the track surface image. When the image is overexposed or underexposed, perform exposure compensation processing or histogram equalization processing on the image to restore the detailed information of the crack area.

[0082] In this embodiment, exposure detection refers to detecting whether the average brightness of the overall image falls within the normal exposure range; overexposure refers to a state where the image brightness is too high and the details of the crack area are submerged by bright light; underexposure refers to a state where the image brightness is too low and the details of the crack area are covered by shadows; exposure compensation processing refers to adjusting the brightness and contrast values ​​of the image to restore the details of overly bright or dark areas to a recognizable state; histogram equalization processing refers to redistributing the pixel gray values ​​of the image to enhance the local contrast of the image and make the details of the dark areas visible.

[0083] Specifically, exposure detection is performed on each track surface image acquired in step S101, and the overall average brightness of the image is calculated. When the average brightness is higher than a preset high brightness threshold, it is determined to be overexposed; when the average brightness is lower than a preset low brightness threshold, it is determined to be underexposed. In the case of overexposure, the brightness value is reduced and the contrast is adjusted to restore the crack details in the bright areas to a recognizable state. In the case of underexposure, the brightness value is increased or histogram equalization is performed to enhance the local contrast of the image, making the crack details in the dark areas visible. After the above processing, the crack areas in the image can remain clearly distinguishable under different lighting conditions, avoiding the inability to subsequently label and identify crack areas due to abnormal lighting. For example, after histogram equalization processing, the fine crack details originally hidden in the shadows are revealed in the image acquired in a low-light environment inside the tunnel; after exposure compensation processing, the crack edges in the bright areas of the image acquired in a strong direct light environment are made clearly distinguishable.

[0084] S103: Use the annotation tool to annotate the cracked areas in the processed image.

[0085] In this embodiment, the annotation tool refers to a software tool used to draw target bounding boxes on an image and assign category labels; the crack region refers to the location of structural damage such as cracks and fissures in the track surface image; and the bounding box refers to a rectangular box drawn close to the crack region.

[0086] Specifically, the LabelImg annotation tool is used to annotate images after exposure compensation or histogram equalization. A rectangular bounding box is drawn along the edge of the crack area, ensuring that the bounding box completely contains all the pixels of the crack and does not contain too much irrelevant background. Each bounding box is assigned a "crack" category label, generating an annotation file corresponding to the image. The annotation file contains the category information and bounding box coordinate information of each crack target, providing accurate supervision signals for model training. During the annotation process, for microcracks less than 5 mm in length and fine cracks less than 1 mm in width, the annotator needs to draw a bounding box along the center line of the crack in the image magnified state to ensure that the bounding box can completely cover all the pixels of the crack.

[0087] S104: Perform data augmentation on the labeled image data, wherein the data augmentation includes at least one of geometric transformation, biomimetic transformation, hue adjustment, saturation adjustment, brightness adjustment and mosaic enhancement.

[0088] In this embodiment, geometric transformations include random flipping, random scaling, and random cropping; biomimetic transformation refers to simulating the occlusion interference of rust and stains on cracks in real scenes; hue adjustment, saturation adjustment, and brightness adjustment are used to simulate the color and brightness changes of images under different lighting conditions; mosaic enhancement refers to stitching four images into one training sample.

[0089] Specifically, data augmentation is applied synchronously to the image and corresponding annotation file annotated in step S103. This includes random horizontal and vertical flipping to increase sample diversity, random scaling and cropping to adapt to crack detection at different scales; adding biomimetic transformations to simulate rust spots and stain occlusion to simulate complex interference in real-world scenes; randomly adjusting the image's hue, saturation, and brightness to simulate image changes under different lighting and weather conditions; and using mosaic enhancement to stitch four images into a single training sample to enrich the image's contextual information. All augmentation operations synchronously update the corresponding annotation file to ensure that the crack category label and bounding box coordinates remain consistent with the augmented image.

[0090] In one embodiment, such as Figure 3 As shown, in step S20, namely, the redundant convolutional layers in the backbone and neck networks of the infrastructure undergo structural reparameterization and the standard convolutions are replaced with depthwise separable convolutions, the steps include:

[0091] S201: Construct the redundant convolutional layers in the backbone network and the neck network into a multi-branch convolutional structure, and train the multi-branch convolutional structure using the training dataset to generate the trained multi-branch convolutional structure.

[0092] In this embodiment, redundant convolutional layers refer to standard convolutional layers in the YOLOX-Nano backbone network and neck network that have structural repetition or computational redundancy; multi-branch convolutional structures refer to structures that expand single-branch standard convolutional layers into structures containing multiple parallel convolutional branches during the training phase.

[0093] Specifically, the standard convolutional layers identified as redundant in the backbone and neck networks are constructed into multi-branch convolutional structures. That is, during the training phase, the single-branch standard convolution is expanded into parallel branches containing multiple convolutional kernels of different sizes. The training dataset constructed in step S10 is used to train this multi-branch convolutional structure. The multi-branch structure increases the nonlinear expressive power and receptive field diversity of the network during the training phase, generating the trained multi-branch convolutional structure.

[0094] S202: Fold the trained multi-branch convolutional structure into a single-branch standard convolutional structure to generate a single-branch standard convolutional structure for the inference stage.

[0095] In this embodiment, folding refers to fusing the parameters of each branch in the multi-branch convolutional structure during the training phase into a single-branch standard convolution.

[0096] Specifically, after training is completed in step S201, the weights and biases of the convolution kernels of each branch in the trained multi-branch convolutional structure are fused and calculated. Through mathematical transformation, the parameters of multiple branches are equivalently converted into the weights and biases of a single-branch standard convolution, generating a single-branch standard convolutional structure used in the inference stage. The single-branch standard convolutional structure is mathematically equivalent to the multi-branch structure in the training stage, that is, it produces the same output result for the same input data. Thus, while maintaining the feature representation ability learned in the training stage, the additional inference computation overhead brought by the multi-branch structure is eliminated.

[0097] S203: Replace at least some of the standard convolutions in the backbone network and the neck network with depthwise separable convolutions to generate a lightweight network structure.

[0098] In this embodiment, depthwise separable convolution is a convolution method that decomposes standard convolution into two independent steps: depthwise convolution and pointwise convolution.

[0099] Specifically, the standard convolutions in the backbone and neck networks, after structural reparameterization, are used as replacement targets. At least some of these standard convolutions are replaced with depthwise separable convolutions. The depthwise separable convolutions first perform convolution operations on each channel of the input data separately through depthwise convolutions to extract the spatial features of each channel. Then, the outputs of the depthwise convolutions are linearly combined between channels through pointwise convolutions to generate new feature outputs. After the above replacement, a lightweight network structure is generated. The lightweight network structure effectively reduces the number of parameters and computational cost while maintaining similar feature extraction capabilities.

[0100] In one embodiment, such as Figure 4 As shown, in step S30, the Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling, including the following steps:

[0101] S301: The channel attention mechanism calculates the weight of each channel in the Shuffle attention mechanism input data, and multiplies the weight with the data of the corresponding channel in the Shuffle attention mechanism input data to generate channel enhancement data.

[0102] In this embodiment, the channel attention mechanism refers to a feature selection mechanism that evaluates the importance of each channel of the input data and assigns weights; the weight refers to a numerical value that reflects the importance of each channel to crack detection.

[0103] Specifically, the Shuffle attention mechanism is positioned between the backbone network and the neck network, receiving the data output from the backbone network as input data. The channel attention mechanism performs global average pooling on each channel of the input data, compressing the spatial information of each channel into a single value to generate a channel description vector. The channel description vector is then nonlinearly transformed using a fully connected layer and activation function to calculate the weight of each channel, which reflects the importance of each channel for crack detection. The calculated channel weights are then multiplied channel by channel in the input data to enhance the feature responses of important channels and suppress interference from irrelevant channels, generating channel-enhanced data.

[0104] S302: The spatial attention mechanism calculates the weight of each spatial position in the channel enhancement data, and multiplies the weight calculated by the spatial attention mechanism with the data of the corresponding spatial position in the channel enhancement data to generate spatial enhancement data.

[0105] In this embodiment, the spatial attention mechanism refers to a feature selection mechanism that evaluates the importance of each spatial location in the input data and assigns weights; spatial location refers to each pixel in the input data in the height and width dimensions; weight refers to a value that reflects the importance of each spatial location to crack detection.

[0106] Specifically, the spatial attention mechanism receives the channel enhancement data generated by S301 as input data, performs max pooling and average pooling on the input data to generate two spatial feature maps; the two spatial feature maps are concatenated along the channel dimension, and the concatenated feature map is mapped to a single-channel spatial weight map through a convolutional layer, and then processed by an activation function to generate weights for each spatial location, which reflect the importance of each spatial location to crack detection; the calculated weights for each spatial location are multiplied element-wise with the corresponding data in the channel enhancement data to enhance the feature response at the crack location, suppress interference from the background region, and generate spatial enhancement data.

[0107] S303: The channels of the spatially enhanced data are rearranged through channel shuffling to generate Shuffle attention mechanism output data.

[0108] In this embodiment, channel shuffling refers to the operation of rearranging the channel dimensions of the input data.

[0109] Specifically, the spatial augmentation data generated in channel shuffling receiving step S302 is used as input data. The spatial augmentation data is divided into several groups along the channel dimension. The grouped channels are rearranged according to a preset order, and then the rearranged groups of channels are spliced ​​together to form complete output data, generating Shuffle attention mechanism output data. After channel shuffling, the channel information between different groups is interactively fused, and then the output data is passed to the neck network for subsequent processing.

[0110] In one embodiment, such as Figure 5 As shown, step S30, namely optimizing the regression loss function into the Alpha-CIoU loss function, includes the following steps:

[0111] S304: Obtain the complete intersection-union loss function, which is used to simultaneously constrain the differences between the predicted box and the ground truth box in three dimensions: overlap area, center point distance, and aspect ratio.

[0112] In this embodiment, the predicted box refers to the bounding box of the crack region predicted by the model; the ground truth box refers to the bounding box of the crack region manually annotated during the annotation stage; and the complete intersection-union loss function is a loss function that simultaneously constrains the differences between the predicted box and the ground truth box in three dimensions: overlap area, center point distance, and aspect ratio.

[0113] Specifically, the complete intersection-union (CIU) loss function is used as the regression loss function. The CIU loss function includes an overlap area penalty term, a center point distance penalty term, and an aspect ratio consistency penalty term. During model training, the predicted bounding boxes and their corresponding ground truth bounding boxes are input into the CIU loss function. The loss function constrains the CIU ratio between the predicted and ground truth bounding boxes through the overlap area penalty term, the Euclidean distance between the center points of the predicted and ground truth bounding boxes through the center point distance penalty term, and the shape consistency of the predicted and ground truth bounding boxes through the aspect ratio consistency penalty term. The resulting localization loss value is calculated, and the network parameters are updated through backpropagation to make the predicted bounding boxes more closely match the actual crack area in terms of position, size, and shape. For example, for a strip crack approximately 20 mm long and 2 mm wide, the CIU loss function uses the aspect ratio consistency penalty term to make the aspect ratio of the predicted bounding box approach 10:1, preventing the predicted bounding box from being square and causing localization errors.

[0114] S305: Based on the complete intersection-union loss function, a power exponent parameter is introduced to generate the Alpha-CIoU loss function. By adjusting the power exponent parameter, the gradient contribution ratio of positive and negative samples is controlled to increase the gradient contribution of dense small target crack samples that are difficult to detect during training.

[0115] In this embodiment, the power exponent parameter refers to the hyperparameter used when introducing exponential operations on each term of the complete intersection-union loss function; the gradient contribution refers to the degree of influence of each sample on the network parameter update during model training.

[0116] Specifically, based on the complete intersection-union (CIU) loss function obtained in step S304, a power exponent parameter is introduced, and a power operation is applied to each loss term to generate the Alpha-CIoU loss function. During model training, the curvature of the loss function is changed by adjusting the value of the power exponent parameter: when the power exponent parameter is 1, the Alpha-CIoU loss function degenerates into the standard complete intersection-union loss function; when the power exponent parameter is greater than 1, the loss function generates a larger gradient in regions where the overlap between the predicted box and the ground truth box is low, causing the model to focus more on the predicted boxes with larger localization deviations in the early stages of training, while maintaining a smaller gradient in regions where the overlap between the predicted box and the ground truth box is high, thus avoiding over-adjustment of well-localized predicted boxes. Through the above mechanism, the gradient contribution of dense small target crack samples that are difficult to detect is increased during training, making the model pay more attention to these difficult-to-detect samples and improving the detection capability of dense small target cracks. For example, in the scenario of densely distributed cracks in the turnout area, a large number of tiny cracks with a length of less than 10 mm are close to each other. The Alpha-CIoU loss function increases the gradient contribution of these difficult-to-detect samples, making the model pay more attention to these dense small targets during training and reducing missed detections.

[0117] In one embodiment, such as Figure 6 As shown, in step S40, which involves training the optimized detection model using deep learning and generating a railway crack detection model based on the verification results during the training process, the steps include:

[0118] S401: Using a deep learning framework, the optimized detection model is iteratively trained on the training dataset to generate the trained optimized detection model.

[0119] In this embodiment, a deep learning framework refers to the development tools used to build and train deep neural networks; iterative training refers to the process of continuously updating model parameters through multiple rounds of forward and backward propagation.

[0120] Specifically, the PyTorch deep learning framework is used to iteratively train the optimized detection model on the training dataset constructed in step S10. During training, images from the training dataset are input into the model in batches. The model calculates the prediction results through forward propagation, compares the prediction results with the true values ​​in the labeled files, calculates the prediction error using a loss function, and then backpropagates the error layer by layer to calculate the gradient of the parameters at each layer. The optimizer updates the model parameters based on the gradients. Each batch of images processed constitutes one iteration, and each complete traversal of the training dataset constitutes one training epoch. After multiple epochs of iterative training, the model parameters are gradually updated and converge to the optimal state, generating the trained optimized detection model.

[0121] S402: Validate the trained optimized detection model on the validation dataset and generate validation results.

[0122] In this embodiment, the validation dataset refers to a set of image samples reserved from the training dataset that are not used in model training, and is used to evaluate the generalization ability of the model; the validation result refers to the quantitative evaluation indicators such as detection accuracy and recall output by the model after running on the validation dataset.

[0123] Specifically, the optimized detection model trained in step S401 is validated on the validation dataset. Images from the validation dataset are input into the trained optimized detection model. The model performs crack detection on each image and outputs predicted bounding boxes and class confidence scores. The prediction results are compared with the corresponding ground truth labels in the validation dataset. Quantitative evaluation metrics such as the model's detection accuracy and recall rate for crack targets are statistically analyzed to generate validation results, thereby evaluating the model's detection performance and generalization ability on unseen data.

[0124] S403: Based on the verification results, the effectiveness of the Shuffle attention mechanism and the Alpha-CIoU loss function are verified by ablation experiments.

[0125] In this embodiment, the ablation experiment refers to an experimental method that verifies the effectiveness of each module by removing or adding improvement modules to the model one by one and comparing the changes in model performance before and after the addition of the modules; effectiveness refers to whether the introduction of the module can improve the detection accuracy and recall rate of the model.

[0126] Specifically, based on the validation results of step S402, the following variant models were trained under the same dataset and training configuration: a model using only the lightweight YOLOX-Nano baseline model, a model that introduces the Shuffle attention mechanism separately on top of the baseline model, a model that uses the Alpha-CIoU loss function separately on top of the baseline model, and a complete model that introduces both the Shuffle attention mechanism and the Alpha-CIoU loss function. Each variant model was validated on the validation dataset, and the detection accuracy and recall of each variant model were compared. The independent contributions of the Shuffle attention mechanism and the Alpha-CIoU loss function, as well as their synergistic effect, were quantified to verify the effectiveness of the two improvement modules.

[0127] Furthermore, to verify the independent contributions and synergistic effects of the various improved modules of the Shuffle attention mechanism and Alpha-CIoU loss function in this invention, ablation experiments were designed under the same dataset and training configuration. The experiments used a self-built railway crack detection dataset containing 15,000 labeled images, divided into training, validation, and test sets in a 7:2:1 ratio. Evaluation metrics included mean accuracy (mAP@0.5), recall rate for small cracks (recall rate of crack targets with an area smaller than 32×32 pixels), number of parameters, and edge device inference frame rate (FPS).

[0128] Design the following four ablation experiments:

[0129] Experiment number Configuration mAP@0.5 Micro-crack recall rate Number of parameters (M) FPS A Benchmark YOLOX-Nano 72.3% 41.6% 0.91 52 B + SA-NET 76.8% 52.3% 0.93 48 C + Alpha-CIoU 74.9% 45.8% 0.91 50 D + SA-NET + Alpha-CIoU (This invention) 79.2% 58.7% 0.93 47

[0130] Experiment A uses the baseline YOLOX-Nano model without any improved modules, serving as the performance baseline. Experiment B adds a Shuffle Attention mechanism (SA-NET) between the backbone and neck network of the baseline model to verify the improvement effect of the combined attention mechanism on feature extraction and small crack detection capabilities. Experiment C replaces the regression loss function with Alpha-CIoU Loss on the baseline model to verify the contribution of the optimized loss function to localization accuracy and dense small target detection capabilities. Experiment D adds both SA-NET and Alpha-CIoU Loss, forming the complete model of this invention, to verify the synergistic enhancement effect of the two improved modules.

[0131] The dataset used in the above ablation experiments comes from actual inspection images of multiple railway lines, covering different line conditions such as straight sections, curved sections, switch areas, tunnels, and viaducts, as well as image samples collected under different weather conditions such as sunny, cloudy, rainy, and foggy days. The experimental data show that:

[0132] Adding SA-NET alone (Experiment B) improved mAP@0.5 by 4.5 percentage points compared to the baseline model, significantly increased the recall rate of small cracks by 10.7 percentage points, increased the number of parameters by only 0.02M, and decreased the inference frame rate by only 4 FPS. This shows that SA-NET effectively preserves the weak feature information of small cracks through the efficient combination of channel attention and spatial attention, improves the model's sensitivity to small crack detection, and has minimal impact on the model's lightweight and real-time performance.

[0133] Using Alpha-CIoU Loss alone (Experiment C) improved mAP@0.5 by 2.6 percentage points compared to the baseline model and the recall rate of small cracks by 4.2 percentage points, while keeping the number of parameters and inference frame rate unchanged. This shows that Alpha-CIoU Loss controls the contribution of positive and negative samples by adjusting the power exponent α, making the model pay more attention to dense small target crack samples that are difficult to detect during training, thus improving localization accuracy and recall rate without increasing any inference overhead.

[0134] Simultaneously adding SA-NET and Alpha-CIoU Loss (Experiment D), i.e., the complete model of this invention, makes mAP@0.5 reach 79.2%, an improvement of 6.9 percentage points compared to the baseline model; the recall rate of small cracks reaches 58.7%, a significant improvement of 17.1 percentage points compared to the baseline model; the combined effect of the two improved modules is better than the sum of the effects of using them individually, that is, 4.5+2.6=7.1 percentage points, an actual improvement of 6.9 percentage points, which is basically on par; however, the 17.1 percentage point improvement in the recall rate of small cracks is significantly better than the sum of the individual improvements of 10.7+4.2=14.9 percentage points, indicating that there is a good synergistic effect between SA-NET and Alpha-CIoU Loss—SA-NET enhances the detectability of small cracks at the feature level, while Alpha-CIoU Loss enhances the model's learning ability for difficult-to-detect samples at the training optimization level. The combined effect of the two significantly improves the model's ability to detect small cracks.

[0135] The complete model of this invention (Experiment D) has only 0.93M parameters, an increase of only 0.02M compared to the baseline model's 0.91M. The inference frame rate on edge devices reaches 47 FPS. Taking the NVIDIA Jetson Xavier NX as an example, this exceeds the real-time detection requirement of ≥30 FPS, fully meeting the practical application requirements for edge deployment in railway sites.

[0136] S404: Adjust the model parameters based on the verification results of the ablation experiment to generate a railway crack detection model.

[0137] In this embodiment, model parameters refer to the hyperparameters involved in the model training process, including learning rate, batch size, weight decay coefficient, number of channel groups in the attention mechanism, and power exponent parameter in the Alpha-CIoU loss function; adjustment refers to optimizing the configuration of each hyperparameter based on the verification results of the ablation experiment.

[0138] Specifically, based on the verification results of the ablation experiment in step S403, the effective improved modules are retained in the model, and their corresponding hyperparameters are optimized. The power exponent parameter in the Alpha-CIoU loss function is set to the value with the best performance in the verification results. At the same time, the warm-up strategy in the early stage of training and the learning rate decay strategy in the middle stage of training are configured according to the loss curve of the validation set. Based on the verification results of the ablation experiment, a set of hyperparameter configurations that achieves the optimal balance between model detection accuracy and inference speed is selected as the final training configuration. The model is retrained using all training data according to this configuration to generate the railway crack detection model.

[0139] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0140] In one embodiment, a system for constructing a railway crack detection model is provided, which corresponds one-to-one with the method for constructing the railway crack detection model in the above embodiments. For example... Figure 7 As shown, the system for constructing this railway crack detection model includes:

[0141] The acquisition module is used to acquire images of the track surface under different conditions, annotate the crack areas in the images, perform data augmentation on the annotated images, and construct a training dataset.

[0142] The training module, whose input is connected to the output of the acquisition module, is used to perform structural reparameterization on redundant convolutional layers in the backbone and neck networks of the YOLOX-Nano network model as the basic architecture, and replace standard convolutions with depthwise separable convolutions to obtain a lightweight railway crack detection model. The lightweight railway crack detection model is then trained using the training dataset to obtain an initial detection model.

[0143] The model processing module, whose input is connected to the output of the training module, is used to introduce a Shuffle attention mechanism between the backbone network and the neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost, and optimizes the regression loss function into an Alpha-CIoU loss function. By adjusting the parameters of the Alpha-CIoU loss function, the contribution of positive and negative samples is controlled to obtain an optimized detection model.

[0144] A model generation module, whose input is connected to the output of the model processing module, is used to perform deep learning training on the optimized detection model and generate a railway crack detection model based on the verification results during the training process.

[0145] Specific limitations regarding the construction system for the railway crack detection model can be found in the limitations on the construction method of the railway crack detection model mentioned above, and will not be repeated here. Each module in the above-mentioned railway crack detection model construction system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0146] In one embodiment, a computer device is provided, which may be a server or a personal computer. The computer device includes a processor, memory, a network interface, and a database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores training datasets, initial detection models, optimized detection models, and railway crack detection models. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a method for constructing a railway crack detection model.

[0147] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0148] Acquire orbital surface images under different conditions, annotate the cracked areas in the images, perform data augmentation on the annotated images, and construct a training dataset;

[0149] Using the YOLOX-Nano network model as the basic architecture, the redundant convolutional layers in the backbone and neck networks of the basic architecture are structurally reparameterized, and the standard convolutions are replaced by depthwise separable convolutions to obtain a lightweight railway crack detection model; the lightweight railway crack detection model is trained using the training dataset to obtain an initial detection model;

[0150] A Shuffle attention mechanism is introduced between the backbone and neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost. The regression loss function is optimized into an Alpha-CIoU loss function. By adjusting the parameters of the Alpha-CIoU loss function, the contribution of positive and negative samples is controlled to obtain the optimized detection model.

[0151] The optimized detection model is trained using deep learning, and a railway crack detection model is generated based on the verification results during the training process.

[0152] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0153] Acquire orbital surface images under different conditions, annotate the cracked areas in the images, perform data augmentation on the annotated images, and construct a training dataset;

[0154] Using the YOLOX-Nano network model as the basic architecture, the redundant convolutional layers in the backbone and neck networks of the basic architecture are structurally reparameterized, and the standard convolutions are replaced by depthwise separable convolutions to obtain a lightweight railway crack detection model; the lightweight railway crack detection model is trained using the training dataset to obtain an initial detection model;

[0155] A Shuffle attention mechanism is introduced between the backbone and neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost. The regression loss function is optimized into an Alpha-CIoU loss function. By adjusting the parameters of the Alpha-CIoU loss function, the contribution of positive and negative samples is controlled to obtain the optimized detection model.

[0156] The optimized detection model is trained using deep learning, and a railway crack detection model is generated based on the verification results during the training process.

[0157] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0158] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0159] The present invention and its embodiments have been described above. This description is not restrictive. The accompanying drawings are only one embodiment of the present invention. The actual structure is not limited to this. In short, if a person skilled in the art is inspired by this description and designs a similar structure and embodiment without departing from the spirit of the present invention, such design should fall within the protection scope of the present invention.

Claims

1. A method for constructing a railway crack detection model, characterized in that, The method for constructing the railway crack detection model includes the following steps: Acquire orbital surface images under different conditions, annotate the cracked areas in the images, perform data augmentation on the annotated images, and construct a training dataset; Using the YOLOX-Nano network model as the basic architecture, the redundant convolutional layers in the backbone and neck networks of the basic architecture are structurally reparameterized, and the standard convolutions are replaced by depthwise separable convolutions to obtain a lightweight railway crack detection model; the lightweight railway crack detection model is trained using the training dataset to obtain an initial detection model; A Shuffle attention mechanism is introduced between the backbone and neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost. The regression loss function is optimized into an Alpha-CIoU loss function. By adjusting the parameters of the Alpha-CIoU loss function, the contribution of positive and negative samples is controlled to obtain the optimized detection model. The optimized detection model is trained using deep learning, and a railway crack detection model is generated based on the verification results during the training process.

2. The method for constructing a railway crack detection model according to claim 1, characterized in that, The process of acquiring track surface images under different conditions, marking cracked areas in the images, and performing data augmentation on the marked images includes the following steps: Track surface images are collected under different lighting conditions, weather conditions, and line conditions using track inspection vehicles, drones, or handheld devices. Exposure detection is performed on the track surface image. When the image is overexposed or underexposed, exposure compensation processing or histogram equalization processing is performed on the image to restore the detailed information of the crack area. The cracked areas in the processed image were annotated using an annotation tool; Data augmentation is performed on the labeled image data, and the data augmentation includes at least one of geometric transformation, biomimetic transformation, hue adjustment, saturation adjustment, brightness adjustment and mosaic enhancement.

3. The method for constructing a railway crack detection model according to claim 1, characterized in that, The process of reparameterizing redundant convolutional layers in the backbone and neck networks of the infrastructure, and replacing standard convolutions with depthwise separable convolutions, includes the following steps: The redundant convolutional layers in the backbone network and the neck network are constructed into a multi-branch convolutional structure, and the multi-branch convolutional structure is trained using the training dataset to generate the trained multi-branch convolutional structure. The trained multi-branch convolutional structure is folded into a single-branch standard convolutional structure to generate a single-branch standard convolutional structure for the inference stage. At least some of the standard convolutions in the backbone network and the neck network are replaced with depthwise separable convolutions to generate a lightweight network structure.

4. The method for constructing a railway crack detection model according to claim 1, characterized in that, The Shuffle attention mechanism combines channel attention and spatial attention mechanisms through channel shuffling, including the following steps: The channel attention mechanism calculates the weight of each channel in the input data of the Shuffle attention mechanism, and multiplies the weight with the data of the corresponding channel in the input data of the Shuffle attention mechanism to generate channel-enhanced data; The spatial attention mechanism calculates the weight of each spatial location in the channel augmentation data, and multiplies the weight calculated by the spatial attention mechanism with the data of the corresponding spatial location in the channel augmentation data to generate spatial augmentation data; The channels of the spatially augmented data are rearranged by channel shuffling to generate Shuffle attention mechanism output data.

5. The method for constructing a railway crack detection model according to claim 1, characterized in that, The optimization of the regression loss function into the Alpha-CIoU loss function includes the following steps: Obtain the complete intersection-union loss function, which is used to simultaneously constrain the differences between the predicted box and the ground box in three dimensions: overlap area, center point distance, and aspect ratio. Based on the complete intersection-union ratio loss function, a power exponent parameter is introduced to generate the Alpha-CIoU loss function. By adjusting the power exponent parameter, the gradient contribution ratio of positive and negative samples is controlled to increase the gradient contribution of dense small target crack samples that are difficult to detect during training.

6. The method for constructing a railway crack detection model according to claim 1, characterized in that, The process of training the optimized detection model using deep learning and generating a railway crack detection model based on the verification results during training includes the following steps: Using a deep learning framework, the optimized detection model is iteratively trained on the training dataset to generate the trained optimized detection model; The trained and optimized detection model is validated on the validation dataset to generate validation results; Based on the verification results, the effectiveness of the Shuffle attention mechanism and the Alpha-CIoU loss function were verified by ablation experiments. The model parameters were adjusted based on the verification results of the ablation experiment to generate a railway crack detection model.

7. A system for constructing a railway crack detection model, characterized in that, include: The acquisition module is used to acquire images of the track surface under different conditions, annotate the crack areas in the images, perform data augmentation on the annotated images, and construct a training dataset. The training module, whose input is connected to the output of the acquisition module, is used to perform structural reparameterization on redundant convolutional layers in the backbone and neck networks of the YOLOX-Nano network model as the basic architecture, and replace standard convolutions with depthwise separable convolutions to obtain a lightweight railway crack detection model. The lightweight railway crack detection model is then trained using the training dataset to obtain an initial detection model. The model processing module, whose input is connected to the output of the training module, is used to introduce a Shuffle attention mechanism between the backbone network and the neck network of the initial detection model. The Shuffle attention mechanism combines the channel attention mechanism and the spatial attention mechanism through channel shuffling to retain the feature information of small cracks with low computational cost, and optimizes the regression loss function into an Alpha-CIoU loss function. By adjusting the parameters of the Alpha-CIoU loss function, the contribution of positive and negative samples is controlled to obtain an optimized detection model. A model generation module, whose input is connected to the output of the model processing module, is used to perform deep learning training on the optimized detection model and generate a railway crack detection model based on the verification results during the training process.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for constructing a railway crack detection model as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for constructing a railway crack detection model as described in any one of claims 1 to 6.