A method for training a kilometer marker detection model, a kilometer marker detection method and device

By optimizing the kilometer marker detection model using 1-IoU distance and CIoU-NWD loss function, the problem of insufficient detection accuracy in complex backgrounds is solved, and the reliability of train position positioning is improved.

CN122265759APending Publication Date: 2026-06-23SHUOHUANG RAILWAY DEV +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHUOHUANG RAILWAY DEV
Filing Date
2026-02-03
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing kilometer marker detection technologies perform poorly under complex background conditions, resulting in insufficient accuracy and reliability in train positioning.

Method used

The true detection box size is clustered using 1-IoU distance to generate a prior box template that matches the true detection box. The preset model is then optimized using the CIoU-NWD loss function. The preset model is used to determine the predicted detection box in the sample image that matches the size of the prior box template.

Benefits of technology

The accuracy of the kilometer marker detection model under complex background conditions has been improved, and the reliability of train positioning during operation has been enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122265759A_ABST
    Figure CN122265759A_ABST
Patent Text Reader

Abstract

The application relates to a training method of a kilometer marker detection model, a kilometer marker detection method and device. The training method comprises the following steps: acquiring a sample image; wherein the sample image is labeled with a real detection frame of a kilometer marker, and the sample image is determined according to an environment image of an environment in front of a train along a driving direction in a train driving process; a 1-IoU distance is used to perform size clustering on the real detection frame to obtain a prior frame template matched with the size of the real detection frame, and a preset model to be trained is initialized according to the prior frame template; the sample image is input into the preset model, so that the preset model determines a predicted detection frame of the kilometer marker matched with the size of the prior frame template in the sample image; according to a CIoU-NWD loss function of the preset model, the error between the real detection frame and the predicted detection frame is determined, and the model parameters of the preset model are optimized according to the error. The method can improve the detection effect of the image under the complex background condition and improve the detection precision of the kilometer marker.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of railway transportation, and in particular to a training method for a kilometer marker detection model, a kilometer marker detection method, and an apparatus. Background Technology

[0002] With the rapid development of the railway transportation industry, especially the widespread application of heavy-haul trains, the requirements for the accuracy of train positioning during operation are becoming increasingly stringent. Traditional manual recording and inspection methods can no longer meet the demands of efficient and safe operation of modern trains. Therefore, developing automatic detection methods for kilometer markers has become an important research direction in the railway industry.

[0003] Currently, existing kilometer marker detection technologies mainly rely on computer vision and image processing technologies, combined with artificial intelligence algorithms to achieve automated detection. They utilize pre-trained machine learning or deep learning models to detect kilometer markers in images in order to locate the position of trains during operation.

[0004] However, since heavy-haul trains usually operate in harsh natural environments, the images used for kilometer marker detection often have complex backgrounds. Existing kilometer marker detection technologies are not very effective in detecting images under complex background conditions, resulting in poor kilometer marker detection accuracy and consequently, poor reliability of train positioning during operation. Summary of the Invention

[0005] Therefore, it is necessary to provide a training method for a kilometer marker detection model, a kilometer marker detection method and device to address the above-mentioned technical problems, improve the detection effect on images under complex background conditions, improve the detection accuracy of kilometer markers, and thus improve the reliability of train positioning during operation.

[0006] Firstly, this application provides a training method for a kilometer marker detection model, including:

[0007] Acquire sample images; wherein the sample images are marked with real detection boxes of kilometer markers, and the sample images are determined based on the environmental images of the environment in front of the train along the direction of travel during the train's journey;

[0008] The true detection boxes are clustered by size using 1-IoU distance to obtain prior box templates that match the size of the true detection boxes, and the preset model to be trained is initialized based on the prior box templates.

[0009] The sample image is input into the preset model so that the preset model can determine the predicted detection box of the kilometer marker in the sample image that matches the size of the prior box template.

[0010] Based on the CIoU-NWD loss function of the preset model, the error between the actual detection box and the predicted detection box is determined, and the model parameters of the preset model are optimized based on the error.

[0011] In one embodiment, optimizing the model parameters of a preset model based on the error includes:

[0012] If the error exceeds the preset error threshold, optimize the model parameters of the preset model based on the error, and return to the step of inputting the sample image into the preset model.

[0013] If the error is not greater than the preset error threshold, the current preset model will be determined as the kilometer marker detection model.

[0014] In one embodiment, a preset model performs a process in a sample image to determine a predicted detection box for a kilometer marker that matches the size of a prior bounding box template, including:

[0015] The backbone network of the pre-defined model extracts image features from sample images based on an attention mechanism;

[0016] The neck network of the pre-defined model performs multi-scale fusion of image features to obtain feature maps at different scales;

[0017] The detection head of the preset model determines the predicted detection box of the kilometer marker that matches the size of the prior box template in the feature map.

[0018] In one embodiment, initializing the preset model to be trained based on the prior bounding box template includes:

[0019] Based on the feature map size corresponding to each detection head of the prediction model to be trained, and the prior box template size corresponding to each feature map size, determine the prior box template size corresponding to each detection head.

[0020] The detection head performs operations on the feature map to determine the predicted detection boxes for kilometer markers that match the prior box template size, including:

[0021] Each detection head determines the predicted detection box of the kilometer marker that matches the size of the corresponding prior box template in the feature map of its corresponding feature map size.

[0022] In one embodiment, the detection head of the preset model includes a detection head with 4x downsampling.

[0023] In one embodiment, acquiring a sample image includes:

[0024] Acquire environmental images of the environment in front of the train along the direction of travel during the train's journey;

[0025] The environmental image is normalized to obtain an initial image;

[0026] The initial image is preprocessed; wherein, the image preprocessing includes at least image denoising and / or normalization.

[0027] The ground truth detection bounding boxes of kilometer markers are marked in the initial image after image preprocessing to obtain backup images, and the sample images are determined based on the backup images.

[0028] In one embodiment, determining the sample image based on the backup image includes:

[0029] Use the backup image as the sample image; and / or,

