A railway track wear line detection system and method
By introducing a lightweight convolutional structure and principal component analysis, combined with a dual-path feature fusion architecture and a deformable attention mechanism, a dataset is generated automatically, solving the problems of low efficiency, poor accuracy, and high cost in railway track wear line detection, and achieving efficient and accurate automated detection.
Patent Information
- Application Number
- CN202511524638.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2045-10-24
AI Technical Summary
Existing railway track wear line detection technologies suffer from problems such as low efficiency of manual inspection, limited detection accuracy and consistency, and poor adaptability to complex environments. Furthermore, traditional visual processing solutions lack robustness under complex working conditions, and pure deep learning methods rely on large-scale, high-quality labeled datasets, leading to high costs and long development cycles.
We employ a lightweight convolutional structure and a multi-scale receptive field expansion mechanism to extract key point distributions. We combine principal component analysis to fit straight lines and construct a straight line detection network with a dual-path feature fusion architecture and a deformable attention mechanism. We generate our own dataset to reduce reliance on manual annotation and improve detection accuracy and robustness through adaptive block gradient calculation and optimal point selection strategies.
It achieves efficient and accurate detection of railway track wear lines, with errors controlled within 2px, significantly improving detection accuracy and adaptability to complex scenarios, reducing data preparation costs, and realizing an automated detection process.
Smart Images

