A track recognition method based on residual network
By constructing a track recognition model based on ResNet18, combined with the adaptive momentum optimization method, the problems of cumbersome parameter adjustment and poor environmental adaptability in traditional methods are solved, and efficient accuracy and real-time performance of track recognition are achieved.
Patent Information
- Application Number
- CN202411757304.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2044-12-03
AI Technical Summary
In the prior art, traditional machine vision and general segmentation models have problems in track recognition that parameter adjustments are complicated, environmental robustness is poor, and the inability to distinguish tracks independently, especially in the track recognition of the train.
The track recognition method based on residual network is adopted, and the adaptive momentum optimization method of ResNet18 structure is constructed, combined with geometric loss and cutoff loss, the track recognition model is trained to achieve accurate prediction of track coordinates.
It improves the image feature extraction effect, is suitable for real-time computing and edge deployment, and can adaptively distinguish the direction of the switch, ensuring the accuracy of target track recognition.
Smart Images

Figure CN119229420B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of rail transit safety, and in particular relates to a track recognition method based on a residual network. Background Art
[0002] Active obstacle detection systems are crucial for rail transit safety. Decision-making based on obstacle detection results relies on the scope of the track area identified. Currently, many researchers use traditional machine vision or segmentation models to achieve track identification. The former involves cumbersome parameter adjustments and lacks robustness in diverse environments; the latter fails to account for the specific characteristics of track alignments. General segmentation models are unable to autonomously distinguish the current track on which a train is located, often misclassifying non-target tracks as part of their own trajectory. Summary of the Invention
[0003] To solve the above technical problems, the present invention provides a track recognition method based on a residual network to solve the problems in the prior art. The technical solution adopted by the present invention is:
[0004] A track recognition method based on residual network includes the following steps:
[0005] Step 1: Based on the track dataset, a residual network method is used to obtain a track recognition model through network training;
[0006] Step 2: Collect real-time track images, input them into the track recognition model, and obtain track coordinates;
[0007] Step 2 includes:
[0008] Step 21: Input the image into the trained track recognition model. After passing through the convolutional layer or pooling layer, the activation function is used to calculate the feature map until the fully connected layer obtains the final detection result.
[0009] Step 22: The detection result is a vector of length 129, and the 1st to 64th values are the predicted values of the left track horizontal coordinate, that is, x i , l ; The 65th to 128th values are the predicted values of the right track horizontal coordinate x i , r ; The 129th value is the number of vertical coordinates after truncation, that is T ; i The range is [1,64];
[0010] Step 23: There are 64 single track points in step 22, and the corresponding vertical coordinate sequence is the input image height. H Interpolation to the value 0, that is , iThe range is [1,64]; combined with the number of vertical coordinates after truncation T , the left track coordinate sequence is , the right track coordinate sequence is , where i is in the range [1,T].
[0011] Furthermore, step 1 includes:
[0012] Step 11, constructing a residual neural network structure;
[0013] Step 12: Import the track data set into the residual neural network structure for training to obtain a residual neural network structure with higher training accuracy, namely, a track recognition model.
[0014] Furthermore, step 11 includes:
[0015] Step 11 a , the residual neural network structure is based on ResNet 18 structure, including 18 convolutional layers, 1 pooling layer, 1 Flatten layer, 2 fully connected layers;
[0016] Step 11 b , the convolution layer extracts image features; the pooling layer adopts the average pooling method; the Flatten The layer converts the output data of the previous layer into a one-dimensional array; the fully connected layer maps the feature representations of the convolutional layer and the pooling layer to the labels of the data samples. Its network structure is as follows:
[0017] The first layer is a convolutional layer with 64 convolution kernels of size 7×7 and a stride of 2;
[0018] The second layer is a maximum pooling layer with a window size of 3×3 and a stride of 2;
[0019] The 3rd to 6th layers are 64 convolution layers with a kernel size of 3×3 and a stride of 1;
[0020] The 7th to 10th layers are 128 convolutional layers with a kernel size of 3×3. The stride of the 7th layer is 2, and the stride of the remaining layers is 1;
[0021] The 11th to 14th layers are convolutional layers with 256 convolution kernels of size 3×3. The stride of the 11th layer is 2, and the stride of the remaining layers is 1;
[0022] The 15th to 18th layers are convolutional layers with 512 convolution kernels of size 3×3. The stride of the 15th layer is 2, and the stride of the remaining layers is 1;
[0023] The 19th layer is the average pooling layer;
[0024] The 20th floor is FlattenLayer, converting 8×16×16 data into a vector of length 2048;
[0025] The 21st layer is the fully connected layer 1, and the output vector length is 2048;
[0026] The 22nd layer is the fully connected layer 2, and the output vector length is 129;
[0027] Step 11 c , step 11 b Use RELU The activation function performs unilateral inhibition, and the formula is as follows:
[0028] ;
[0029] in, x is the input vector.
[0030] Furthermore, step 12 includes:
[0031] Step 12 a , the image is input into the residual neural network structure, after passing through the convolution layer or pooling layer, the feature map is calculated by the activation function until the full connection layer obtains the final detection result;
[0032] Step 12 b , in the test results, x i , l is the left track horizontal coordinate vector, x i , r is the right track horizontal coordinate vector; T To predict the number of points after the track is truncated, T The vertical axis is ym , i The range is [1, T ];
[0033] Step 12 c , loss function Including geometric loss , cut-off loss and proportion , the formula is as follows:
[0034] ;
[0035] Geometric loss The formula is as follows:
[0036] ;
[0037] Where, the superscript ^ indicates the true value; β tis the proportional smoothing point of geometric loss; the smoothing function of β proportional point g ( x ,β) is:
[0038] ;
[0039] Cut-off loss The formula is as follows:
[0040] ;
[0041] Where, the superscript ^ indicates the true value; β m is the proportional smoothing point of the cut-off loss;
[0042] Step 12 d ,Using the stochastic optimization method with adaptive momentum, the network parameters are continuously updated and the loss function value is recalculated until the loss function value converges or the predetermined number of iterations is reached.
[0043] The present invention has the following beneficial effects: the effect of image feature extraction of the present invention is significantly improved compared with the commonly used segmentation network model, and the magnitude of network structure parameters is suitable for real-time calculation and edge deployment; the loss function of the present invention incorporates the existing linear features of the track line, and the training effect is significantly improved; it avoids the problem of multiple results of the general segmentation model being difficult to choose, adaptively distinguishes the direction of the switch, and the number of target tracks is only one. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic diagram of the overall process of the present invention;
[0045] Figure 2 It is the data flow diagram of the residual network of the present invention. DETAILED DESCRIPTION
[0046] The following is a combination of the embodiments of the present invention Figure 1-Figure 2 , the technical solutions in the embodiments of the present invention are described clearly and completely. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Unless otherwise specified, the technical means used in the embodiments are conventional means well known to those skilled in the art.
[0047] like Figure 1 、 Figure 2 , a track recognition method based on residual network, comprising the following steps:
[0048] Step 1: Based on the track dataset, a residual network method is used to obtain a track recognition model through network training;
[0049] The track dataset in step 1 consists of images and labels. The labels consist of left track coordinates and right track coordinates. In this embodiment, there are 59,600 images and labels, with a training set ratio of 80% and a test set ratio of 20%.
[0050] Step 2: Collect real-time track images and input them into the track recognition model to obtain track coordinates.
[0051] Furthermore, the step 1 of constructing the residual neural network includes the following steps:
[0052] Step 11, constructing a residual neural network structure;
[0053] Step 12: Import the track data set into the network structure established in step 11 for training to obtain a residual neural network with high training accuracy, that is, a track recognition model.
[0054] Furthermore, the step 11 includes:
[0055] Step 11 a , the network is based on ResNet 18 structure, including 18 convolutional layers, 1 pooling layer, 1 Flatten layer, 2 fully connected layers;
[0056] Step 11 b , the convolution layer extracts image features; the pooling layer adopts the average pooling method; the Flatten The layer converts the output data of the previous layer into a one-dimensional array; the fully connected layer maps the feature representation of the convolution layer and the pooling layer to the label of the data sample. The network structure is as follows:
[0057] The first layer is a convolutional layer with 64 convolution kernels of size 7×7 and a stride of 2;
[0058] The second layer is a maximum pooling layer with a window size of 3×3 and a stride of 2;
[0059] The 3rd to 6th layers are 64 convolution layers with a kernel size of 3×3 and a stride of 1;
[0060] The 7th to 10th layers are 128 convolutional layers with a kernel size of 3×3. The stride of the 7th layer is 2, and the stride of the remaining layers is 1;
[0061] The 11th to 14th layers are convolutional layers with 256 convolution kernels of size 3×3. The stride of the 11th layer is 2, and the stride of the remaining layers is 1;
[0062] The 15th to 18th layers are convolutional layers with 512 convolution kernels of size 3×3. The stride of the 15th layer is 2, and the stride of the remaining layers is 1;
[0063] The 19th layer is the average pooling layer;
[0064] The 20th floor is Flatten Layer, converting 8×16×16 data into a vector of length 2048;
[0065] The 21st layer is the fully connected layer 1, and the output vector length is 2048;
[0066] The 22nd layer is the fully connected layer 2, and the output vector length is 129;
[0067] Step 11 c , the step 11 b Use RELU The activation function performs unilateral inhibition, and the formula is as follows:
[0068] ;
[0069] in, x is the input vector.
[0070] Furthermore, the network training method in step 12 includes:
[0071] Step 12 a , the image is input into the network, and after passing through the convolution layer or pooling layer, the feature map is calculated by the activation function until the final detection result is obtained by the fully connected layer;
[0072] Step 12 b , in the test results, x i , l is the left track horizontal coordinate vector, x i , r is the right track horizontal coordinate vector; T To predict the number of points after the track is truncated, T The vertical axis is ym , i The range is [1, T ];
[0073] Step 12 c , loss function By geometric loss , cut-off loss and proportion The composition is as follows:
[0074] ;
[0075] Geometric loss The formula is as follows:
[0076] ;
[0077] Where, the superscript ^ indicates the true value; β t is the proportional smoothing point of geometric loss; the smoothing function of β proportional point g ( x ,β) is:
[0078] ;
[0079] Cut-off loss The formula is as follows:
[0080] ;
[0081] Where, the superscript ^ indicates the true value; β m is the proportional smoothing point of the cut-off loss;
[0082] Step 12 c The loss function ratio The value is 0.5, the proportional smoothing point β of the geometric loss t The value is 0.004, the proportional smoothing point β of the cutoff loss m The value is 0.016.
[0083] Step 12 d ,Using the stochastic optimization method with adaptive momentum, the network parameters are continuously updated and the loss function value is recalculated until the loss function value converges or the predetermined number of iterations is reached.
[0084] In the network training method of step 12, step (12 d )use Adam The optimizer performs network training with a predetermined number of iterations of 500 steps and a learning rate of 0.0001.
[0085] Furthermore, the prediction of the orbital coordinates in step 2 includes:
[0086] Step 21: Input the image into the trained high-precision network. After passing through the convolutional layer or pooling layer, the feature map is calculated by the activation function until the final detection result is obtained by the fully connected layer.
[0087] Step 22: The detection result is a vector of length 129, and the 1st to 64th values are the predicted values of the left track horizontal coordinate, that is, x i , l ; The 65th to 128th values are the predicted values of the right track horizontal coordinate x i , r ; The 129th value is the number of vertical coordinates after truncation, that is T ; i The range is [1,64];
[0088] Step 23: The number of single track points in step 22 is 64, and the corresponding vertical coordinate sequence is the input image height. H Interpolation to the value 0, that is , i The range is [1,64]; combined with the number of vertical coordinates after truncation T , the left track coordinate sequence is , the right track coordinate sequence is ,in i The range is [1, T ].
[0089] Results of the embodiment of the present invention: The image size is 512*512, and the model output results have a total of 128 coordinate points, including 64 on the left and 64 on the right tracks; the truncation value is 50.
[0090] The image feature extraction effect of the present invention is significantly improved compared with the commonly used segmentation network model, and the magnitude of the network structure parameters is suitable for real-time calculation and edge deployment; the loss function of the present invention incorporates the existing linear features of the track line, and the training effect is significantly improved; it avoids the problem of multiple results being difficult to choose from in the general segmentation model, adaptively distinguishes the direction of the switch, and the number of target tracks is only one.
[0091] The embodiments described above are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various deformations, modifications, and substitutions made by ordinary technicians in this field to the technical solutions of the present invention should all fall within the scope of protection determined by the claims of the present invention.
Claims
1. A track recognition method based on residual network, characterized in that: The following steps are involved: Step 1: Based on the track dataset, a residual network method is used to obtain a track recognition model through network training; Step 2: Collect real-time track images, input them into the track recognition model, and obtain track coordinates; Step 2 includes: Step 21: Input the image into the trained track recognition model. After passing through the convolutional layer or pooling layer, the activation function is used to calculate the feature map until the fully connected layer obtains the final detection result. Step 22: The detection result is a vector of length 129, and the 1st to 64th values are the predicted values of the left track horizontal coordinate, that is, x i , l ; The 65th to 128th values are the predicted values of the right track horizontal coordinate x i , r ; The 129th value is the number of vertical coordinates after truncation, that is T ; i The range is [1,64]; Step 23: There are 64 single track points in step 22, and the corresponding vertical coordinate sequence is the input image height. H Interpolation to the value 0, that is , i The range is [1,64]; combined with the number of vertical coordinates after truncation T , the left track coordinate sequence is , the right track coordinate sequence is , where i is in the range [1, T]; Step 1 includes: Step 11, constructing a residual neural network structure; Step 12: importing the track data set into the residual neural network structure for training to obtain a residual neural network structure with higher training accuracy, i.e., a track recognition model; Step 11 includes: Step 11 a , the residual neural network structure is based on ResNet 18 structure, including 18 convolutional layers, 1 pooling layer, 1 Flatten layer, 2 fully connected layers; Step 11 b , the convolution layer extracts image features; the pooling layer adopts the average pooling method; the Flatten The layer converts the output data of the previous layer into a one-dimensional array; the fully connected layer maps the feature representations of the convolutional layer and the pooling layer to the labels of the data samples. Its network structure is as follows: The first layer is a convolutional layer with 64 convolution kernels of size 7×7 and a stride of 2; The second layer is a maximum pooling layer with a window size of 3×3 and a stride of 2; The 3rd to 6th layers are 64 convolution layers with a kernel size of 3×3 and a stride of 1; The 7th to 10th layers are 128 convolutional layers with a kernel size of 3×3. The stride of the 7th layer is 2, and the stride of the remaining layers is 1; The 11th to 14th layers are convolutional layers with 256 convolution kernels of size 3×3. The stride of the 11th layer is 2, and the stride of the remaining layers is 1; The 15th to 18th layers are convolutional layers with 512 convolution kernels of size 3×3. The stride of the 15th layer is 2, and the stride of the remaining layers is 1; The 19th layer is the average pooling layer; The 20th floor is Flatten Layer, converting 8×16×16 data into a vector of length 2048; The 21st layer is the fully connected layer 1, and the output vector length is 2048; The 22nd layer is the fully connected layer 2, and the output vector length is 129; Step 11 c , step 11 b Use RELU The activation function performs unilateral inhibition, and the formula is as follows: ; Where x is the input vector; Step 12 includes: Step 12 a , the image is input into the residual neural network structure, after passing through the convolution layer or pooling layer, the feature map is calculated by the activation function until the full connection layer obtains the final detection result; Step 12 b , in the test results, x i ,l is the left track horizontal coordinate vector, x i ,r is the right track horizontal coordinate vector; T To predict the number of points after the track is truncated, T The vertical axis is ym , i The range is [1, T ]; Step 12 c , loss function Including geometric loss , cut-off loss and proportion , the formula is as follows: ; Geometric loss The formula is as follows: ; Where, the superscript ^ indicates the true value; β t is the proportional smoothing point of geometric loss; the smoothing function of β proportional point g ( x , β) is: ; Cut-off loss The formula is as follows: ; Where, the superscript ^ indicates the true value; β m is the proportional smoothing point of the cut-off loss; Step 12 d ,Using the stochastic optimization method with adaptive momentum, the network parameters are continuously updated and the loss function value is recalculated until the loss function value converges or the predetermined number of iterations is reached.
Citation Information
Patent Citations
Track area identification method based on deep learning convolutional neural network
CN114581861A