[0030] The backup image is subjected to data augmentation processing, and the data-augmented image is determined as the sample image; wherein the data augmentation processing includes at least one of rotation, flipping, noise addition, color change and weather simulation.

[0031] Secondly, this application also provides a kilometer marker detection method, including:

[0032] Acquire the image to be detected; wherein, the image to be detected is determined based on the environmental image of the environment in front of the train along the direction of travel during the target train's movement;

[0033] The image to be detected is input into the kilometer marker detection model to obtain the location information of the kilometer markers in the image to be detected; wherein the kilometer marker detection model is determined according to the method of any of the method embodiments provided in the first aspect above.

[0034] Thirdly, this application also provides a training device for a kilometer marker detection model, comprising:

[0035] The sample acquisition module is used to acquire sample images; the sample images are marked with real detection boxes of kilometer markers, and the sample images are determined based on the environmental images of the environment in front of the train along the direction of travel during the train's journey.

[0036] The model initialization module is used to perform size clustering on the real detection boxes using 1-IoU distance to obtain prior box templates that match the size of the real detection boxes, and to initialize the preset model to be trained based on the prior box templates.

[0037] The prediction box generation module is used to input sample images into a preset model so that the preset model can determine the predicted detection box of the kilometer marker in the sample image that matches the size of the prior box template.

[0038] The model optimization module is used to determine the error between the actual detection box and the predicted detection box based on the CIoU-NWD loss function of the preset model, and optimize the model parameters of the preset model based on the error.

[0039] Fourthly, this application also provides a kilometer marker detection device, comprising:

[0040] The image acquisition module is used to acquire the image to be detected; wherein, the image to be detected is determined based on the environmental image of the environment in front of the train along the direction of travel during the target train's movement.

[0041] The kilometer marker detection module is used to input the image to be detected into the kilometer marker detection model to obtain the location information of the kilometer markers in the image to be detected; wherein the kilometer marker detection model is determined according to the method of any of the method embodiments provided in the first aspect above.

[0042] Fifthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the various method embodiments provided in the first and / or second aspects described above.

[0043] In a sixth aspect, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the various method embodiments provided in the first and / or second aspects described above.

[0044] In a seventh aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the various method embodiments provided in the first and / or second aspects described above.

[0045] The training method, apparatus, computer equipment, computer-readable storage medium, and computer program product for the aforementioned kilometer marker detection model first determine sample images of actual detection boxes marked with kilometer markers based on environmental images of the environment ahead of the train along the direction of travel. Then, the actual detection boxes are clustered by size using 1-IoU distance to obtain prior box templates that match the size of the actual detection boxes, and the preset model to be trained is initialized based on the prior box templates. Next, the sample images are input into the preset model so that the preset model can determine the predicted detection boxes of kilometer markers in the sample images that match the size of the prior box templates. Then, the error between the actual detection boxes and the predicted detection boxes is determined based on the CIoU-NWD loss function of the preset model, and the model parameters of the preset model are optimized based on the error. Thus, on the one hand, using 1-IoU distance to cluster the actual detection boxes by size in the sample images can improve the size matching degree between the prior box templates and the actual detection boxes of the kilometer markers, thereby improving the detection accuracy of the obtained kilometer marker detection model. On the other hand, by combining CIoU (Complete Intersection over Union) and NWD (Normalized Weighted Distance) metrics, a CIoU-NWD loss function is designed to measure the error between the ground truth detection box and the predicted detection box. This improves the prediction accuracy of the predicted detection box and makes the model more robust when handling kilometer marker detection boxes of different sizes. Based on this, by optimizing the prior box template and loss function of the original kilometer marker detection model using 1-IoU distance and CIoU-NWD loss function, the detection performance of the obtained kilometer marker detection model under complex background conditions can be improved, increasing the detection accuracy of kilometer markers and thus improving the reliability of train positioning during operation. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 A flowchart illustrating the training method for a kilometer marker detection model provided in some embodiments of this application;

[0048] Figure 2 A schematic diagram illustrating the process of determining a predicted detection box using a preset model provided in some embodiments of this application;

[0049] Figure 3A schematic diagram illustrating the process of acquiring sample images provided in some embodiments of this application;

[0050] Figure 4 A flowchart illustrating the training method for a kilometer marker detection model provided in other embodiments of this application;

[0051] Figure 5 A schematic flowchart illustrating the kilometer marker detection method provided in some embodiments of this application;

[0052] Figure 6 Structural block diagram of a training device for a kilometer marker detection model provided in some embodiments of this application;

[0053] Figure 7 Structural block diagrams of kilometer marker detection devices provided in some embodiments of this application;

[0054] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0056] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0057] Currently, existing kilometer marker detection technologies mainly rely on computer vision and image processing technologies, combined with artificial intelligence algorithms to achieve automated detection. They utilize pre-trained machine learning or deep learning models to detect kilometer markers in images in order to locate the position of trains during operation.

[0058] However, since heavy-haul trains usually operate in harsh natural environments, the images used for kilometer marker detection often have complex backgrounds. Existing kilometer marker detection technologies are not very effective in detecting images under complex background conditions, resulting in poor kilometer marker detection accuracy and consequently, poor reliability of train positioning during operation.

[0059] To address the aforementioned technical problems, in an exemplary embodiment, a method for training a kilometer marker detection model is provided. This method can be applied to a computer device, which can be a server or a terminal. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services; the terminal can be a train's onboard terminal, etc. The following explanation uses the application of this method to a server as an example. Figure 1 As shown, the method may include the following steps:

[0060] S101, Obtain the sample image.

[0061] The sample images are marked with real detection boxes for kilometer markers. The sample images are determined based on environmental images of the environment in front of the train along the direction of travel during the train's journey.

[0062] A train is a series of wagons equipped with locomotives and prescribed train markings. It is the main tool of railway transportation, such as passenger trains and freight trains. A heavy-haul train is an extra-long and extra-heavy freight train that is composed of large special freight cars and pulled by two or more locomotives on transportation lines with concentrated freight volume.