Figure CN121019646B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of track inspection straight line detection, and more specifically to a railway track wear line detection system and method. Background Technology
[0002] In the inspection of rail vehicles, advanced technologies are always needed to reduce errors and make accurate judgments. However, traditional rail vehicle inspection methods mainly rely on manual inspection, which has some problems, such as low efficiency and susceptibility to human factors. Line detection methods based solely on traditional vision rely heavily on the standardization of the input and cannot reasonably fit abnormal images. Training the detection model requires a large dataset, which also requires a lot of manpower for manual annotation.
[0003] A search revealed a patent, CN113624191B, which discloses an adaptive detection device for the straightness of linear guides. This patent includes a support platform, a displacement detection device, and a straightness detection device. It is applicable to the straightness detection of linear guides with different cross-sections and sizes, exhibiting good versatility and high detection efficiency. However, this technical solution primarily focuses on the straightness detection of linear guides and does not consider the special characteristics of railway track wear lines, such as irregular wear and localized deformation of the track surface caused by long-term use. Furthermore, the structural design of its detection device is complex, potentially increasing equipment costs and maintenance difficulty, and it does not address how to deal with the impact of track surface deposits (such as mud, sand, and oil) on the detection results.
[0004] Therefore, existing straightness detection technologies still have certain shortcomings in the detection of wear lines on railway tracks, such as poor adaptability to complex environments, limited detection accuracy of wear lines on track surfaces, and high equipment costs. Summary of the Invention
[0005] In view of the shortcomings of existing technologies, the present invention aims to provide a railway track wear line detection system. The purpose is to overcome the problems of low efficiency, limited detection accuracy and consistency of manual inspection in existing railway track wear line detection technologies, and to solve the limitations of insufficient robustness of traditional vision processing solutions under complex working conditions, as well as the high cost and long cycle challenges brought about by the strong dependence of pure deep learning methods on large-scale, high-quality labeled datasets.
[0006] To achieve the above objectives, the present invention provides the following technical solution:
[0007] A railway track wear line detection system, comprising:
[0008] The feature extraction module introduces a lightweight convolutional structure and a multi-scale receptive field expansion mechanism into the backbone network, and extracts the distribution of key points in historical images through adaptive block gradient calculation.
[0009] The line fitting module uses principal component analysis to perform vector space analysis on the distribution of extracted key points, generates a fitted line, and records the coordinates of its endpoints.
[0010] The self-generated dataset module stores the endpoint coordinates of the fitted line as a label file according to a preset format, forming a dataset that can be used to train the line detection model.
[0011] The line detection model construction module constructs a line detection network that includes a dual-path feature fusion architecture and a deformable attention mechanism. The dataset is trained, tested, and validated in the line detection network at a certain ratio to obtain the line detection model.
[0012] The image acquisition and processing module acquires the original image captured by the camera and extracts a local area as the input image based on the location information output by the preset target prediction model.
[0013] The model prediction visualization module takes the input image and inputs it into the line detection model, then outputs the endpoint positions of the line and their confidence scores.
[0014] Furthermore, the feature extraction module includes a gradient calculation submodule, an optimal point selection submodule, and an outlier filtering submodule;
[0015] The gradient calculation submodule processes the historical image into grayscale to obtain a grayscale image, and then calculates the gradient intensity and direction based on the grayscale image to generate a gradient magnitude map.
[0016] The optimal point selection submodule performs gradient analysis on the local region based on the gradient magnitude map to determine a set of discrete candidate line segment points;
[0017] The outlier filtering submodule performs statistically standardized outlier detection based on the candidate line segment motors, removing outliers to form a new set of points.
[0018] Furthermore, the line fitting module performs eigenvalue decomposition on the covariance matrix of the new point set, determines the orthogonal coordinate axis with the largest data variance as the direction of the line, generates the fitted line, and records the coordinates of its endpoints.
[0019] Furthermore, the self-generated dataset module includes a label generation unit and a data storage unit. The label generation unit generates JSON label files in wireframe format based on the endpoint coordinates of the fitted straight line, and the data storage unit stores the label files and corresponding images in a specified directory.
[0020] Furthermore, the line detection model construction module includes a hierarchical backbone network, an encoder, a decoder, and a filter. The hierarchical backbone network uses HGNetV2 as its basic architecture and reduces the number of parameters by combining 1x1 convolutions and depthwise convolutions. The encoder aggregates feature information from different stages through Transformer encoding and a dual-path feature fusion architecture. The decoder uses a deformable line attention mechanism to dynamically adjust the distribution of sampling points to predict line endpoints.
[0021] Furthermore, the dual-path feature fusion architecture includes two upsampling operations and two downsampling operations. After each sampling, the current feature map is fused with the most recently adapted feature map, and the continuity of the slender straight line features is maintained through the RepNCSPELAN4 module.
[0022] Furthermore, the deformable line attention mechanism dynamically adjusts the distribution of sampling points by learning the step size parameter to ensure that the sampling points are distributed along the direction between the two ends of the line. The sampling point weights of each attention head are normalized by the softmax function, and the sampling point features are aggregated by weighted summation to generate the final line feature representation.
[0023] Furthermore, it also includes a loss function definition module, including classification loss and regression loss. The classification loss is initialized based on the confidence level of the line predicted by the model, and the regression loss measures the difference between the line parameters predicted by the model and the actual line parameters.
[0024] Furthermore, the image acquisition and processing module includes an image cropping submodule and a grayscale processing submodule. The image cropping submodule extracts the target area from the original image and expands it horizontally by 50 pixels to the left and right based on the target location information recorded in the TXT file output by the preset YOLO model. The grayscale processing submodule converts the input image into a grayscale image.
[0025] A method for detecting wear lines on railway tracks includes the following steps:
[0026] In the feature extraction step, a lightweight convolutional structure and a multi-scale receptive field expansion mechanism are introduced into the backbone network, and the distribution of key points in historical images is extracted through adaptive block gradient calculation.
[0027] The straight line fitting step involves performing vector space analysis on the extracted key point distribution using principal component analysis to generate a fitted straight line and record its endpoint coordinates.
[0028] The self-generated dataset step stores the endpoint coordinates of the fitted line as a label file according to a preset format, forming a dataset that can be used to train the line detection model.
[0029] The steps for building a line detection model are as follows: a line detection network including a dual-path feature fusion architecture and a deformable attention mechanism is constructed, and the dataset is trained, tested, and validated in the line detection network according to a certain proportion to obtain the line detection model;
[0030] The image acquisition and processing steps involve acquiring the original image captured by the camera and cropping a local area as the input image based on the location information output by the preset target prediction model.
[0031] The model prediction visualization step involves inputting the input image into the line detection model, which then outputs the endpoint positions of the lines and their confidence scores.
[0032] The beneficial effects of this invention are as follows: In the image preprocessing stage, the adaptive block gradient calculation strategy and optimal point selection strategy reduce the computational load and improve the accuracy of point set extraction. Experimental verification shows that the error is controlled within 2px in more than 3,000 image tests, which is significantly better than the traditional mean or weight allocation method. In addition, the principal component analysis method is used to fit the line, which solves the problem of insufficient performance of traditional methods in low contrast and partially occluded scenes. In the line detection model construction stage, the hierarchical backbone network and dual-path feature fusion architecture design realize the effective aggregation of features at different scales, which enhances the model's adaptability to complex scenes. The introduction of the deformable line attention mechanism enables the model to dynamically adjust the distribution of sampling points, thereby more accurately capturing the position of the line endpoints. Compared with the traditional Transformer-based method, this model has significant improvements in training speed and detection accuracy. In addition, by generating the dataset itself, the dependence on manually labeled data is reduced, which greatly reduces the data preparation cost. At the same time, the entire detection process does not require manual intervention and can automatically complete the entire process from image acquisition to line detection, meeting the needs of the rail transit industry for efficient and accurate detection. Attached Figure Description
[0033] Figure 1 This is the overall flowchart of the present invention;
[0034] Figure 2 This is a flowchart of the traditional visual image detection process in this invention;
[0035] Figure 3 This is the encoder network diagram in this invention;
[0036] Figure 4 This is a comparison diagram of the traditional image processing stage and the model processing stage after training with a self-generated dataset in this invention. Detailed Implementation
[0037] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Identical components are denoted by the same reference numerals. It should be noted that the terms "front," "rear," "left," "right," "upper," and "lower" used in the following description refer to directions in the accompanying drawings, and the terms "bottom surface," "top surface," "inner," and "outer" refer to directions toward or away from the geometric center of a specific component, respectively.
[0038] Currently, many datasets used for model training and construction require manual annotation, which is time-consuming and labor-intensive. Furthermore, the construction of detection models is relatively dependent on the dataset, necessitating model-dataset matching. Model training and construction must consider adaptability to complex environments and the detection accuracy of track surface wear lines. Therefore, this invention designs a railway track wear line detection system and method. The system component includes, for example... Figure 1 As shown, it includes a feature extraction module, a line fitting module, a self-generated dataset module, a line detection model building module, an image acquisition and processing module, and a model prediction and visualization module. Each module is connected sequentially through the data flow direction to form a complete detection process, which is used to achieve efficient detection of railway track wear lines.
[0039] Before actual detection, a fast and intelligent line detection model needs to be built. First, a training dataset is constructed, which is completed by a feature extraction module, a line fitting module, and a self-generated dataset module. The feature extraction module introduces a lightweight convolutional structure and a multi-scale receptive field expansion mechanism into the backbone network. First, the historical image is divided into multiple blocks vertically through a block gradient calculation unit. The gradient value is calculated independently for each block to obtain a preliminary point distribution. The optimal point selection unit selects the three points with the most significant gradient changes in the horizontal direction in each block based on the principle of gradient change significance, and selects the point closest to the image center as the optimal point. This process ensures that the selection of key points has high robustness and avoids error amplification caused by small interference points. Finally, the feature extraction module outputs a set of key point distributions as input to the line fitting module.
[0040] The feature extraction module includes a gradient calculation submodule, an optimal point selection submodule, and an outlier filtering submodule;
[0041] The gradient calculation submodule processes the historical image into a grayscale image, then calculates the gradient intensity and direction based on the grayscale image to generate a gradient magnitude map. Specifically, the original historical image was a black and white image; for the program's robustness, a grayscale conversion process is added to provide the foundation for subsequent Sobel gradient calculations. The Sobel gradient calculation process is as follows:
[0042] ;
[0043] in, The input image is a single-channel grayscale image. To output depth, such as , for directional derivative order for directional derivative order For kernel size, odd number, for The horizontal gradient kernel used for the direction is: .
[0044] The optimal point selection submodule performs gradient analysis on local regions based on the gradient magnitude map to determine a set of discrete candidate line segment points. Specifically, considering the characteristics of the target image, the line to be detected is located at both ends of the image with significant contrast. Therefore, the image is vertically segmented at both ends, and the gradient of each segment is calculated to obtain the optimal point. The optimal point selection strategy is as follows: select the top 3 points with the most significant gradient changes in the horizontal direction, and among these three points, select the point closest to the image center as the optimal point. The segmentation operation reduces the computational load and, by obtaining multiple optimal points from the number of segments, minimizes the error and accuracy loss caused by individual points. The optimal point is not selected by averaging or redistributing weights because this line detection method requires high accuracy. Averaging would amplify the error caused by some small interference points, resulting in a weaker outcome than "selecting the point closest to the image center." After experiments on more than 3000 images, the current optimal point selection scheme has the best performance, with the error controlled within 2px.
[0045] The outlier filtering submodule performs statistically standardized outlier detection on candidate line segment motors, removing outliers to form a new point set. Specifically, after the above processing, a preliminary point set is obtained, and then points that do not meet the requirements are filtered using the Z-Score outlier filtering method. Z-Score filtering is based on the statistically standardized outlier detection method. For data that conforms to a normal distribution, it satisfies the following:
[0046] ;
[0047] in, For data points, , Setting the threshold parameter k to 1.0 can include 68% of the normally distributed data, thereby filtering out outliers to form a new point set.
[0048] The line fitting module uses principal component analysis (PCA) to perform vector space analysis on the extracted keypoint distribution. By performing eigenvalue decomposition on the covariance matrix of the new point set, it determines the orthogonal coordinate axis with the largest data variance as the direction of the line. This method can achieve stable fitting of lines at any angle and generate the endpoint coordinates of the fitted line. The line fitting module then passes the endpoint coordinates of the fitted line to the self-generated dataset module. Specifically, this solution uses PCA to obtain the fitted line based on the new point set. The vector space analysis of PCA finds the orthogonal coordinate axis with the largest data variance, and the principal direction is determined by the eigenvectors of the covariance matrix. This enables stable detection of lines in any direction, improving accuracy by 3-8 times compared to traditional methods, and showing significant advantages, especially in vertical edge detection scenarios common in industrial settings.
[0049] The self-generated dataset module includes a label generation unit and a data storage unit. The label generation unit generates JSON label files in wireframe format based on the endpoint coordinates of the fitted line, containing precise location information of the line endpoints. The data storage unit stores the label files and corresponding images in a designated directory, forming a complete training dataset. This dataset can be used for subsequent training of deep learning models, thereby reducing reliance on manually labeled data.
[0050] The line detection model building module designs a line detection network that includes a dual-path feature fusion architecture and a deformable attention mechanism. The hierarchical backbone network uses HGNetv2 as its basic architecture, reducing the number of parameters by 75% through a combination of 1x1 convolutions and depthwise convolutions. An RFEM module is also introduced to expand the effective receptive field. The encoder aggregates feature information from different stages through Transformer encoding and the dual-path feature fusion architecture. The dual-path feature fusion architecture includes two upsampling operations and two downsampling operations. After each sampling, the current feature map is fused with the most recently adapted feature map, and the RepNCSPELAN4 module maintains the continuity of the thin line features. The decoder uses a deformable line attention mechanism to dynamically adjust the distribution of sampling points to predict the endpoints of the line. The filter selects the final output result based on the contrast thresholds on both sides of the line. The line detection model building module guides model training through a loss function definition module. The loss function includes two parts: classification loss and regression loss. The classification loss is based on the confidence of the predicted line and is initialized through the focal_alpha parameter; the regression loss measures the difference between the predicted line parameters and the actual line parameters.
[0051] Specifically, to enable the processing of more complex and varied images and improve the generalization ability of the algorithm, this invention innovatively proposes a line detection model, RLVN, suitable for this dataset, based on existing line detection models. The RLVN model is significantly faster than traditional Transformer-based line detection models and does not require pre-training of the attention mechanism on large datasets such as ImageNet, eliminating the need for pre-training the attention mechanism using a new mechanism. It also adopts a deformable line attention mechanism, which is based on deep learning methods. The ablation experiment results also demonstrate its excellent performance, and its training is faster than other attention mechanisms. It has the characteristics of high speed and high accuracy. By training the RLVN model, it can fit and predict images that have not appeared before, thus improving robustness.
[0052] The overall architecture of the RLVN model can be divided into four main parts: a hierarchical backbone network, an encoder, a decoder, and a filter.
[0053] Part 1 (Backbone Network): First, the model needs to generate a Feature Pyramid (FPN) based on the backbone network. This model selects HGNetV2 as the backbone network, and the basic module of this backbone network is the ConvBNAct module, which is used in extracting feature images at various depths. The processing flow of ConvBNAct is as follows:
[0054] ;
[0055] in, ;
[0056] HGNetV2 reduces the number of parameters by 75% while maintaining the receptive field through a combination of 1x1 convolution and depthwise convolution. Due to the small input image, shallow feature maps may gradually lose spatial information when forming feature maps, while deep features are semantically rich but have low resolution. The RLVN model introduces the RFEM module, which expands the effective receptive field without increasing the computational cost by dilating the convolution, thereby enhancing the model's feature representation ability. The improved backbone network extracts three deeper layers as output feature maps, with the number of channels in the three feature maps from shallow to deep being [256, 512, 1024].
[0057] Part Two (Encoder), architecture as follows: Figure 3As shown: The output of the first part is convolved with 1x1 and normalized using GroupNorm (group normalization, which replaces BatchNorm and is more suitable for small batch scenarios) to make the number of channels of the three feature maps consistent, all being [256, 256, 256]. The deepest feature map is selected for flattening, from the original [B, C, H, W] to [B, H * W, C]. Then, position encoding is performed using a multi-scale sinusoidal position encoding strategy designed for two-dimensional feature maps. This position encoding strategy encodes independently in the horizontal / vertical directions and then fuses them. Adjacent dimensions use sine or cosine to increase positional combinability, which is particularly suitable for object detection tasks. It can clearly distinguish the semantic information of different spatial locations. The sensitivity to small displacements is controlled by variable coefficients, maintaining translation invariance while introducing positional priors. The channels of the position-encoded features are adjusted and flattened back to the original tensor format [B, C, H, W].
[0058] We have obtained three-layer feature maps, feats[256,256,256*], where 256* indicates that the feature maps have undergone the Transformer encoding process described above. The output of the Transformer encoding is then fed into the dual-input feature fusion architecture, which includes four steps:
[0059] Step 1: The deepest position-encoded feature tensor of feats[2], with its index starting from 0, is upsampled after a standard convolution to become an upsampled feature map. Its size is adapted to that of feats[1]. The upsampled feature map and feats[1] are used as fusion inputs and aggregated through the RepNCSPELAN4 module to aggregate feature information from different stages while maintaining the continuity of the thin line features in line detection.
[0060] Step 2: The output from Step 1 is processed through the same Step 1 operation to obtain a new upsampled feature map. Then, feats[0] is fused with the upsampled feature map as the input to the RepNCSPELAN4 module. The final output is recorded as the feature map output from Step 2.
[0061] Step 3: The output of Step 2 is downsampled by the SCDown module and used as the downsampled feature map. This is then fused and concatenated with the input of Step 2 and fed into the RepNCSPELAN4 module for processing. The final output is recorded as the feature map output of Step 3.
[0062] Step four: After downsampling the output of step three with SCDown, fuse it with the input of step three and put it into the RepNCSPELAN4 module for processing. Record the final output as the feature map output of step four. Finally, form a list of the feature maps output of step two, step three and step four as the total output of the second part.
[0063] In summary, the four steps can be summarized as follows: the position-encoded feature tensor undergoes two upsampling and two downsampling operations. After each sampling, a previously closest size-fitting feature is fused and then fed into the RepNCSPELAN4 module for processing to aggregate feature information before output. The output of the last three stages is selected as the total output.
[0064] The third part (decoder) first selects the top k pixels most likely to contain line segment candidates from the encoder output. First, the algorithm processes the input feature map F through a linear layer to generate probabilistic embeddings, which represent the probability that each position is part of a line segment. Then, the torch.topk function is used to select the top k points with the highest probabilities from the probabilistic embeddings. These points are considered to be the most likely candidate positions to contain line segments, and the indices of these candidate positions are stored in a point set library.
[0065] Subsequently, the algorithm obtains the normalized coordinates of these candidate positions based on the point set library and the dimensional information of the feature map by acquiring the normalized coordinate function. These coordinates represent the positions of the candidate positions in the feature map. Then, the normalized coordinates are transformed by the inverse activation function to ensure that the coordinate values are within a reasonable range. This step is to convert the output of the activation function (usually between 0 and 1) back to the original coordinate space.
[0066] Next, the algorithm uses another linear layer to process the candidate positions, generating offsets that are used to adjust the precise location of the anchor points. Finally, the normalized coordinates are repeated twice to match the two endpoints of the line segment and added to the offsets to generate the final anchor points. These anchor points will be used in the subsequent decoder and deformable line attention mechanism to predict the endpoints of the line segments. The decoder stage uses the deformable line attention mechanism to allow the query and feature map to interact, thereby predicting the endpoints of the line segments.
[0067] The deformable line attention mechanism first calculates sampling points on each feature map. These points are dynamically adjusted using a learned step size parameter αi to ensure that the sampling points are distributed along the direction between the two endpoints of the line segment. Then, the softmax function is used to calculate the attention weights for the sampling points of each attention head, ensuring that the sum of the weights of the sampling points on each feature map is 1. Finally, the features of the sampling points are aggregated by weighted summation to obtain the final line segment feature representation. This process not only improves the accuracy of line segment detection but also significantly improves the detection speed by optimizing the network design, making it suitable for application scenarios requiring low latency.
[0068] The fourth part (filter) is designed for this specific scenario. The output obtained by the decoder is filtered based on the set of predicted line segments obtained after execution and the confidence score corresponding to each predicted line segment. The specific strategy steps are as follows: for each line, the contrast on both sides of the line segment is screened. If the contrast exceeds the threshold of 80, it is filtered into the final output.
[0069] Define the loss function:
[0070] 1. Classification loss: ,in This indicates that the model's predicted line has a confidence level. These are the preset weight coefficients in the classification loss function, used to balance the weight parameters of different types of samples in the classification task.
[0071] 2. Linear regression loss: ,in This represents the linear parameters predicted by the model. This represents the actual straight line parameters. After the model is trained, predictions are made based on the weight file obtained from the training, and a specific image is visualized for observation.
[0072] The image acquisition and processing module acquires the original image captured by the camera and crops a local region as the input image based on the position information output by the preset target prediction model. Specifically, the high-speed camera is mounted on the track inspection vehicle to capture the original image of the railway track. First, the original image captured by the high-speed camera is acquired, and a local region is cropped as the input image based on the position information output by the externally trained target prediction model. This position information is usually generated by the YOLO model and stored as a TXT file, recording the bounding box coordinates of the target region. Image cropping is performed to crop the target region from the original image based on these coordinates, and the horizontal extension is 50 pixels to the left and right to enhance the boundary information. Grayscale processing converts the cropped image into a grayscale image to reduce noise interference in the subsequent Sobel gradient calculation process. After the above processing, the image acquisition and processing module outputs a grayscale local image. This process ensures the integrity of the boundary information of the input image and minimizes noise interference, laying the foundation for subsequent key point extraction.
[0073] The model prediction visualization module takes the input image and inputs it into the line detection model. It outputs the endpoint positions of the lines and their confidence scores, such as 2 and... Figure 4 As shown, traditional wear line detection suffers from inaccurate matching. In practical applications, the output of the model prediction visualization module can be used to further analyze the track wear status and provide technical support for track maintenance. For example, even when there are stains or uneven lighting on the track surface, the system can still accurately extract the key point distribution of the track wear line and achieve high-precision straight line detection through a deep learning model. In addition, the self-generated dataset method significantly reduces the data preparation cost, enabling the system to achieve efficient and accurate track condition inspection in the rail transit industry.
[0074] This invention includes a detection method designed for the corresponding system. Specifically, a method for detecting wear lines on railway tracks includes the following steps:
[0075] In the feature extraction step, a lightweight convolutional structure and a multi-scale receptive field expansion mechanism are introduced into the backbone network, and the distribution of key points in historical images is extracted through adaptive block gradient calculation.
[0076] The straight line fitting step involves performing vector space analysis on the extracted key point distribution using principal component analysis to generate a fitted straight line and record its endpoint coordinates.
[0077] The self-generated dataset step stores the endpoint coordinates of the fitted line as a label file according to a preset format, forming a dataset that can be used to train the line detection model.
[0078] The steps for building a line detection model are as follows: a line detection network including a dual-path feature fusion architecture and a deformable attention mechanism is constructed, and the dataset is trained, tested, and validated in the line detection network according to a certain proportion to obtain the line detection model;
[0079] The image acquisition and processing steps involve acquiring the original image captured by the camera and cropping a local area as the input image based on the location information output by the preset target prediction model.
[0080] The model prediction visualization step involves inputting the input image into the line detection model, which then outputs the endpoint positions of the lines and their confidence scores.
[0081] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principle of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A railway track wear line detection system, characterized in that: The application relates to a straight line detection method based on a self-generated dataset. The application comprises the following steps: A feature extraction module introduces a lightweight convolution structure and a multi-scale receptive field expansion mechanism in a backbone network, and extracts key point distribution in a historical image through adaptive block gradient calculation; A straight line fitting module performs vector space analysis on the extracted key point distribution through principal component analysis, generates a fitting straight line, and records the endpoint coordinates of the fitting straight line; A self-generated dataset module stores the endpoint coordinates of the fitting straight line into a label file in a preset format, and forms a dataset that can be used for training of a straight line detection model; A straight line detection model construction module constructs a straight line detection network comprising a double-path feature fusion architecture and a deformable attention mechanism, trains, tests and verifies the dataset in the straight line detection network at a certain proportion to obtain a straight line detection model; An image acquisition and processing module acquires an original image shot by a camera, and cuts a local area as an input image according to position information output by a preset target prediction model; 2. A railway track rail wear line detection system according to claim 1, characterised in that: A model prediction and visualization module inputs the input image into the straight line detection model, and outputs the endpoint position of the straight line and the confidence thereof. The feature extraction module comprises a gradient calculation submodule, an optimal point selection submodule and an outlier filtering submodule; The gradient calculation submodule performs gray processing on the historical image to obtain a gray image, and then calculates gradient intensity and direction according to the gray image to generate a gradient amplitude graph; The optimal point selection submodule performs gradient analysis on a local area according to the gradient amplitude graph to determine a set of discrete candidate line segment points; 3. A railway track rail wear line detection system according to claim 2, characterised in that: The outlier filtering submodule performs statistical standardization outlier detection according to the candidate line segment point set, and removes abnormal points to form a new point set.
4. A railway track rail wear line detection system as claimed in claim 3, wherein: The straight line fitting module performs eigenvalue decomposition on a covariance matrix of the new point set, determines an orthogonal coordinate axis with the largest data variance as a straight line direction, generates a fitting straight line, and records the endpoint coordinates of the fitting straight line.
5. A railway track rail wear line detection system as claimed in claim 1 or 4 wherein: The self-generated dataset module comprises a label generation unit and a data storage unit, the label generation unit generates a JSON label file in a wireframe format according to the endpoint coordinates of the fitting straight line, and the data storage unit stores the label file and the corresponding image into a specified directory.
6. A railway track rail wear line detection system according to claim 5, characterised in that: The straight line detection model construction module comprises a hierarchical backbone network, an encoder, a decoder and a filter, the hierarchical backbone network adopts hgnetv2 as a basic architecture and reduces the parameter quantity through combination of 1x1 convolution and deep convolution, the encoder aggregates feature information at different stages through Transformer encoding and a double-path feature fusion architecture, and the decoder adopts a deformable line attention mechanism to dynamically adjust a sampling point distribution to predict straight line endpoints. The double-path feature fusion architecture comprises twice upsampling and twice downsampling operations, the current feature map is fused with the nearest adapted feature map after each sampling, and a RepNCSPELAN4 module is used to maintain the continuity of elongated straight line features.
7. A railway track rail wear line detection system as claimed in claim 5, wherein: The deformable line attention mechanism dynamically adjusts the sampling point distribution through a learning step parameter, ensures that the sampling points are distributed along the direction between the two endpoints of the straight line, the sampling point weight of each attention head is normalized by a softmax function, and the sampling point features are aggregated by weighted summation to generate the final straight line feature representation.
8. A railway track rail wear line detection system according to claim 1, characterised in that: The loss function definition module also includes a classification loss and a regression loss, the classification loss is initialized based on the straight line existence confidence predicted by the model, and the regression loss measures the difference between the straight line parameters predicted by the model and the actual straight line parameters.
9. A railway track rail wear line detection system as claimed in claim 1, wherein: The image acquisition processing module includes an image cropping submodule and a grayscale processing submodule, the image cropping submodule extracts the target region from the original image according to the target position information recorded in the TXT file output by the preset YOLO model and expands it horizontally left and right by 50 pixels, and the grayscale processing submodule converts the input image into a grayscale image.
10. A method of detecting a rail wear line of a railway track, characterized in that: The following steps are included: A feature extraction step, a lightweight convolution structure and a multi-scale receptive field expansion mechanism are introduced in the backbone network, and the key point distribution in the historical image is extracted through adaptive block gradient calculation; A straight line fitting step, the principal component analysis method is used to analyze the extracted key point distribution in the vector space, generate a fitting straight line and record its endpoint coordinates; A self-generated dataset step, the endpoint coordinates of the fitting straight line are stored as a label file in a preset format to form a dataset that can be used for straight line detection model training; A straight line detection model construction step, a straight line detection network including a double-path feature fusion architecture and a deformable attention mechanism is constructed, the dataset is trained, tested and verified in the straight line detection network at a certain proportion to obtain a straight line detection model; An image acquisition processing step, an original image captured by a camera is obtained, and a local area is cropped as an input image according to the position information output by the preset target prediction model; A model prediction visualization step, the input image is input into the straight line detection model, and the endpoint position and confidence of the straight line are output.
Citation Information
Patent Citations
A linear guide rail straightness adaptive detection device
CN113624191B
Detection method, detection system, equipment and storage medium
CN113627257A
Track detection method and device
CN115123335A