Steel rail damage detection method and device based on target detection, computer equipment, readable storage medium and program product
By enhancing the background and strengthening the edge feature of the rail image, combined with the probability and category probability processing of the target detection model, the problems of low efficiency and insufficient accuracy in traditional detection methods are solved, and efficient and accurate rail damage detection is achieved.
Patent Information
- Application Number
- CN202510562739.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-15
AI Technical Summary
Traditional rail damage detection methods are inefficient and insufficiently accurate, making it difficult to deal with minor injuries in complex environments, and missed or missed inspections are often seen.
By acquiring the rail images for background enhancement and edge feature enhancement, the target detection model is used to determine the probability and category probability of candidate injury areas, and the candidate areas of the same category are aggregated to generate the rail damage detection results.
It improves the accuracy and efficiency of rail damage detection, avoids misjudgment and misjudgment, and adapts to the adaptive treatment of multiple types of injuries.
Smart Images

Figure CN120495206A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of target detection technology, and in particular to a rail damage detection method, device, computer equipment, computer-readable storage medium, and computer program product based on target detection. Background Art
[0002] Rail safety, as a core component of railway infrastructure, directly impacts operational safety. Monitoring and detecting rail damage is a critical task in railway maintenance. Traditional rail damage detection methods rely primarily on manual inspection or simple machine vision systems, suffering from low efficiency, insufficient accuracy, and difficulty handling minor damage in complex environments. In recent years, with the rapid development of image processing technology and deep learning, computer vision-based rail damage detection methods have gradually been adopted. However, these methods often miss or misdetect multiple types of damage, resulting in very low detection efficiency. Summary of the Invention
[0003] Based on this, it is necessary to provide a rail damage detection method, device, computer equipment, computer-readable storage medium and computer program product based on target detection to address the above technical problems.
[0004] In a first aspect, the present application provides a rail damage detection method based on target detection, comprising:
[0005] Acquire a rail image, and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image;
[0006] Obtaining a trained target detection model, determining multiple candidate damage regions in the processed rail image using the target detection model, and determining a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category;
[0007] The target detection model determines the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability, and aggregates the candidate damage areas of the same damage category to determine a target damage area and the damage category corresponding to the target damage area;
[0008] A rail damage detection result is obtained according to the target damaged area and the damage category corresponding to the target damaged area.
[0009] In one embodiment, determining the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability includes:
[0010] For each candidate damage area, calculating a damage confidence score for each damage category of the candidate damage area based on the target damage probability of the candidate damage area and each damage category probability, and determining a damage category of the candidate damage area based on each damage confidence score;
[0011] Obtaining a rail damage detection result according to the target damaged area and the damage category corresponding to the target damaged area includes:
[0012] The maximum damage confidence of the candidate damage areas in the target damage area is determined as the target damage confidence of the target damage area, and the target damage area and the damage category and the target damage confidence corresponding to the target damage area are used as the rail damage detection result.
[0013] In one embodiment, the target detection model is trained by the following steps:
[0014] Acquire a historical rail image with multiple damage category labels and target damage area labels, and determine the center positions of multiple damage targets in the historical rail image; the historical rail image includes multiple historical rail sub-images;
[0015] Extracting training fusion features of each of the historical rail sub-images using a target detection model to be trained, and determining a plurality of candidate training damage regions based on the training fusion features, the center position of the damage target, and a preset scaling factor; the preset scaling factor is used to indicate the boundaries of the damage region in the historical rail image;
[0016] Obtaining a training target damage region and a damage category corresponding to the training target damage region according to a training target damage probability and at least one training damage category probability determined for each of the candidate training damage regions;
[0017] According to the difference between the training target damage area and the target damage area label, and the difference between the damage category corresponding to the training target damage area and multiple damage category labels, the parameters of the target detection model to be trained are updated, and when the training end conditions are met, the trained target detection model is obtained.
[0018] In one embodiment, the determining of multiple training candidate damage regions based on the training fusion features, the damage target center position, and a preset scale factor includes:
[0019] Determining a plurality of intermediate damaged areas including at least one historical rail sub-image according to the plurality of damaged target center positions and the preset scale factor;
[0020] The historical rail sub-images of each intermediate damaged area are screened, and a plurality of candidate damaged areas for training are determined based on the screened historical rail sub-images that satisfy the training fusion feature indication of damage.
[0021] In one embodiment, performing image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image includes:
[0022] Determine each rail component in the rail image, and mark the regional background of the rail component with different colors to obtain a rail image with enhanced image background;
[0023] The processed rail image is obtained by performing blurring processing on the rail image after image background enhancement to enhance edge features of the rail image.
[0024] In one embodiment, determining a plurality of candidate damaged areas of the processed rail image by the object detection model includes:
[0025] Extracting image features from the processed rail image using the target detection model, and fusing the extracted multiple image features to obtain fused features;
[0026] Performing convolution processing on the fused features according to different damage sizes using multiple detection heads of the target detection model to generate a plurality of predicted feature maps of the damage sizes;
[0027] A plurality of candidate damage regions with different damage sizes are determined based on the predicted feature map.
[0028] In a second aspect, the present application further provides a rail damage detection device based on target detection, comprising:
[0029] An image preprocessing module is used to obtain a rail image and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image;
[0030] a target detection module, configured to obtain a trained target detection model, determine multiple candidate damage regions in the processed rail image using the target detection model, and determine a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category;
[0031] a damage classification and aggregation module, configured to determine, by the target detection model, the damage category corresponding to each candidate damage region based on the target damage probability and the damage category probability, and aggregate the candidate damage regions of the same damage category to determine a target damage region and the damage category corresponding to the target damage region;
[0032] The rail damage detection result determination module is used to obtain the rail damage detection result according to the target damage area and the damage category corresponding to the target damage area.
[0033] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0034] Acquire a rail image, and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image;
[0035] Obtaining a trained target detection model, determining multiple candidate damage regions in the processed rail image using the target detection model, and determining a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category;
[0036] The target detection model determines the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability, and aggregates the candidate damage areas of the same damage category to determine a target damage area and the damage category corresponding to the target damage area;
[0037] A rail damage detection result is obtained according to the target damaged area and the damage category corresponding to the target damaged area.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0039] Acquire a rail image, and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image;
[0040] Obtaining a trained target detection model, determining multiple candidate damage regions in the processed rail image using the target detection model, and determining a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category;
[0041] The target detection model determines the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability, and aggregates the candidate damage areas of the same damage category to determine a target damage area and the damage category corresponding to the target damage area;
[0042] A rail damage detection result is obtained according to the target damaged area and the damage category corresponding to the target damaged area.
[0043] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:
[0044] Acquire a rail image, and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image;
[0045] Obtaining a trained target detection model, determining multiple candidate damage regions in the processed rail image using the target detection model, and determining a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category;
[0046] The target detection model determines the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability, and aggregates the candidate damage areas of the same damage category to determine a target damage area and the damage category corresponding to the target damage area;
[0047] A rail damage detection result is obtained according to the target damaged area and the damage category corresponding to the target damaged area.
[0048] The above-mentioned target detection-based rail damage detection method, device, computer equipment, computer-readable storage medium and computer program product obtain a rail image, and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image; obtain a trained target detection model, and determine multiple candidate damage areas of the processed rail image through the target detection model, and determine the target damage probability and at least one damage category probability of each candidate damage area; the target damage probability is used to indicate the probability that damage exists in the candidate damage area; the damage category probability is used to indicate the probability that the damage in the candidate damage area belongs to the corresponding damage category; the target detection model determines the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability, and aggregates the candidate damage areas of the same damage category to determine the target damage area and the damage category corresponding to the target damage area; the rail damage detection result is obtained according to the target damage area and the damage category corresponding to the target damage area. In this application, by enhancing the background and edge features of rail images, the key features of different types of damage can be clearly highlighted, helping the target detection model to more accurately identify damage in each candidate damage area. On this basis, target damage probabilities and damage category probabilities are introduced for multiple candidate damage areas, providing each area with the probability of damage existing and the probability of belonging to a certain category. This allows the model to adaptively handle different types of damage during multi-category damage detection, avoiding the misjudgments and missed detections found in traditional methods, thereby improving detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 FIG. 1 is a diagram illustrating an application environment of a rail damage detection method based on target detection in one embodiment;
[0051] Figure 2 Schematic diagram of a process for training a target detection model in one embodiment;
[0052] Figure 3 A schematic diagram of the image preprocessing process in one embodiment;
[0053] Figure 4 is a flow chart of a rail damage detection method based on target detection in another embodiment;
[0054] Figure 51 is a structural block diagram of a rail damage detection device based on target detection in one embodiment;
[0055] Figure 6 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0057] In one embodiment, Figure 1 As shown, a rail damage detection method based on target detection is provided. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0058] Step S102: Acquire a rail image, and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image.
[0059] Exemplarily, the terminal acquires an image of the rail to be inspected. The rail image can be captured using an imaging device, including but not limited to an industrial camera, ultrasonic imager, or other compatible image acquisition device. After acquiring the rail image, the terminal further performs image processing on the rail image, including background enhancement and edge feature enhancement, to obtain a processed rail image for subsequent inspection.
[0060] Image background enhancement can include marking the image background based on different rail structural components to enhance the ability to distinguish different components during subsequent recognition. Alternatively, the terminal can assign distinguishable identification information to corresponding regions based on common rail structural features, such as the rail head, rail waist, and rail foot, to enhance the representation of location information.
[0061] Edge feature enhancement can include applying blurring or smoothing to the image to reduce the impact of local noise while highlighting the contours and boundaries of the rail image. Optionally, the terminal can adaptively select appropriate processing parameters based on the actual image resolution and noise level.
[0062] In step S104, a trained target detection model is obtained. Using the target detection model, multiple candidate damage areas of the processed rail image are determined, and a target damage probability and at least one damage category probability are determined for each candidate damage area. The target damage probability indicates the probability that damage exists in the candidate damage area, and the damage category probability indicates the probability that the damage in the candidate damage area belongs to a corresponding damage category.
[0063] Among them, the target detection model can be a deep learning model that can generate target area prediction and category discrimination output based on the input image. It can extract key feature information from the rail image and complete the preliminary screening of the damaged area; the candidate damaged area can be a set of spatial locations in the image that may have damage features output by the model; the target damage probability and damage category probability represent the existence evaluation and category attribute evaluation of the candidate area respectively, and the two are used together to support subsequent damage confirmation and classification decisions.
[0064] Exemplarily, the terminal acquires a trained object detection model. This model may be trained on a dataset containing rail damage images using a deep convolutional neural network, enabling automatic identification of potential damaged areas within rail images. Optionally, the object detection model utilizes a multi-detection head architecture capable of extracting and fusing image information at different feature scales to accommodate the diverse characteristics of rail damage at varying sizes and depths.
[0065] The rail image, which has undergone background enhancement and edge feature enhancement, is fed into the target detection model. The model extracts features from the image through its backbone network and generates preliminary predictions of candidate damage regions using feature maps at different scales. During the candidate region generation process, the terminal identifies multiple candidate damage regions based on the information output by the detection model and calculates the corresponding target damage probability and at least one damage category probability for each candidate region.
[0066] When determining candidate damage areas, there is a problem of inconsistent sample distribution (Out-of-Distribution, OOD) in actual detection scenarios, that is, there is a distribution difference between training samples and damage samples in the actual environment. Optionally, the target detection model of this embodiment introduces an adaptation mechanism for the OOD feature distribution, so that when performing candidate damage area detection, it not only focuses on damage features within the conventional distribution, but also can identify new damage patterns that may be abnormal outside the distribution. Specifically, when generating candidate areas, the terminal can allow areas with higher feature uncertainty to be retained to a certain extent to improve coverage of other damage types.
[0067] In step S106, the target detection model determines the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability, and aggregates the candidate damage areas of the same damage category to determine the target damage area and the damage category corresponding to the target damage area.
[0068] The target damaged area may be a damaged area specifically located in the rail image, determined through classification and aggregation processing; the damage category refers to the classification result corresponding to the target damaged area, used to identify the specific damage type to which the area belongs.
[0069] For example, based on the target damage probability and damage category probabilities output by the target detection model, the damage category of multiple candidate damage areas in the processed rail image is first determined. The target damage probability of each candidate damage area reflects the likelihood of damage in that area, while the damage category probabilities reflect the area's propensity to belong to different damage categories. Based on this probabilistic information, the terminal determines the optimal damage category for each candidate damage area, which serves as the classification basis for subsequent aggregation processing.
[0070] On this basis, all candidate damage regions are aggregated. Specifically, the terminal classifies multiple candidate damage regions with the same determined damage category into the same category and generates a final target damage region based on a certain aggregation strategy. Optionally, the aggregation strategy may include, but is not limited to: merging candidate regions based on their spatial proximity, i.e., when the distance between two or more candidate damage regions in the image space is less than a preset threshold, they are considered to belong to the same actual damage region; or fusing candidate regions based on their target damage probability and category consistency. When the category affiliation between candidate regions is highly consistent and the damage probability is above a certain threshold, they can be merged into a unified target region.
[0071] In some examples, the terminal can automatically cluster candidate regions of the same damage type using clustering algorithms, such as density clustering or connected domain-based methods, to spatially group candidate regions. This approach can accommodate the detection of complex damage morphologies. Optionally, after clustering, the terminal can perform post-processing on the generated target damage regions, such as filtering out false regions that are too small or have low confidence levels, to further improve the accuracy and practicality of the detection results.
[0072] Step S108: obtaining a rail damage detection result according to the target damaged area and the damage category corresponding to the target damaged area.
[0073] Exemplarily, the terminal regards each target damage area as an independent detection unit and associates a corresponding damage category with the area to form a basic entry of the detection result.
[0074] In the process of generating the detection results, structured output information can be organized and formed, which at least includes the location data of each target damage area (for example, expressed in the form of a rectangular box, a mask or a coordinate set) and the corresponding damage category identification.
[0075] Optionally, the detection results are classified and summarized according to the damage category, for example, the number, distribution and severity classification of each damage category in the entire rail image are counted, so as to determine the rail damage detection result based on the classification and summary results.
[0076] Optionally, the terminal can also generate a visual annotation map based on the detection results, overlaying the target damaged area on the original rail image with different colors or icons for manual review or further processing.
[0077] In this embodiment, background enhancement and edge feature enhancement are performed on rail images to clearly highlight the key features of different types of damage, helping the target detection model more accurately identify damage in each candidate damage area. Furthermore, target damage probabilities and damage category probabilities are introduced for multiple candidate damage areas, providing each area with the probability of damage presence and the probability of belonging to a specific category. This allows the model to adaptively handle different damage categories during multi-category damage detection, avoiding the misjudgments and missed detections common in traditional methods and improving detection efficiency.
[0078] In an exemplary embodiment, determining the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability includes:
[0079] For each candidate damage area, the damage confidence of the candidate damage area under each damage category is calculated based on the target damage probability of the candidate damage area and the probability of each damage category. Then, the damage category of the candidate damage area is determined based on each damage confidence.
[0080] Among them, the damage confidence can be two types of probability indicators: comprehensive target damage probability and damage category probability. The quantitative result of the specific confidence level under each damage category is used to determine the category affiliation.
[0081] Specifically, the terminal first extracts the target damage probability of the candidate damage area, which represents the overall likelihood of damage within the area. It also extracts the damage category probabilities for the candidate area under various preset damage categories, indicating the area's tendency to belong to different categories.
[0082] Subsequently, damage confidence is calculated for each damage category based on the target damage probability and the probability of each damage category. Alternatively, the damage confidence can be calculated using a multiplication method: multiplying the target damage probability by the corresponding damage category probability to provide the confidence score for the candidate region under that particular damage category. Other combined calculation methods, such as weighted averaging and additive fusion, can be used to adapt to the confidence assessment requirements of different application scenarios.
[0083] After calculating the damage confidence for each category, the category with the highest damage confidence is selected as the final damage category for the candidate damage area. In some examples, a minimum confidence threshold can be set. When the maximum confidence falls below this threshold, the candidate area is deemed invalid or uncertain, thereby improving the accuracy of the overall detection results.
[0084] In this embodiment, by combining the damage existence and category tendency, the reliability of each candidate damage area under different categories is comprehensively evaluated, so as to more accurately determine the damage category, improve the accuracy and reliability of rail damage detection classification, and reduce the risk of misjudgment or missed judgment due to uncertainty in category determination.
[0085] In an exemplary embodiment, obtaining a rail damage detection result based on the target damage area and the damage category corresponding to the target damage area includes:
[0086] The maximum damage confidence of the candidate damage areas in the target damage area is determined as the target damage confidence of the target damage area, and the target damage area and the damage category and target damage confidence corresponding to the target damage area are used as the rail damage detection result.
[0087] The target damage confidence can be a confidence quantified indicator representing the damage existence and severity assessment level of the entire target damage area, and is selected from the most credible candidate damage area within the area.
[0088] Specifically, for each target damage region, the terminal retrieves the damage confidence values of all candidate damage regions within that region and selects the maximum value as the target damage confidence for that target damage region. By using the maximum damage confidence as the final confidence for the target damage region, the most significant damage features within that region can be effectively highlighted, ensuring the representativeness and reliability of the detection results at the confidence level. Optionally, the corresponding damage category can be recorded when extracting the maximum confidence value to ensure a consistent association between the damage category and the confidence value.
[0089] Subsequently, each identified target damage area, its corresponding damage category, and the calculated target damage confidence level are combined as components of the detection results, which are then output as rail damage detection results. These rail damage detection results can be organized as structured data for subsequent display, analysis, or further processing.
[0090] In this embodiment, through the above steps, not only can the spatial and classification information of each target damage area be accurately output, but also a strength assessment of the damage presence can be provided based on the maximum confidence index, further improving the reliability of the detection results and helping to quickly locate and prioritize high-risk damage areas in subsequent maintenance decisions.
[0091] In an exemplary embodiment, the target detection model is trained by the following steps:
[0092] A historical rail image with multiple damage category labels and target damage area labels is obtained, and the center positions of multiple damage targets in the historical rail image are determined; the historical rail image includes multiple historical rail sub-images; the training fusion features of each historical rail sub-image are extracted through the target detection model to be trained, and multiple training candidate damage areas are determined based on the training fusion features, the center position of the damage target and the preset proportional coefficient; the preset proportional coefficient is used to indicate the damage area boundary of the damage in the historical rail image; based on the training target damage probability and at least one training damage category probability determined for each training candidate damage area, the training target damage area and the damage category corresponding to the training target damage area are obtained; based on the difference between the training target damage area and the target damage area label, and the difference between the damage category corresponding to the training target damage area and the multiple damage category labels, the parameters of the target detection model to be trained are updated, and when the training end condition is met, the trained target detection model is obtained.
[0093] Specifically, the entire training process is as follows Figure 2 As shown, in the initial stage of training, historical rail image data with target damage area labels and multiple damage category labels are obtained. The display form of the historical rail image data can be a B-display image. The image includes a complete image and multiple historical rail sub-images generated by region division. The rail sub-images can be represented by a grid during model training. Optionally, the width and height of each grid are , the normalized width and height of the target are defined as The relative target width and height in a specific grid are The center position of each damaged target is further extracted to locate the central reference point for generating the candidate area.
[0094] Subsequently, the trained object detection model performs feature extraction on the input image. The model's backbone network can employ a deep convolutional architecture (such as ResNet or DarkNet-53) to extract spatial hierarchical features from the image. Feature pyramid networks (FPNs) are then used to fuse features from both upper and lower levels, resulting in a final output with robust multi-scale feature integration. To accommodate damage areas of varying sizes, the model employs a three-layer detection head structure with varying scales, corresponding to the representation capabilities of the feature map at varying resolutions.
[0095] By combining the extracted training fusion features, the known damage center location, and a preset scaling factor, multiple candidate damage regions are generated for each damaged target. The preset scaling factor controls the coverage boundary of the candidate regions on the feature map, ensuring that the generated candidate regions reasonably encompass the actual damage area. Compared to traditional anchor frame mechanisms, this solution eliminates the reliance on fixed anchor frames and does not restrict the predicted target shape for each grid. This helps expand the target representation range and improves coverage of atypical damage.
[0096] For the generated training candidate damage areas, the model calculates the target damage probability and damage category probability. The target damage probability indicates whether there is damage in the area, and the damage category probability indicates the tendency of the area to belong to a specific damage type. On each grid in the candidate area, the model outputs its corresponding existence score and classification scores for each category , and is nonlinearly normalized using the sigmoid function to form the final probability output. The final score vector output by the model can be expressed as formula (1), which indicates the maximum confidence level of the damage category in the current rail image based on the comprehensive consideration of the target damage probability and the damage category probability, and serves as one of the training detection output results.
[0097]
[0098] in, Used to indicate different types of damage.
[0099] In order to take into account the detection capability of out-of-distribution samples (OOD), the model structure not only relaxes the restriction of candidate areas by setting a preset scale coefficient, allowing multiple categories to coexist on the same grid, so that the model still has a certain recognition capability when dealing with unseen types of damage, but also further calculates the OOD score of each historical rail image by formula (2) without increasing the training image data. Based on the OOD score, it is judged whether the historical rail image to be trained belongs to OOD data. If it belongs to OOD data, it is marked and the marked OOD data is re-input into the target detection model to be trained for model training.
[0100]
[0101] In terms of loss function design, the model training objectives include two aspects: target existence judgment and category determination, as shown in formula (3).
[0102]
[0103] in, is an existential loss, is the classification loss.
[0104] The binary cross entropy loss function (BCE) is used to calculate the existence loss and classification loss , which can be calculated by formula (4) and formula (5) respectively.
[0105]
[0106]
[0107] in, It is the sample score of the historical rail sub-image, which can be 1 or 0 to indicate whether the current historical sub-image has target damage. It is the score of the damage of the corresponding damage category appearing in the historical rail sub-image, and can be indicated by 1 or 0 whether the damage of the current corresponding damage category appears in the rail historical sub-image.
[0108] The loss function guides model parameter updates by measuring the deviation between candidate region predictions and true labels. Training uses stochastic gradient descent (SGD) with backpropagation to gradually converge to the optimal solution. The training process continues iteratively until a termination criterion is met, such as convergence of the validation set loss or completion of a preset number of training rounds, resulting in a fully trained object detection model.
[0109] In this embodiment, based on rich and well-annotated historical rail image data, targeted training candidate samples are constructed. Combined with feature extraction, probability prediction and difference assessment, the detection model parameters are continuously optimized, thereby obtaining a set of automatic rail damage detection models with high accuracy and good generalization ability, laying a solid foundation for subsequent practical deployment and application.
[0110] In an exemplary embodiment, multiple candidate training damage regions are determined based on the training fusion features, the center position of the damage target, and a preset scale factor, including:
[0111] Based on the center positions of multiple damage targets and preset proportional coefficients, multiple intermediate damage areas including at least one historical rail sub-image are determined; the historical rail sub-images of each intermediate damage area are screened, and based on the screened historical rail sub-images that meet the training fusion feature indication of damage, multiple training candidate damage areas are determined.
[0112] For example, the terminal first identifies multiple intermediate damage regions based on the center locations of multiple damage targets and their corresponding preset scaling factors. These intermediate damage regions are preliminary candidate spatial regions extending from the center of the damage target based on the scaling factors, encompassing the potential damage range. Each intermediate damage region can contain at least one historical rail sub-image to ensure the integrity of local features and the continuity of contextual information.
[0113] Specifically, in the candidate region generation process, in order to accurately define which grid cells can be used as prediction target points, the terminal generates a prediction result for each historical rail image. , apply the following formulas (6)-(7) to determine the position, assuming the target center point coordinates are , represents the position of the current target damage in the historical rail image, and the historical rail image is represented by a grid. In one embodiment, the width and height of each grid are , the normalized width and height of the target are defined as , corresponding to different coordinates , It is used to represent the location of the grid (historical rail sub-image) in the historical rail image. The relative target width and height in a specific grid are The output results of formulas (6)-(7) are used to determine the target of the grid through formula (8) to distinguish between positive and negative samples (existence labels). Negative samples are historical rail sub-images that do not include target damage and are part of the OOD data.
[0114]
[0115]
[0116]
[0117] In addition, each grid may be associated with multiple damage categories. Formula (9) is used to mark whether the damage of the corresponding damage category is located in the historical rail sub-image, and the multi-category label is express.
[0118]
[0119] This enables each valid candidate region to be reasonably assigned an existence label and a multi-category label, thereby providing detailed and accurate supervision signals for subsequent loss function calculation and model training, and determining the intermediate damaged area.
[0120] After determining the intermediate damaged areas, a screening operation is performed on the historical rail sub-images contained in each intermediate area. The screening is performed based on the training fusion features, extracting the fusion feature representation of each historical rail sub-image and determining whether it has a key feature response indicating the presence of damage. Specifically, a feature response intensity threshold, a shape feature consistency index, or other discrimination conditions can be set. When a sub-image meets the preset judgment criteria in the fusion feature space, it is considered to contain valid damage information. The historical rail sub-images that meet the screening conditions are further determined as candidate damage areas for training and used for subsequent probability prediction and model optimization.
[0121] In this embodiment, a fusion feature discrimination mechanism is introduced when generating candidate training areas. It not only considers the spatial position but also comprehensively considers the local feature performance of the image, effectively eliminating noise areas and invalid samples, thereby greatly improving the quality and pertinence of the model training samples, and improving the accuracy and robustness of the finally trained target detection model in the actual rail damage identification task.
[0122] In an exemplary embodiment, performing image background enhancement and edge feature enhancement on a rail image to obtain a processed rail image includes:
[0123] The rail components in the rail image are identified, and the regional background of the rail components is marked with different colors to obtain a rail image with enhanced image background; the rail image with enhanced image background is blurred to strengthen the edge features of the rail image to obtain a processed rail image.
[0124] Specifically, the terminal obtains ultrasonic B-display images of the rail and determines the positional distribution of various rail components within the image, including key structural areas such as the rail head, rail web, and rail base. Traditional B-display images use a uniform black background (RGB values of [0,0,0]) and use lines to mark different locations. However, this representation method makes it difficult to fully convey spatial location information to the convolutional neural network, affecting the accuracy of damage detection. This embodiment uses different color coding methods to enhance the background of different rail component regions. Specifically, the background of the rail head region is set to RGB values of [201,174,255], the background of the rail web region is set to RGB values of [90,120,50], and the background of the rail base region is set to RGB values of [150,150,150]. This allows for intuitive distinction between different rail components within the B-display image. This approach allows the model to more effectively capture damage characteristics related to location information during training, compensating for the inherent limitations of convolutional neural networks in spatial perception.
[0125] Furthermore, certain fixed structural features present in ultrasonic B-display images can be individually labeled with background markers. In some embodiments, for 60-gauge rails, the rail waist screw holes are relatively fixed in position. A specific color marker can be applied to this area, with an RGB value set to [110, 90, 150]. This guides the model's learning process to identify screw hole-related features and helps distinguish between structural anomalies and actual damage.
[0126] After completing the background enhancement, the edge feature enhancement operation is further performed on the image. In this embodiment, a Gaussian filter is applied to the image for blurring, and the image details are moderately smoothed, retaining the overall shape contour and color distribution characteristics. In order to cope with the fact that during the playback of the rail B display data, the judgment of damage often depends on the comprehensive performance of the ultrasonic echo signal in multiple dimensions such as position, shape and color, and the information of a single echo point is not enough to accurately describe the damage characteristics. Specifically, Gaussian blurring can effectively weaken local noise and sharp corners, highlighting the continuity and boundary information of the damaged area. Since the convolutional neural network in the target detection model is prone to lose local edge features during the pooling and downsampling process, such as Figure 3 Compared with direct grayscale detection, fuzzy processing can enhance the transmission ability of shape and edge information in deep feature extraction, thereby improving the model's overall perception of damage morphology.
[0127] In this embodiment, the above steps can effectively enhance the expression of spatial position and structural features in the rail image, improve the model's ability to recognize damage features of different rail parts, and at the image detail level, enhance the continuity and stability of shape and edge features through fuzzy processing, thereby greatly improving the detection rate and classification accuracy of subsequent rail damage detection models.
[0128] In an exemplary embodiment, a plurality of candidate damaged regions of the processed rail image are determined by the target detection model, including:
[0129] The target detection model is used to extract image features from the processed rail images, and multiple extracted image features are fused to obtain fused features. The fused features are convolved according to different damage sizes using multiple detection heads of the target detection model to generate predicted feature maps of multiple damage sizes. Based on the predicted feature maps, multiple candidate damage areas of different damage sizes are determined.
[0130] Among them, the fused features can be image feature maps generated through the feature pyramid fusion mechanism, which have both spatial details and high-order semantic characteristics; the predicted feature maps can be multi-channel output feature maps generated by convolution operations of different scales on the basis of the fused features, which are used to represent the detection results of damage of different sizes.
[0131] Specifically, the terminal inputs the preprocessed rail image into the object detection model, which uses the model's built-in backbone network to perform layer-by-layer feature extraction on the input image, generating multi-scale intermediate feature maps. The backbone network can be a deep convolutional network, such as the ResNet or DarkNet architecture, which effectively captures local edges, overall contours, and structural pattern features in rail images.
[0132] After completing initial feature extraction, image features at multiple scales are further fused. This feature fusion can be performed using a feature pyramid network (FPN) mechanism. Through bottom-up lateral connections, it combines high-level semantic information with low-level, fine-grained information, generating a fused feature map rich in contextual semantics and spatial detail. This fused feature map preserves both local details and global contour information, facilitating subsequent detection of damaged areas of varying sizes.
[0133] Based on the fused feature map, further processing is performed through multiple detection heads in the target detection model. Each detection head is responsible for detecting damaged targets within a specific size range, and can correspond to convolutional feature maps of different step sizes, such as 32×32, 16×16, and 8×8 size levels. Convolution operations are performed on the detection heads of each size layer to generate predicted feature maps for small, medium, and large damages respectively. The size of the final predicted feature map can be The predicted feature map encodes the location of potential damage areas at different spatial scales ( ), existence and category tendency information ( ), different prediction feature maps can be convolved with feature maps to output prediction feature maps with different M values.
[0134] Subsequently, based on the output of the predicted feature maps for each size, multiple candidate damage regions of varying sizes are determined. Specifically, for each size feature map, blocks of areas likely to contain damage are extracted, and a preliminary set of candidate boxes is generated based on location indices and probabilistic confidence scores. Optionally, to improve detection accuracy, redundant suppression can be performed on candidate regions generated for the same damage target at different sizes, such as using a non-maximum suppression algorithm to retain the prediction with the highest confidence.
[0135] In this embodiment, by extracting image feature information of different sizes based on fusion features, efficient detection of rail damage targets of different sizes is achieved, and the model's perception and recognition capabilities of small-sized and complex-shaped damage are enhanced.
[0136] In an illustrative example, the present application provides Figure 4 The process shown in FIG. 1 is used to realize damage detection and identification of rail images.
[0137] Specifically, first obtain the historical rail image data of the ultrasonic B display of the rail. The image is collected by imaging equipment installed on the inspection vehicle or track line, and contains ultrasonic echo information of different parts of the rail, such as the rail head, rail waist, and rail bottom.
[0138] In order to improve the subsequent detection accuracy, the terminal performs image background enhancement and edge feature enhancement on the original rail image to obtain a processed rail image.
[0139] Specifically, the terminal identifies each structural component in the rail image and assigns different background color codes based on the location of the rail head, rail waist, and rail foot. The rail head region is assigned RGB values of [201, 174, 255], the rail waist region is assigned RGB values of [90, 120, 50], and the rail foot region is assigned RGB values of [150, 150, 150]. This allows for intuitive distinction between different parts of the image and enhances the ability to express spatial location information. Furthermore, for areas known to contain fixed structural features (such as rail waist screw holes), the terminal uses RGB values of [110, 90, 150] to guide the model in learning the specific distribution of these structures.
[0140] After background enhancement, the terminal applies Gaussian blur to the image, using a convolution filter to reduce local sharp features while preserving overall shape, color, and boundary information. This process mitigates edge information loss during downsampling in convolutional neural networks and improves the subsequent target model's overall perception of damage morphology.
[0141] The enhanced rail image data is used to train the object detection model. Complete images with multiple damage category labels and target damage area labels are extracted from the historical rail image data. The large image is then divided into multiple historical rail sub-images. For each damaged target, the center coordinates are recorded as a reference for subsequent candidate region generation. The historical rail sub-images are input into the object detection model, and multi-scale features are extracted using the backbone network. The extracted features at different levels are fused using a feature pyramid network to generate a fused feature map rich in context and spatial detail.
[0142] Based on the trained fusion features, the damaged target's center location, and a preset scale factor, multiple intermediate damaged regions are identified. To determine whether a grid cell is a candidate target point, the relative horizontal and vertical distances between the grid cell and the target center point are calculated based on the target center point location and scale factor, and whether they are within a certain expansion range is determined. Grid cells that meet the criteria are marked as target-predictable cells, and the corresponding category label is further assigned within the cell.
[0143] On this basis, the historical sub-images in the intermediate damage area are screened in combination with the training fusion features, and only those sub-images indicating the presence of damage in the feature response are retained as the formal training candidate damage areas.
[0144] The loss function consists of two components: the target existence loss, which measures the difference between the candidate region and the actual damage region; and the damage classification loss, which measures the difference between the predicted and true categories. The sum of these two losses constitutes the overall loss.
[0145] During training, the stochastic gradient descent method is used to iteratively optimize model parameters, gradually approaching optimal performance on the training set. When the training end conditions are met, such as the validation set loss convergence or the number of training rounds reaches the set value, the object detection model training is completed.
[0146] Before using the trained target detection model for image inference and prediction, the actual rail image data of the rail ultrasonic B display is collected. This image can be drawn using the echo data collected by imaging equipment deployed on the inspection vehicle or track line. The actual rail image is then subjected to the same data enhancement (background enhancement and data blurring) as the preprocessing of historical rail images to obtain the preprocessed actual rail image.
[0147] The trained object detection model performs inference detection on the pre-processed actual rail images. The terminal inputs the processed rail images into the object detection model for inference detection. First, the backbone network extracts multi-layer features, and then the feature pyramid network performs feature fusion to obtain a unified multi-scale fusion feature map.
[0148] The terminal uses multiple detection heads to perform convolution processing on fused features of different scales to generate predicted feature maps of damaged targets of different sizes. These detection heads are respectively adapted to the needs of small, medium, and large-scale damage detection. Based on the predicted feature maps of each scale, the terminal extracts candidate areas where damage may exist. Based on the target damage probability and multiple damage category probabilities of each candidate area, the terminal calculates the comprehensive score for different categories and selects the category with the highest score as the preliminary classification result for the candidate area. The terminal aggregates multiple candidate areas with the same damage category and spatial proximity to form a unified target damage area, and uses the highest internal confidence as the target confidence of the target damage area.
[0149] Finally, the damage detection results of the actual rail image are output. The terminal outputs the location, damage category, and damage confidence level of each target damage area, forming the rail damage detection result. Optionally, the terminal can generate an image annotated with the detection results for manual review or for direct system application in subsequent maintenance management.
[0150] In this embodiment, the internal damage of the rail is automatically located and identified through the above steps, which can effectively reduce the problem of underreporting of damage defects caused by inconsistent data distribution and poor sample feature expression ability, significantly improve the detection rate in the field of intelligent identification of rail flaw detection, and enhance the operational efficiency of rail safety maintenance and care.
[0151] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0152] Based on the same inventive concept, embodiments of the present application also provide a rail damage detection device for implementing the aforementioned target detection-based rail damage detection method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more of the following embodiments of the rail damage detection device based on target detection can be found in the aforementioned limitations of the target detection-based rail damage detection method and will not be further elaborated here.
[0153] In an exemplary embodiment, Figure 5 As shown, a rail damage detection device based on target detection is provided, comprising: an image preprocessing module 510, a target detection module 520, a damage classification and aggregation module 530, and a rail damage detection result determination module 540, wherein:
[0154] An image preprocessing module 510 is used to acquire a rail image and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image;
[0155] The target detection module 520 is configured to obtain a trained target detection model and, using the target detection model, determine multiple candidate damage regions in the processed rail image and determine a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category.
[0156] The damage classification and aggregation module 530 is configured to determine the damage category corresponding to each candidate damage region based on the target damage probability and the damage category probability by the target detection model, and to aggregate the candidate damage regions of the same damage category to determine a target damage region and the damage category corresponding to the target damage region;
[0157] The rail damage detection result determination module 540 is configured to obtain a rail damage detection result based on the target damage area and the damage category corresponding to the target damage area.
[0158] In an exemplary embodiment, the damage classification and aggregation module 530 is further used to: for each candidate damage area, calculate the damage confidence of the candidate damage area under each damage category based on the target damage probability of the candidate damage area and the probability of each damage category, and determine the damage category of the candidate damage area based on each damage confidence.
[0159] In an exemplary embodiment, the rail damage detection result determination module 540 is further used to: determine the maximum damage confidence of the candidate damage area in the target damage area as the target damage confidence of the target damage area, and use the target damage area and the damage category and the target damage confidence corresponding to the target damage area as the rail damage detection result.
[0160] In an exemplary embodiment, the target detection module 520 is further used to: obtain a historical rail image with multiple damage category labels and target damage area labels, and determine multiple damage target center positions of the historical rail image; the historical rail image includes multiple historical rail sub-images; extract training fusion features of each of the historical rail sub-images through the target detection model to be trained, and determine multiple training candidate damage areas based on the training fusion features, the damage target center position and a preset proportional coefficient; the preset proportional coefficient is used to indicate the damage area boundary of the damage in the historical rail image; obtain a training target damage area and a damage category corresponding to the training target damage area based on the training target damage probability and at least one training damage category probability determined for each of the training candidate damage areas; update the parameters of the target detection model to be trained based on the difference between the training target damage area and the target damage area label, and the difference between the damage category corresponding to the training target damage area and multiple damage category labels, and obtain the trained target detection model when the training end condition is met.
[0161] In an exemplary embodiment, the target detection module 520 is further used to: determine a plurality of intermediate damaged areas including at least one historical rail sub-image based on the center positions of the plurality of damaged targets and the preset proportional coefficient; filter the historical rail sub-images of each of the intermediate damaged areas, and determine a plurality of the training candidate damaged areas based on the filtered historical rail sub-images that meet the training fusion feature indication of the presence of damage.
[0162] In an exemplary embodiment, the image preprocessing module 510 is further used to: determine each rail component in the rail image, and perform different color marking processing on the regional background of the rail component to obtain a rail image with enhanced image background; and blur the rail image with enhanced image background to enhance the edge features of the rail image to obtain the processed rail image.
[0163] In an exemplary embodiment, the target detection module 520 is further used to: extract image features from the processed rail image through the target detection model, and perform feature fusion on the extracted multiple image features to obtain fused features; perform convolution processing on the fused features according to different damage sizes through multiple detection heads of the target detection model to generate multiple predicted feature maps of the damage sizes; and determine multiple candidate damage areas of different damage sizes based on the predicted feature maps.
[0164] Each module in the aforementioned target detection-based rail damage detection device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a computer device memory in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0165] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via wired or wireless communication. The wireless communication can be achieved via Wi-Fi, a mobile cellular network, near field communication (NFC), or other technologies. When executed by the processor, the computer program implements a rail damage detection method based on target detection.
[0166] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0167] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0168] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0169] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0170] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0171] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0172] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0173] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A rail damage detection method based on target detection, characterized in that: The method comprises: Acquire a rail image, and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image; Obtaining a trained target detection model, determining multiple candidate damage regions in the processed rail image using the target detection model, and determining a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category; The target detection model determines the damage category corresponding to each candidate damage area based on the target damage probability and the damage category probability, and aggregates the candidate damage areas of the same damage category to determine a target damage area and the damage category corresponding to the target damage area; A rail damage detection result is obtained according to the target damaged area and the damage category corresponding to the target damaged area.
2. The method according to claim 1, characterized in that The determining, based on the target damage probability and the damage category probability, a damage category corresponding to each candidate damage area includes: For each candidate damage area, calculating a damage confidence score for each damage category of the candidate damage area based on the target damage probability of the candidate damage area and each damage category probability, and determining a damage category of the candidate damage area based on each damage confidence score; Obtaining a rail damage detection result according to the target damaged area and the damage category corresponding to the target damaged area includes: The maximum damage confidence of the candidate damage areas in the target damage area is determined as the target damage confidence of the target damage area, and the target damage area and the damage category and the target damage confidence corresponding to the target damage area are used as the rail damage detection result.
3. The method according to claim 1, characterized in that The target detection model is trained through the following steps: Acquire a historical rail image with multiple damage category labels and target damage area labels, and determine the center positions of multiple damage targets in the historical rail image; the historical rail image includes multiple historical rail sub-images; Extracting training fusion features of each of the historical rail sub-images through the target detection model to be trained, and determining a plurality of training candidate damaged areas based on the training fusion features, the center position of the damaged target, and a preset scale factor; The preset proportional coefficient is used to indicate the boundary of the damaged area of the damage in the historical rail image; Obtaining a training target damage region and a damage category corresponding to the training target damage region according to a training target damage probability and at least one training damage category probability determined for each of the candidate training damage regions; According to the difference between the training target damage area and the target damage area label, and the difference between the damage category corresponding to the training target damage area and multiple damage category labels, the parameters of the target detection model to be trained are updated, and when the training end conditions are met, the trained target detection model is obtained.
4. The method according to claim 3, characterized in that The step of determining a plurality of candidate training damage areas based on the training fusion features, the center position of the damage target, and a preset scale factor includes: Determining a plurality of intermediate damaged areas including at least one historical rail sub-image according to the plurality of damaged target center positions and the preset scale factor; The historical rail sub-images of each intermediate damaged area are screened, and a plurality of candidate damaged areas for training are determined based on the screened historical rail sub-images that satisfy the training fusion feature indication of damage.
5. The method according to claim 1, wherein The performing image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image includes: Determine each rail component in the rail image, and mark the regional background of the rail component with different colors to obtain a rail image with enhanced image background; The processed rail image is obtained by performing blurring processing on the rail image after image background enhancement to enhance edge features of the rail image.
6. The method according to any one of claims 1 to 5, characterized in that Determining a plurality of candidate damaged areas of the processed rail image by the target detection model includes: Extracting image features from the processed rail image using the target detection model, and fusing the extracted multiple image features to obtain fused features; Performing convolution processing on the fused features according to different damage sizes using multiple detection heads of the target detection model to generate a plurality of predicted feature maps of the damage sizes; A plurality of candidate damage regions with different damage sizes are determined based on the predicted feature map.
7. A rail damage detection device based on target detection, characterized in that: The device comprises: An image preprocessing module is used to obtain a rail image and perform image background enhancement and edge feature enhancement on the rail image to obtain a processed rail image; a target detection module, configured to obtain a trained target detection model, determine multiple candidate damage regions in the processed rail image using the target detection model, and determine a target damage probability and at least one damage category probability for each candidate damage region; the target damage probability indicates the probability that damage exists in the candidate damage region; and the damage category probability indicates the probability that damage in the candidate damage region belongs to a corresponding damage category; a damage classification and aggregation module, configured to determine, by the target detection model, the damage category corresponding to each candidate damage region based on the target damage probability and the damage category probability, and aggregate the candidate damage regions of the same damage category to determine a target damage region and the damage category corresponding to the target damage region; The rail damage detection result determination module is used to obtain the rail damage detection result according to the target damage area and the damage category corresponding to the target damage area.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.