[0063] A kilometer marker (also known as a mileage marker) is a marking system used to identify the location of linear engineering projects such as roads, railways, and pipelines. It determines the specific location of a point within the overall line by using continuous mileage values. Train kilometer markers are important markers on railway lines used to identify positions, primarily for recording and representing the mileage of the line.

[0064] During train operation, the direction of travel can be considered as the front of the train. This allows for the acquisition of environmental images of the environment ahead along the direction of travel. Based on these environmental images, sample images containing actual detection boxes marked with kilometer markers can be determined. For example, the actual detection boxes for kilometer markers in the environmental images can be manually identified and marked, and the marked environmental images can then be used as sample images.

[0065] S102, use 1-IoU distance to perform size clustering on the real detection boxes to obtain prior box templates that match the size of the real detection boxes, and initialize the preset model to be trained based on the prior box templates.

[0066] IoU (Intersection over Union) is a metric used to assess the degree of overlap between two bounding boxes. It is calculated by dividing the area of ​​their intersection by the area of ​​their union, reflecting the proportion of overlap and thus measuring their similarity. The formula for calculating IoU is shown below:

[0067]

[0068] in, and This represents two different bounding boxes. Representing two different bounding boxes and The area of ​​intersection Representing two different bounding boxes and The area of ​​the union of the sets.

[0069] Understandably, if two bounding boxes completely overlap, then IoU = 1; if two bounding boxes do not overlap at all, then IoU = 0; and generally, the range of IoU is [0, 1]. The larger the IoU value of two bounding boxes, the higher the degree of overlap between the two bounding boxes, and therefore the more similar they are.

[0070] After obtaining the sample images, the size of the ground truth detection boxes labeled in the sample images can be determined. Therefore, the 1-IoU (1 minus Cross-Intersection over Union) distance can be used as a similarity metric to cluster the ground truth detection boxes by size, obtaining their size distribution. During clustering, the 1-IoU distance between each ground truth detection box and the cluster center of each class is calculated. This 1-IoU distance measures the similarity between each ground truth detection box and the cluster center of each class. The cluster centers in the final clustering result then serve as the prior box templates. Since the size distribution of the prior box templates matches the size distribution of the ground truth detection boxes, the obtained prior box templates match the size of the ground truth detection boxes. Optionally, the K-Means++ (K-means++) algorithm based on 1-IoU distance can be used to cluster the ground truth detection boxes by size.

[0071] Compared to existing kilometer marker detection technologies, using Euclidean distance for real-world bounding box size clustering and using 1-IoU distance for real-world bounding box size clustering are more effective in detecting the similarity of real-world bounding boxes. This allows for the acquisition of prior box templates that better match the real-world bounding box sizes, improving the matching degree between the prior box templates and the real-world bounding boxes, and ultimately enhancing the detection accuracy of the final kilometer marker detection model.

[0072] After obtaining the aforementioned prior bounding box template, the pre-set model to be trained can be initialized based on the prior bounding box template. Model initialization refers to guiding the model to learn the position and scale features of the target using predefined anchor box sizes and proportions. Therefore, initializing the pre-set model to be trained based on the prior bounding box template means guiding the pre-set model to learn the position and size features of kilometer markers using the size and proportions of the prior bounding box template. This allows the pre-set model to perform kilometer marker position and size detection according to the size and proportions of the prior bounding box template when predicting kilometer marker detection boxes, thereby obtaining predicted detection boxes for kilometer markers that match the size of the prior bounding box template.

[0073] Optionally, the above-mentioned preset model can be any type of machine learning or deep learning model, such as YOLO (You Only Look Once, template detection model), R-CNN (Region-based Convolutional Neural Network), etc., without specific limitations.

[0074] S103, Input the sample image into the preset model so that the preset model can determine the predicted detection box of the kilometer marker in the sample image that matches the size of the prior box template.

[0075] By inputting the aforementioned sample images into a preset model, the preset model can predict kilometer markers within the sample images based on the aforementioned prior bounding box template, thereby determining the predicted detection boxes for kilometer markers that match the size of the prior bounding box template. Optionally, the preset model can extract image features from the sample images and synthesize these image features to obtain a feature map. The preset model can then extract the predicted detection boxes for kilometer markers that match the size of the prior bounding box template from the feature map.

[0076] S104. Based on the CIoU-NWD loss function of the preset model, determine the error between the actual detection box and the predicted detection box, and optimize the model parameters of the preset model based on the error.

[0077] As mentioned earlier, IoU is used to measure the degree of overlap between two bounding boxes, but when two bounding boxes do not intersect, the IoU value is zero, which cannot reflect the actual similarity between the two bounding boxes.

[0078] Based on this, CIoU (Complete Intersection over Union) is an extended form of IoU, used to improve the regression accuracy of bounding boxes in object detection tasks. IoU only measures the degree of overlap between two bounding boxes, and in some cases, even if the IoU values ​​of two bounding boxes are high, the distance between them may still be large, leading to inaccurate localization. CIoU, by comprehensively considering the overlapping area, center distance, and aspect ratio of the bounding boxes, more comprehensively evaluates the similarity between two bounding boxes. CIoU adds two additional metrics to IoU: center distance... and aspect ratio The center-to-center distance (CIoU) measures the Euclidean distance between the center points of two bounding boxes, while the aspect ratio measures the similarity of the shapes of the two bounding boxes. The formula for calculating CIoU is as follows:

[0079]

[0080] in, This represents the diagonal length of the smallest bounding box of the two bounding boxes. It is a balance factor used to weigh the importance of position and size. , It is a parameter used to quantify the consistency of the aspect ratio between the actual detection box and the predicted detection box. , It is the width of the actual detection frame. It is the height of the actual detection frame. It is the width of the predicted detection box. It is the height of the predicted detection box.

[0081] The Normalized Weighted Distance (NWD) loss function, compared to IoU and its extensions, provides smoother transitions due to small target location deviations, aiding in the accurate localization of predicted bounding boxes. NWD can also measure the similarity between bounding boxes, even when they contain each other or do not overlap. The NWD metric is based on the Wasserstein distance (also known as Earth Mover's Distance, EMD), which consistently reflects the distance between Gaussian distributions. It uses a two-dimensional Gaussian distribution to simulate bounding boxes and quantitatively evaluates the similarity between two bounding boxes by calculating the distance between two Gaussian distributions. The NWD loss function is shown in the following equation:

[0082]

[0083] in, Represents bounding box The probability density function of the simulated two-dimensional Gaussian distribution, Represents bounding box The probability density function of the simulated two-dimensional Gaussian distribution, Represents a two-dimensional real number space. It is a constant.

[0084] As mentioned earlier, combining the advantages of CIoU and NWD, a CIoU-NWD loss function was designed as the loss function for the preset model to adapt to the distribution of real detection box sizes in application scenarios and optimize the calculation of localization loss. The CIoU-NWD loss function integrates the characteristics of CIoU and NWD when calculating the error between the real and predicted detection boxes, making the final kilometer marker detection model more robust when handling kilometer marker targets of different sizes.

[0085] In this way, after obtaining the predicted detection box, the error between the real detection box and the predicted detection box can be determined according to the CIoU-NWD loss function of the preset model. Then, the model parameters of the preset model can be optimized according to the error. Thus, one iteration of training of the preset model is completed.

[0086] In an optional embodiment, in S104 above, the optimization method of the model parameters may be: if the error is greater than a preset error threshold, optimize the model parameters of the preset model according to the error and return to S103; if the error is not greater than the preset error threshold, determine the current preset model as the kilometer marker detection model.

[0087] Understandably, in model training, the model convergence condition is that the error between the predicted value and the true value is less than an error threshold. Based on this, in this embodiment, the model convergence condition of the aforementioned preset model can be that the error between the actual detection box and the predicted detection box, determined by the CIoU-NWD loss function of the preset model, is not greater than a preset error threshold. Therefore, if the error is determined to be less than the preset error threshold, the current preset model can be determined to meet the model convergence condition, and thus, the current preset model can be identified as the kilometer marker detection model, completing the model training. Conversely, if the error is determined to be greater than the preset error threshold, the current preset model can be determined to not meet the model convergence condition. Therefore, iterative training of the preset model is required. Thus, sample images can be input into the preset model again, and the above S103-S104 can be repeated to perform multiple iterative trainings on the preset model using sample images until the preset model meets the model convergence condition, obtaining the kilometer marker detection model, thus completing the model training. The aforementioned preset error threshold can be set based on empirical values, experimental values ​​from multiple trials, and the detection accuracy requirements in actual application scenarios, etc., and is not specifically limited in this regard.

[0088] The training method for the aforementioned kilometer marker detection model first determines sample images of actual detection boxes marked with kilometer markers based on environmental images of the train's path along the direction of travel. Then, the actual detection boxes are clustered by size using 1-IoU distance to obtain prior box templates that match the actual detection box sizes. The pre-set model to be trained is then initialized based on these prior box templates. Next, the sample images are input into the pre-set model, enabling it to determine predicted detection boxes for kilometer markers that match the prior box template sizes. The error between the actual and predicted detection boxes is then determined using the CIoU-NWD loss function of the pre-set model, and the model parameters are optimized based on this error. In this way, by using 1-IoU distance to cluster the actual detection boxes by size in the sample images, the size matching degree between the prior box templates and the actual kilometer marker detection boxes can be improved, thereby enhancing the detection accuracy of the obtained kilometer marker detection model. On the other hand, by combining CIoU (Complete Intersection over Union) and NWD (Normalized Weighted Distance) metrics, a CIoU-NWD loss function is designed to measure the error between the ground truth detection box and the predicted detection box. This improves the prediction accuracy of the predicted detection box and makes the model more robust when handling kilometer marker detection boxes of different sizes. Based on this, by optimizing the prior box template and loss function of the original kilometer marker detection model using 1-IoU distance and CIoU-NWD loss function, the detection performance of the obtained kilometer marker detection model under complex background conditions can be improved, increasing the detection accuracy of kilometer markers and thus improving the reliability of train positioning during operation.

[0089] Based on the above embodiments, in an exemplary embodiment, the determination of the predicted detection box by the preset model in S103 is further refined. Optionally, such as... Figure 2 As shown, it may include the following steps:

[0090] S201, the backbone network of the preset model extracts image features from sample images based on an attention mechanism.

[0091] In this embodiment, the preset model may include a backbone network, a neck network, and a head.

[0092] The backbone network of the pre-defined model is used to extract features from the input image, transforming the original image into a multi-layered feature map with rich semantic information. To enhance the feature extraction capability of the backbone network, an attention mechanism can be inserted. This allows the backbone network to extract image features from sample images based on the attention mechanism. Since the attention mechanism enables the backbone network to selectively focus its attention based on the current task requirements and contextual information, assigning different weights to different features, it can automatically focus on important features of the kilometer markers by learning these weights. This achieves more efficient and accurate learning, improving the detection performance of the final kilometer marker detection model.

[0093] Optionally, the backbone network of the preset model may include C3 modules. A C3 module consists of three convolutional layers and multiple bottleneck layers, increasing the depth and receptive field of the backbone network and improving feature extraction capabilities. The C3 module enhances the feature extraction capabilities of the backbone network while maintaining lightweight design through multi-branch feature fusion and residual connections. Furthermore, a SimAM (Similarity-Aware Activation Module) attention mechanism can be inserted into the residual structure of each C3 module to construct a C3Attention module with integrated attention mechanisms. In other words, the backbone network of the preset model has four C3 modules, named C3_1, C3_2, C3_3, and C3_4. In this embodiment, a single position of the C3Attention module is replaced in each of these four C3 modules, and the improved modules are named C3_1_Attention, C3_2_Attention, C3_3_Attention, and C3_4_Attention, respectively.

[0094] S202, the neck network of the preset model performs multi-scale fusion of image features to obtain feature maps of different scales.

[0095] The neck network of the pre-defined model performs multi-scale fusion of image features through top-down and bottom-up paths to obtain feature maps of different scales. For example, it can generate three feature maps of different scales (80×80, 40×40, and 20×20) to detect small, medium, and large targets respectively.

[0096] Optionally, the neck network of the preset model adopts a structure combining a Feature Pyramid Network (FPN) and a Path Aggregation Network (PAN). The FPN conveys strong semantic features from top to bottom, while the PAN conveys strong localization features from bottom to top. Through top-down upsampling, bottom-up downsampling, and convolution operations, feature maps at different levels obtained from the above image features are fused to generate a multi-scale feature pyramid. The fused multi-scale feature map is then passed to the detection head to generate predicted detection boxes.

[0097] S203, the detection head of the preset model determines the predicted detection box of the kilometer marker that matches the size of the prior box template in the feature map.

[0098] The detection head of the pre-defined model predicts the category, location, and confidence level of kilometer markers by performing convolution operations on the received feature maps. Specifically, the detection head can pre-define anchor boxes that match the size of a priori bounding box template. These anchor boxes are then used to determine candidate boxes in the feature maps. The detection head then adjusts the position and size of these candidate boxes through a regression branch to obtain the predicted detection boxes.

[0099] Optionally, to improve the detection capability of the final kilometer marker detection model for kilometer markers of different sizes, especially for small-sized kilometer markers, a 4x downsampling detection head (small-scale detection head P2) can be added to the preset model. This head is specifically designed for detecting small-sized kilometer markers with a resolution of less than 64 pixels. The feature map resolution of the 4x downsampling detection head is 160×160, and the receptive field of each grid is 4×4. This expands the network depth of the preset model, enabling it to extract richer multi-scale features and enhancing the adaptability of the final kilometer marker detection model to multi-scale data distributions in complex environments.

[0100] In this embodiment, the performance of the preset model can be improved by introducing an attention mechanism and multi-scale fusion of image features, thereby improving the detection performance of the final kilometer marker detection model.

[0101] Based on the above embodiments, in an exemplary embodiment, the initialization of the preset model in S102 is further refined. In S102, the initialization method of the preset model may be to determine the prior box template size corresponding to each detection head according to the feature map size corresponding to each detection head of the prediction model to be trained and the prior box template size corresponding to each feature map size.

[0102] Understandably, each detection head in the pre-defined model corresponds to only one specific scale feature, rather than predicting feature maps of all sizes to obtain predicted detection boxes. Accordingly, each detection head predicts multiple sizes of predicted detection boxes on a single feature map, and the scale of these detection boxes is determined by the size of the feature map corresponding to that detection head.

[0103] Based on this, in this embodiment, after obtaining the prior bounding box templates, the size distribution of the prior bounding box templates can be determined. Therefore, according to the feature map size corresponding to each detection head of the prediction model to be trained, and the prior bounding box template size corresponding to each feature map size, a prior bounding box template size is assigned to the detection heads of the preset model. Thus, the prior bounding box template size corresponding to each detection head can be determined. The prior bounding box template size corresponding to each detection head is the size that the predicted detection box determined by that detection head in the feature map of its corresponding single size needs to match.

[0104] Accordingly, in this embodiment, the method for determining the predicted detection box in S203 above may be that each detection head determines the predicted detection box of the kilometer marker that matches the size of the corresponding prior box template in the feature map of the corresponding feature map size.

[0105] In this embodiment, the neck network of the preset model outputs multiple feature maps through top-down upsampling fusion and bottom-up downsampling fusion. Each feature map is predicted separately using a corresponding detection head to obtain a predicted detection box that matches the size of the prior box template corresponding to that detection head. This allows for a more thorough fusion of shallow and deep features from the sample images, enabling the preset model to acquire more comprehensive feature information of small-sized kilometer markers across multiple scale detection heads, thus improving the detection performance of the final kilometer marker detection model for small-sized kilometer markers.

[0106] Based on the above embodiments, in an exemplary embodiment, the acquisition of sample images in S101 is further refined. Optionally, such as... Figure 3 As shown, it may include the following steps:

[0107] S301, acquire an environmental image of the environment in front of the train along the direction of travel during the train's journey.

[0108] As mentioned earlier, during train operation, the direction of train travel can be taken as the front of the train, thereby enabling the acquisition of environmental images of the environment in front of the train along the direction of travel.

[0109] Optionally, high-definition industrial-grade cameras can be used to acquire real-time environmental images of the path ahead of the train while it is in motion. These cameras feature high resolution, wide dynamic range, fast response, and excellent night vision capabilities. Mounted at the front of the train, they capture all important information within the forward field of view, ensuring clear and stable image sequences even at high speeds. Even when heavily loaded trains are operating in complex environments, the output images clearly show details such as the track, kilometer markers, and roadside facilities.

[0110] S302, Perform size normalization on the environmental image to obtain the initial image.

[0111] Typically, to enrich the sample images, the aforementioned environmental images may be acquired under various weather and lighting conditions using different camera models (e.g., different resolutions, frame rates, etc.). Therefore, the sizes of the acquired environmental images may be inconsistent and may not match the image sizes that the preset model can process. Based on this, after acquiring the environmental images, a size standardization operation can be performed to unify their sizes to a standard size, ensuring consistency between environmental images from different sources. This facilitates feature learning from the sample images during subsequent model training. The images obtained after size standardization can be used as initial images; all initial images have the same size, and this size matches the image sizes that the preset model can process.

[0112] S303, perform image preprocessing on the initial image.

[0113] Image preprocessing includes at least image denoising and / or normalization.

[0114] Image preprocessing directly affects the accuracy of feature extraction and kilometer marker detection from sample images during subsequent model training. Therefore, to improve the detection accuracy of the final kilometer marker detection model, image preprocessing can be performed on the initial images after unifying their dimensions. Furthermore, this image preprocessing can include at least image denoising and / or normalization.

[0115] Image denoising refers to eliminating interfering pixels or redundant information introduced into an image due to factors such as sensor noise, transmission interference, and uneven lighting, thereby improving image quality. For example, filtering techniques such as median filtering, Gaussian filtering, Poisson filtering, and frequency domain notch filtering are used to remove noise from images. Image noise (also known as image noise) refers to unexpected and interfering pixel value changes or random signals in an image, which degrade image quality and affect visual perception and subsequent analysis (such as image recognition and feature extraction). The generation of image noise is closely related to factors such as imaging equipment, environmental conditions, and the transmission process.

[0116] Image normalization refers to the process of applying linear or non-linear transformations to the pixel values ​​of an image to adjust them to a specific range or to meet a specific distribution (such as a mean of 0 and a variance of 1). This aims to eliminate pixel scale differences, improve the consistency of feature representation, and ultimately convert the image into an image format acceptable to a pre-defined model. For example, linear normalization, non-linear normalization, and normalization based on statistical properties can be used to normalize the initial image.

[0117] S304. Mark the true detection boxes of kilometer markers in the initial image after image preprocessing to obtain the backup image, and determine the sample image based on the backup image.

[0118] After image preprocessing of the initial image, kilometer markers can be annotated on the preprocessed image. This involves identifying the true kilometer markers in the image and marking them with detection boxes. These marked detection boxes can then be used as true detection boxes for the kilometer markers. Thus, after annotating the initial image with true detection boxes, the image with these boxes can be used as a backup image. The sample image can then be determined based on this backup image.

[0119] In an optional embodiment, in S204 above, the method for determining the sample image may be to determine a spare image as the sample image; and / or to perform data augmentation processing on the spare image and determine the data-augmented image as the sample image; wherein, the data augmentation processing includes at least one of rotation, flipping, noise addition, color change and weather simulation.

[0120] Optionally, the aforementioned spare images can be directly selected as sample images.

[0121] Optionally, to simulate various scenarios using sample images and allow the model to encounter more variations in the real detection boxes of kilometer markers during training, thereby improving the robustness and generalization ability of the final kilometer marker detection model in practical applications, data augmentation processing can be performed on the spare images to generate a series of new images as sample images. This data augmentation processing can include at least one of rotation, flipping, noise addition, color modification, and weather simulation. In this way, the resulting new images can include kilometer marker images from different viewpoints, sizes, lighting conditions, and weather conditions, thus enhancing the diversity of the sample images.

[0122] Optionally, the aforementioned backup images can be first selected as sample images to obtain a subset of sample images. Then, data augmentation processing can be performed on the backup images, and the augmented images can be selected as new sample images to obtain another subset of sample images. In this way, the final sample images used for model training include not only the backup images but also the images after data augmentation, thereby further enriching the diversity of sample images and improving the robustness and generalization ability of the final kilometer marker detection model in practical applications.

[0123] In this embodiment, by standardizing the size of the environmental images and performing image preprocessing, the accuracy of the model in feature extraction and kilometer marker detection of the sample images can be improved, thereby increasing the detection accuracy of the final kilometer marker detection model. Furthermore, by performing data augmentation on the backup images, the diversity of the sample images can be enriched, thereby improving the robustness and generalization ability of the final kilometer marker detection model in practical applications.

[0124] Based on the above embodiments, in an exemplary embodiment, such as Figure 4 As shown, the training method for this kilometer marker detection model may include the following steps:

[0125] S401, Obtain sample image.

[0126] S402, use 1-IoU distance to perform size clustering on the real detection boxes to obtain prior box templates that match the size of the real detection boxes.

[0127] S403, determine the prior box template size for each detection head based on the feature map size corresponding to each detection head of the prediction model to be trained, and the prior box template size corresponding to each feature map size.

[0128] S404, Input the sample image into the backbone network of the preset model so that the backbone network of the preset model can extract the image features of the sample image based on the attention mechanism.

[0129] S405, input the image features into the neck network of the preset model so that the neck network of the preset model can perform multi-scale fusion of the image features to obtain feature maps of different scales.

[0130] S406, input a feature map of the corresponding feature map size to each detection head of the preset model, so that each detection head can determine the predicted detection box of the kilometer marker that matches the size of the prior box template corresponding to the detection head in the received feature map.

[0131] S407, determine the error between the actual detection box and the predicted detection box based on the CIoU-NWD loss function of the preset model.

[0132] S408, if the error is greater than the preset error threshold, optimize the model parameters of the preset model according to the error, and return to execute S404.

[0133] S409, if the error is not greater than the preset error threshold, the current preset model is determined as the kilometer marker detection model.

[0134] The specific implementation methods of S401-S409 are the same as those in the above method embodiments, and will not be repeated here.

[0135] Based on the same inventive concept, this application also provides a kilometer marker detection method based on the training method of the kilometer marker detection model described above. This kilometer marker detection method can be applied to a computer device, which can be a server or a terminal. Specifically, when the method is applied to a server, the server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. When the method is applied to a terminal, the terminal can be a train's onboard terminal.

[0136] The following explanation uses the application of this kilometer marker detection method to a server as an example. Figure 5 As shown, the kilometer marker detection method may include the following steps:

[0137] S501, acquire the image to be detected.

[0138] The image to be detected is determined based on the environmental image of the environment in front of the train along the direction of travel during the train's journey.

[0139] The target train refers to a train that is in motion and requires kilometer marker inspection. The target train can be either a regular train or a heavy-haul train; there is no specific limitation in this regard.

[0140] During the movement of the target train, the direction of travel of the target train can be taken as the front of the train. Thus, during the movement of the target train, the environment in front of the train along the direction of travel can be collected to obtain an environmental image. Based on this environmental image, the image to be detected can be determined.

[0141] Optionally, the environmental image can be sized to obtain the image to be detected, so that the size of the obtained image to be detected matches the image size that the preset model can process.

[0142] Optionally, the environmental image can be normalized, and the normalized image can be preprocessed to obtain the image to be detected, thereby improving image quality and increasing the final detection accuracy. Image preprocessing includes at least image denoising and / or normalization.

[0143] S502, input the image to be detected into the kilometer marker detection model to obtain the location information of the kilometer markers in the image to be detected.

[0144] The aforementioned kilometer marker detection model is determined based on any embodiment of the training method for the kilometer marker detection model mentioned above.

[0145] After obtaining the image to be detected, the image can be input into the kilometer marker detection model trained by the above-mentioned kilometer marker detection model training method, thereby obtaining the kilometer marker location information in the image to be detected output by the kilometer marker detection model.

[0146] Optionally, the location information mentioned above can be the image coordinates of the kilometer marker in the image to be detected.

[0147] Optionally, the above-mentioned kilometer marker detection model can be equipped with a coordinate transformation module. Thus, after the kilometer marker detection model performs kilometer marker detection on the image to be detected and obtains the image coordinates of the kilometer marker in the image to be detected, it can combine the device perspective (such as camera perspective) of the image acquisition device used to acquire the environmental image used to generate the image to be detected to convert the above image coordinates into the coordinates of the kilometer marker in the world coordinate system (such as latitude and longitude). Thus, the above location information can be the coordinates (such as latitude and longitude) of the kilometer marker in the image to be detected in the real scene.

[0148] Optionally, under typical sunny daytime conditions, using a standard high-definition camera and computer hardware, the model was trained according to the training method of the kilometer marker detection model described above, verifying that the obtained kilometer marker detection model can accurately identify kilometer markers under ideal lighting conditions.

[0149] Optionally, to test the robustness of the system, the training method of the kilometer marker detection model described above was repeated in rainy or low-light environments at night to train the model. This verified that even under adverse weather conditions, the kilometer marker detection model still maintained high detection accuracy after appropriate data augmentation and technical optimization.

[0150] Optionally, the impact of different camera models (such as different resolutions, frame rates, etc.) on the final results can be considered. Comparative experiments show that although there are differences in basic performance, as long as the minimum requirements are met, the kilometer marker detection models obtained using the above training method can all work effectively.

[0151] Optionally, different combinations of detection parameters can be set for different types of heavy-haul trains (e.g., freight trains and passenger trains) to meet their specific needs. Results show that the kilometer marker detection model obtained using the training method described above exhibits good adaptability and flexibility.

[0152] In the aforementioned kilometer marker detection method, the prior box template and loss function of the original kilometer marker detection model are optimized by using 1-IoU distance and CIoU-NWD loss function during the training process. This improves the detection performance of the obtained kilometer marker detection model under complex background conditions, increases the detection accuracy of kilometer markers, and thus enhances the reliability of train positioning during operation. Therefore, when using the aforementioned kilometer marker detection model to detect kilometer markers in the image to be detected, the obtained detection results can have high detection accuracy, thereby ensuring high positioning reliability of the train during operation.

[0153] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0154] Based on the same inventive concept, this application also provides a training apparatus for a kilometer marker detection model to implement the training method for the kilometer marker detection model described above. The solution provided by this apparatus is similar to the implementation described in the above method. Therefore, the specific limitations of one or more kilometer marker detection model training apparatus embodiments provided below can be found in the limitations of the kilometer marker detection model training method described above, and will not be repeated here.

[0155] In one exemplary embodiment, such as Figure 6 As shown, a training device for a kilometer marker detection model is provided, comprising: a sample acquisition module 610, a model initialization module 620, a prediction box generation module 630, and a model optimization module 640, wherein:

[0156] The sample acquisition module 610 is used to acquire sample images; wherein, the sample images are marked with real detection boxes of kilometer markers, and the sample images are determined based on the environmental images of the environment in front of the train along the direction of travel during the train's journey;

[0157] The model initialization module 620 is used to perform size clustering on the real detection boxes using 1-IoU distance to obtain prior box templates that match the size of the real detection boxes, and to initialize the preset model to be trained based on the prior box templates.

[0158] The prediction box generation module 630 is used to input the sample image into the preset model so that the preset model can determine the predicted detection box of the kilometer marker in the sample image that matches the size of the prior box template.

[0159] The model optimization module 640 is used to determine the error between the actual detection box and the predicted detection box based on the CIoU-NWD loss function of the preset model, and optimize the model parameters of the preset model based on the error.

[0160] In one exemplary embodiment, the model optimization module 640 is specifically used for

[0161] If the error exceeds the preset error threshold, optimize the model parameters of the preset model based on the error, and return to the step of inputting the sample image into the preset model.

[0162] If the error is not greater than the preset error threshold, the current preset model will be determined as the kilometer marker detection model.

[0163] In one exemplary embodiment, the prediction box generation module 630 is specifically used for:

[0164] The backbone network of the pre-defined model extracts image features from sample images based on an attention mechanism;

[0165] The neck network of the pre-defined model performs multi-scale fusion of image features to obtain feature maps at different scales;

[0166] The detection head of the preset model determines the predicted detection box of the kilometer marker that matches the size of the prior box template in the feature map.

[0167] In an exemplary embodiment, the model initialization module 620 is specifically used to determine the prior box template size corresponding to each detection head based on the feature map size corresponding to each detection head of the prediction model to be trained and the prior box template size corresponding to each feature map size.

[0168] Accordingly, the prediction box generation module 630 is specifically used for each detection head to determine the predicted detection box of the kilometer marker that matches the size of the corresponding prior box template in the feature map of the corresponding feature map size.

[0169] In one exemplary embodiment, the detection head of the preset model includes a detection head with 4x downsampling.

[0170] In one exemplary embodiment, the sample acquisition module 610 includes:

[0171] The image acquisition submodule is used to acquire environmental images of the environment in front of the train along the direction of travel during the train's movement.

[0172] The size processing submodule is used to perform size normalization operations on the environmental image to obtain an initial image;

[0173] The preprocessing submodule is used to perform image preprocessing on the initial image; wherein, image preprocessing includes at least image denoising and / or normalization processing;

[0174] The annotation submodule is used to annotate the true detection boxes of kilometer markers in the initial image after image preprocessing, obtain backup images, and determine the sample images based on the backup images.

[0175] In one exemplary embodiment, the annotation submodule is specifically used for:

[0176] Use the backup image as the sample image; and / or,

[0177] The backup image is subjected to data augmentation processing, and the data-augmented image is determined as the sample image; wherein the data augmentation processing includes at least one of rotation, flipping, noise addition, color change and weather simulation.

[0178] Based on the same inventive concept, this application also provides a kilometer marker detection device for implementing the kilometer marker detection method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of one or more kilometer marker detection device embodiments provided below can be found in the limitations of the kilometer marker detection method described above, and will not be repeated here.

[0179] In one exemplary embodiment, such as Figure 7 As shown, a kilometer marker detection device is provided, including: an image acquisition module 710 and a kilometer marker detection module 720, wherein:

[0180] The image acquisition module 710 is used to acquire the image to be detected; wherein, the image to be detected is determined based on the environmental image of the environment in front of the train along the direction of travel during the movement of the target train;

[0181] The kilometer marker detection module 720 is used to input the image to be detected into the kilometer marker detection model to obtain the position information of the kilometer markers in the image to be detected; wherein, the kilometer marker detection model is determined according to any of the above-mentioned kilometer marker detection model training methods.

[0182] The training of the aforementioned kilometer marker detection model and the various modules in the kilometer marker detection device 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, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0183] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores sample images, prior box templates, and other data. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements the training of a kilometer marker detection model and / or a kilometer marker detection method.

[0184] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0185] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described kilometer marker detection model training and / or the various method embodiments of the kilometer marker detection method.

[0186] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described kilometer marker detection model training and / or kilometer marker detection method embodiments.

[0187] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the training of the kilometer marker detection model and / or the various method embodiments of the kilometer marker detection method described above.

[0188] Those skilled in the art will understand that all or part of the processes in 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, databases, 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 many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0189] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.

[0190] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A training method for a kilometer marker detection model, characterized in that, The method includes: Acquire sample images; wherein the sample images are marked with real detection boxes for kilometer markers, and the sample images are determined based on environmental images of the environment in front of the train along the direction of travel during the train's journey; The true detection boxes are clustered by size using 1-IoU distance to obtain prior box templates that match the size of the true detection boxes, and the preset model to be trained is initialized based on the prior box templates. The sample image is input into the preset model so that the preset model determines a predicted detection box for a kilometer marker in the sample image that matches the size of the prior box template. Based on the CIoU-NWD loss function of the preset model, the error between the real detection box and the predicted detection box is determined, and the model parameters of the preset model are optimized based on the error.

2. The method according to claim 1, characterized in that, The step of optimizing the model parameters of the preset model based on the error includes: If the error is greater than a preset error threshold, optimize the model parameters of the preset model according to the error, and return to the step of inputting the sample image into the preset model; If the error is not greater than the preset error threshold, the current preset model is determined as the kilometer marker detection model.

3. The method according to claim 1, characterized in that, The preset model is executed to determine the predicted detection box of the kilometer marker in the sample image that matches the size of the prior box template, including: The backbone network of the preset model extracts image features from the sample images based on an attention mechanism; The neck network of the preset model performs multi-scale fusion of the image features to obtain feature maps at different scales; The detection head of the preset model determines the predicted detection box of the kilometer marker that matches the size of the prior box template in the feature map.

4. The method according to claim 3, characterized in that, The initialization of the preset model to be trained based on the prior bounding box template includes: The prior box template size corresponding to each detection head is determined based on the feature map size corresponding to each detection head of the prediction model to be trained, and the prior box template size corresponding to each feature map size. The detection head performs operations on the feature map to determine the predicted detection box of the kilometer marker that matches the size of the prior box template, including: Each detection head determines the predicted detection box of the kilometer marker that matches the size of the corresponding prior box template in the feature map of its corresponding feature map size.

5. The method according to claim 4, characterized in that, The detection head of the preset model includes a detection head with 4x downsampling.

6. The method according to any one of claims 1-5, characterized in that, The acquisition of sample images includes: Acquire environmental images of the environment in front of the train along the direction of travel during the train's journey; The environmental image is normalized to obtain an initial image; The initial image is preprocessed; wherein the image preprocessing includes at least image denoising and / or normalization. The actual detection bounding boxes of kilometer markers are marked in the initial image after image preprocessing to obtain a backup image, and the sample image is determined based on the backup image.

7. The method according to claim 6, characterized in that, The step of determining the sample image based on the backup image includes: The spare image is determined as the sample image; and / or, The backup image is subjected to data augmentation processing, and the data-augmented image is determined as a sample image; wherein the data augmentation processing includes at least one of rotation, flipping, noise addition, color change, and weather simulation.

8. A method for detecting kilometer markers, characterized in that, The method includes: Acquire the image to be detected; wherein the image to be detected is determined based on the environmental image of the environment in front of the train along the direction of travel during the movement of the target train; The image to be detected is input into the kilometer marker detection model to obtain the location information of the kilometer markers in the image to be detected; wherein the kilometer marker detection model is determined by the method according to any one of claims 1-7.

9. A training device for a kilometer marker detection model, characterized in that, The device includes: The sample acquisition module is used to acquire sample images; wherein, the sample images are marked with real detection boxes of kilometer markers, and the sample images are determined based on the environmental images of the environment in front of the train along the direction of travel during the train's journey; The model initialization module is used to perform size clustering on the real detection boxes using 1-IoU distance to obtain prior box templates that match the size of the real detection boxes, and to initialize the preset model to be trained based on the prior box templates. The prediction box generation module is used to input the sample image into the preset model so that the preset model can determine the predicted detection box of the kilometer marker in the sample image that matches the size of the prior box template. The model optimization module is used to determine the error between the real detection box and the predicted detection box based on the CIoU-NWD loss function of the preset model, and to optimize the model parameters of the preset model based on the error.

10. A kilometer marker detection device, characterized in that, The device includes: An image acquisition module is used to acquire an image to be detected; wherein, the image to be detected is determined based on an environmental image of the environment in front of the train along the direction of travel during the movement of the target train; A kilometer marker detection module is used to input the image to be detected into a kilometer marker detection model to obtain the location information of the kilometer markers in the image to be detected; wherein the kilometer marker detection model is determined by the method according to any one of claims 1-7.